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: eschoeffler@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10587 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/user/cellview/client/CellTableTest.java b/user/test/com/google/gwt/user/cellview/client/CellTableTest.java
index be3ca28..c54266f 100644
--- a/user/test/com/google/gwt/user/cellview/client/CellTableTest.java
+++ b/user/test/com/google/gwt/user/cellview/client/CellTableTest.java
@@ -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() {