aboutsummaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-06-07 23:06:45 +0300
committerVaadin Code Review <review@vaadin.com>2015-06-12 11:51:16 +0000
commit914eafd5fe7d43290abe0b6b07678df0a8f45ee0 (patch)
treed392d772393791ee6301c6b3e4023c6868b35ef9 /uitest
parent7f39ad337ec489d58cee6cb99d32f4364a93b1eb (diff)
downloadvaadin-framework-914eafd5fe7d43290abe0b6b07678df0a8f45ee0.tar.gz
vaadin-framework-914eafd5fe7d43290abe0b6b07678df0a8f45ee0.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: Id0e91702dd62ba362f53317e8520f85b46f19769
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);
+ }
+}