summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-06-07 23:06:45 +0300
committerHenri Sara <hesara@vaadin.com>2015-07-04 10:39:22 +0300
commitd5bf29478183a80ec9d2960e81199cc019f1f453 (patch)
treeb874aefd656a399e2bb989615bc3dfba8e026f8b /uitest
parent340b84a7926714e30621b0ab3ac5ea579cfe4ce6 (diff)
downloadvaadin-framework-d5bf29478183a80ec9d2960e81199cc019f1f453.tar.gz
vaadin-framework-d5bf29478183a80ec9d2960e81199cc019f1f453.zip
Ensure GridLayout rounds available space down instead of up (#15451)
Store measured widths and heights as doubles to be able to round later Change-Id: I15cf7edf829d629a2b012dd2f33e4315ccf6d164
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignment.java66
-rw-r--r--uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignmentTest.java31
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/client/ScrollableGridLayoutConnector.java36
-rw-r--r--uitest/src/com/vaadin/tests/widgetset/server/ScrollableGridLayout.java34
4 files changed, 167 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignment.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignment.java
new file mode 100644
index 0000000000..32d01f9910
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignment.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.gridlayout;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+import com.vaadin.tests.widgetset.server.ScrollableGridLayout;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.GridLayout;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class GridLayoutFractionalSizeAndAlignment extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ widthTest();
+ heightTest();
+ }
+
+ private void widthTest() {
+ final GridLayout layout = new ScrollableGridLayout(1, 1);
+ layout.setMargin(false);
+ layout.setSpacing(true);
+
+ layout.setWidth(525.04f, Unit.PIXELS);
+
+ Button button = new Button("Button");
+
+ layout.addComponent(button);
+ layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT);
+
+ addComponent(layout);
+ }
+
+ private void heightTest() {
+ final GridLayout layout = new ScrollableGridLayout(1, 1);
+ layout.setMargin(false);
+ layout.setSpacing(true);
+
+ layout.setWidth(525.04f, Unit.PIXELS);
+ layout.setHeight(525.04f, Unit.PIXELS);
+
+ Button button = new Button("Button");
+
+ layout.addComponent(button);
+ layout.setComponentAlignment(button, Alignment.BOTTOM_RIGHT);
+
+ addComponent(layout);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignmentTest.java b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignmentTest.java
new file mode 100644
index 0000000000..b60aea49f0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/gridlayout/GridLayoutFractionalSizeAndAlignmentTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.gridlayout;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class GridLayoutFractionalSizeAndAlignmentTest extends MultiBrowserTest {
+
+ @Test
+ public void ensureNoScrollbarsWithAlignBottomRight() throws IOException {
+ openTestURL();
+ compareScreen("noscrollbars");
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ScrollableGridLayoutConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/ScrollableGridLayoutConnector.java
new file mode 100644
index 0000000000..d6431ac9f9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/ScrollableGridLayoutConnector.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.widgetset.client;
+
+import com.vaadin.client.ConnectorHierarchyChangeEvent;
+import com.vaadin.client.ui.VGridLayout;
+import com.vaadin.client.ui.gridlayout.GridLayoutConnector;
+import com.vaadin.client.ui.layout.MayScrollChildren;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.widgetset.server.ScrollableGridLayout;
+
+@Connect(ScrollableGridLayout.class)
+public class ScrollableGridLayoutConnector extends GridLayoutConnector
+ implements MayScrollChildren {
+ @Override
+ public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
+ super.onConnectorHierarchyChange(event);
+
+ for (VGridLayout.Cell cell : getWidget().widgetToCell.values()) {
+ cell.slot.getWrapperElement().addClassName("v-scrollable");
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/ScrollableGridLayout.java b/uitest/src/com/vaadin/tests/widgetset/server/ScrollableGridLayout.java
new file mode 100644
index 0000000000..6958172aa8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/ScrollableGridLayout.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.widgetset.server;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.GridLayout;
+
+public class ScrollableGridLayout extends GridLayout {
+
+ public ScrollableGridLayout() {
+ super();
+ }
+
+ public ScrollableGridLayout(int columns, int rows, Component... children) {
+ super(columns, rows, children);
+ }
+
+ public ScrollableGridLayout(int columns, int rows) {
+ super(columns, rows);
+ }
+}