Fix for HTMLTable.Cell#getElement() bug where it passes the row and cell index in the wrong order.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7473 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/HTMLTable.java b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
index e4b4d1b..8b16074 100644
--- a/user/src/com/google/gwt/user/client/ui/HTMLTable.java
+++ b/user/src/com/google/gwt/user/client/ui/HTMLTable.java
@@ -76,7 +76,7 @@
* @return the cell's element.
*/
public Element getElement() {
- return getCellFormatter().getElement(cellIndex, rowIndex);
+ return getCellFormatter().getElement(rowIndex, cellIndex);
}
/**
diff --git a/user/test/com/google/gwt/user/client/ui/HTMLTableTestBase.java b/user/test/com/google/gwt/user/client/ui/HTMLTableTestBase.java
index 4fd1c30..7a7ba79 100644
--- a/user/test/com/google/gwt/user/client/ui/HTMLTableTestBase.java
+++ b/user/test/com/google/gwt/user/client/ui/HTMLTableTestBase.java
@@ -15,8 +15,10 @@
*/
package com.google.gwt.user.client.ui;
+import com.google.gwt.dom.client.TableCellElement;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.HTMLTable.Cell;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
import com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter;
import com.google.gwt.user.client.ui.HTMLTable.RowFormatter;
@@ -76,6 +78,22 @@
fail("should have throw an index out of bounds");
}
+ /**
+ * Tests for {@link HTMLTable.Cell}.
+ */
+ public void testCell() {
+ HTMLTable table = getTable(1, 4);
+ table.setText(0, 3, "test");
+ Cell cell = table.new Cell(0, 3);
+
+ assertEquals(0, cell.getRowIndex());
+ assertEquals(3, cell.getCellIndex());
+
+ TableCellElement elem = cell.getElement().cast();
+ assertEquals(3, elem.getCellIndex());
+ assertEquals("test", elem.getInnerText());
+ }
+
public void testClearWidgetsAndHtml() {
HTMLTable table = getTable(4, 4);
for (int row = 0; row < 4; row++) {