Revision: 10587
Author:   gwt.mirror...@gmail.com
Date:     Fri Aug 26 09:55:44 2011
Log: 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.

Review at http://gwt-code-reviews.appspot.com/1534803

Review by: eschoeff...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=10587

Modified:
 /trunk/user/test/com/google/gwt/user/cellview/client/CellTableTest.java

=======================================
--- /trunk/user/test/com/google/gwt/user/cellview/client/CellTableTest.java Fri Aug 26 09:38:28 2011 +++ /trunk/user/test/com/google/gwt/user/cellview/client/CellTableTest.java Fri Aug 26 09:55:44 2011
@@ -207,6 +207,59 @@
       public ImageResource cellTableSelectedBackground() {
         return defaultRes.cellTableSelectedBackground();
       }
+
+      @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();
+  }
+
+  /**
+   * 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() {

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

Reply via email to