Reviewers: eschoeffler,

Description:
Adding a test case that verifies CellTable works even if all image
resources are null.  Sort icons are only used if a column is sorted
(sorting will cause an NPE). Background icons are used in the default
styles, and are optional. The sorting icon is specially handled to allow
for null.


Please review this at http://gwt-code-reviews.appspot.com/1534803/

Affected files:
  M user/test/com/google/gwt/user/cellview/client/CellTableTest.java


Index: user/test/com/google/gwt/user/cellview/client/CellTableTest.java
===================================================================
--- user/test/com/google/gwt/user/cellview/client/CellTableTest.java (revision 10584) +++ user/test/com/google/gwt/user/cellview/client/CellTableTest.java (working copy)
@@ -230,6 +230,59 @@
   }

   /**
+   * CellTable should not throw any errors if all of the icons are null.
+   *
+ * Sort icons are only used if a column is sorted. Background icons are not + * used in the default styles, and are optional. The sorting icon is specially
+   * handled.
+   */
+  public void testNullIcons() {
+    // Create a Resources instance that does not include sort images.
+    CellTable.Resources resources = new CellTable.Resources() {
+ private final CellTable.Resources defaultRes = GWT.create(CellTable.Resources.class);
+
+      @Override
+      public ImageResource cellTableFooterBackground() {
+        return null;
+      }
+
+      @Override
+      public ImageResource cellTableHeaderBackground() {
+        return null;
+      }
+
+      @Override
+      public ImageResource cellTableLoading() {
+        return null;
+      }
+
+      @Override
+      public ImageResource cellTableSelectedBackground() {
+        return null;
+      }
+
+      @Override
+      public ImageResource cellTableSortAscending() {
+        return null;
+      }
+
+      @Override
+      public ImageResource cellTableSortDescending() {
+        return null;
+      }
+
+      @Override
+      public Style cellTableStyle() {
+        return defaultRes.cellTableStyle();
+      }
+    };
+
+    CellTable<String> table = new CellTable<String>(10, resources);
+    populateData(table);
+    table.getPresenter().flush();
+  }
+
+  /**
    * Test that removing a column sets its width to zero.
    */
   public void testRemoveColumnWithWidth() {


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to