]> source.dussan.org Git - vaadin-framework.git/commitdiff
Table content cells & column headers get out of sync when uncollapsing columns #7012
authorLeif Åstrand <leif@vaadin.com>
Wed, 31 Aug 2011 06:12:39 +0000 (06:12 +0000)
committerLeif Åstrand <leif@vaadin.com>
Wed, 31 Aug 2011 06:12:39 +0000 (06:12 +0000)
svn changeset:20756/svn branch:6.7

src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
tests/src/com/vaadin/tests/components/table/UncollapsedCollumnWidth.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/table/UncollapsedCollumnWidth.java [new file with mode: 0644]

index 9f7d6445db5888172d5c061a2b2c97efdc948b2a..e893001c39ff16a47385f74cd6eed7291b372ee0 100644 (file)
@@ -2280,7 +2280,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
          * @return true if defined, false if "natural" width
          */
         public boolean isDefinedWidth() {
-            return definedWidth;
+            return definedWidth && width > 0;
         }
 
         public int getWidth() {
diff --git a/tests/src/com/vaadin/tests/components/table/UncollapsedCollumnWidth.html b/tests/src/com/vaadin/tests/components/table/UncollapsedCollumnWidth.html
new file mode 100644 (file)
index 0000000..e1b3953
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.table.UncollapsedCollumnWidth?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>mouseClick</td>
+       <td>vaadin=runcomvaadintestscomponentstableUncollapsedCollumnWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+       <td>1,10</td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>vaadin=runcomvaadintestscomponentstableUncollapsedCollumnWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertNotElementWidth</td>
+       <td>vaadin=runcomvaadintestscomponentstableUncollapsedCollumnWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+       <td>0</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/table/UncollapsedCollumnWidth.java b/tests/src/com/vaadin/tests/components/table/UncollapsedCollumnWidth.java
new file mode 100644 (file)
index 0000000..99b954f
--- /dev/null
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Table;
+
+public class UncollapsedCollumnWidth extends TestBase {
+
+    @Override
+    protected void setup() {
+        final Table table = new Table();
+        table.addContainerProperty("Col1", String.class, "");
+        table.addContainerProperty("Col2", String.class, "");
+        table.setColumnCollapsingAllowed(true);
+        table.setColumnCollapsed("Col2", true);
+
+        table.setColumnWidth("Col1", 150);
+
+        table.setWidth("400px");
+
+        table.addItem(new Object[] { "Cell 1", "Cell 2" }, new Object());
+
+        addComponent(table);
+        addComponent(new Button("Uncollapse col2", new Button.ClickListener() {
+            public void buttonClick(ClickEvent event) {
+                table.setColumnCollapsed("Col2", false);
+            }
+        }));
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Uncollapsing col2 after resizing col1 should set a reasonable width for col2. Additionally, the width of the header and the cell content should be the same.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(7012);
+    }
+
+}