Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVeronika Irvine2006-03-09 15:55:11 +0000
committerVeronika Irvine2006-03-09 15:55:11 +0000
commit9617c74801be56966a241f02e1e32f49eece2277 (patch)
tree74b711ea7ed6f99092f3353bc29e4021549c1677 /tests
parent6434010d1904d3660f2c4915c36aae32774cb999 (diff)
downloadeclipse.platform.swt-9617c74801be56966a241f02e1e32f49eece2277.tar.gz
eclipse.platform.swt-9617c74801be56966a241f02e1e32f49eece2277.tar.xz
eclipse.platform.swt-9617c74801be56966a241f02e1e32f49eece2277.zip
adding getItemCount() and setItemCount(int) tests
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
index 8c91d4562a..b555ca2828 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java
@@ -185,7 +185,7 @@ public void test_getHeaderVisible() {
}
public void test_getItemCount() {
- warnUnimpl("Test test_getItemCount not written");
+ //tested in test_setItemCountI
}
public void test_getItemHeight() {
@@ -386,6 +386,44 @@ public void test_setHeaderVisibleZ() {
assertFalse(tree.getHeaderVisible());
}
+public void test_setItemCountI() {
+ tree.removeAll();
+ assertEquals(0, tree.getItemCount());
+ for (int i=0; i<8; i++) {
+ TreeItem item = new TreeItem(tree, SWT.NULL);
+ assertEquals(i+1, tree.getItemCount());
+ }
+ assertEquals(8, tree.getItemCount());
+ assertEquals(4, tree.indexOf(tree.getItems()[4]));
+ tree.getItem(1).dispose();
+ assertEquals(7, tree.getItemCount());
+ TreeItem item = new TreeItem (tree, SWT.NULL, 0);
+ assertEquals(1, tree.indexOf(tree.getItems()[1]));
+ assertEquals(8, tree.getItemCount());
+ tree.removeAll();
+ assertEquals(0, tree.getItemCount());
+ tree.setItemCount(0);
+ assertEquals(0, tree.getItemCount());
+ tree.setItemCount(-1);
+ assertEquals(0, tree.getItemCount());
+ tree.setItemCount(10);
+ assertEquals(10, tree.getItemCount());
+ tree.getItem(1).dispose();
+ assertEquals(9, tree.getItemCount());
+ assertEquals(4, tree.indexOf(tree.getItems()[4]));
+ tree.setItemCount(3);
+ assertEquals(3, tree.getItemCount());
+ try {
+ tree.getItem(4);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+ tree.setItemCount(40);
+ assertEquals(40, tree.getItemCount());
+ tree.getItem(39);
+}
+
public void test_setLinesVisibleZ() {
if (SwtJunit.isCarbon) {
// carbon does not support lines
@@ -680,6 +718,7 @@ public static java.util.Vector methodNames() {
methodNames.addElement("test_selectAll");
methodNames.addElement("test_setHeaderVisibleZ");
methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ");
+ methodNames.addElement("test_setItemCountI");
methodNames.addElement("test_setLinesVisibleZ");
methodNames.addElement("test_setRedrawZ");
methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem");
@@ -728,6 +767,7 @@ protected void runTest() throws Throwable {
else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font();
else if (getName().equals("test_setHeaderVisibleZ")) test_setHeaderVisibleZ();
else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ")) test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ();
+ else if (getName().equals("test_setItemCountI")) test_setItemCountI();
else if (getName().equals("test_setLinesVisibleZ")) test_setLinesVisibleZ();
else if (getName().equals("test_setRedrawZ")) test_setRedrawZ();
else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem")) test_setSelection$Lorg_eclipse_swt_widgets_TreeItem();

Back to the top