summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2005-11-25 17:55:58 +0000
committerVeronika Irvine <veronika>2005-11-25 17:55:58 +0000
commit7962428c5ab7103fb62cdd42bba1f4c7b05b65f7 (patch)
tree6fa5ca729702d43096517e909690ed61c9be0900 /tests
parentac9ea3dbfd3690ee4088b4ff0575f011e85c8aec (diff)
downloadeclipse.platform.swt-7962428c5ab7103fb62cdd42bba1f4c7b05b65f7.tar.gz
eclipse.platform.swt-7962428c5ab7103fb62cdd42bba1f4c7b05b65f7.tar.xz
eclipse.platform.swt-7962428c5ab7103fb62cdd42bba1f4c7b05b65f7.zip
add test for getItemI
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.java32
-rw-r--r--tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java32
2 files changed, 64 insertions, 0 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 3e525c5e75..8c91d4562a 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
@@ -194,6 +194,36 @@ public void test_getItemHeight() {
assertTrue(":b: Item height is 0", tree.getItemHeight() > 0);
}
+public void test_getItemI() {
+ int number = 15;
+ TreeItem[] items = new TreeItem[number];
+ for (int i = 0; i < number; i++)
+ items[i] = new TreeItem(tree, 0);
+
+ for (int i = 0; i < number; i++)
+ assertEquals("i=" + i, items[i], tree.getItem(i));
+ try {
+ tree.getItem(number);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+
+ try {
+ tree.getItem(number+1);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+
+ try {
+ tree.getItem(-1);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+}
+
public void test_getItemLorg_eclipse_swt_graphics_Point() {
warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written");
}
@@ -636,6 +666,7 @@ public static java.util.Vector methodNames() {
methodNames.addElement("test_getHeaderVisible");
methodNames.addElement("test_getItemCount");
methodNames.addElement("test_getItemHeight");
+ methodNames.addElement("test_getItemI");
methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point");
methodNames.addElement("test_getItems");
methodNames.addElement("test_getLinesVisible");
@@ -682,6 +713,7 @@ protected void runTest() throws Throwable {
else if (getName().equals("test_getHeaderVisible")) test_getHeaderVisible();
else if (getName().equals("test_getItemCount")) test_getItemCount();
else if (getName().equals("test_getItemHeight")) test_getItemHeight();
+ else if (getName().equals("test_getItemI")) test_getItemI();
else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point();
else if (getName().equals("test_getItems")) test_getItems();
else if (getName().equals("test_getLinesVisible")) test_getLinesVisible();
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
index 68406b007d..539b60f542 100644
--- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
+++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java
@@ -638,6 +638,36 @@ public void test_getImageI() {
// tested in test_setImageILorg_eclipse_swt_graphics_Image
}
+public void test_getItemI() {
+ int number = 15;
+ TreeItem[] items = new TreeItem[number];
+ for (int i = 0; i < number; i++)
+ items[i] = new TreeItem(treeItem, 0);
+
+ for (int i = 0; i < number; i++)
+ assertEquals("i=" + i, items[i], treeItem.getItem(i));
+ try {
+ treeItem.getItem(number);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+
+ try {
+ treeItem.getItem(number+1);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+
+ try {
+ treeItem.getItem(-1);
+ fail("No exception thrown for illegal index argument");
+ }
+ catch (IllegalArgumentException e) {
+ }
+}
+
public void test_getItemCount() {
for (int i = 0; i < 10; i++) {
assertEquals(i, treeItem.getItemCount());
@@ -1146,6 +1176,7 @@ public static java.util.Vector methodNames() {
methodNames.addElement("test_getGrayed");
methodNames.addElement("test_getImageBoundsI");
methodNames.addElement("test_getImageI");
+ methodNames.addElement("test_getItemI");
methodNames.addElement("test_getItemCount");
methodNames.addElement("test_getItems");
methodNames.addElement("test_getParent");
@@ -1187,6 +1218,7 @@ protected void runTest() throws Throwable {
else if (getName().equals("test_getGrayed")) test_getGrayed();
else if (getName().equals("test_getImageBoundsI")) test_getImageBoundsI();
else if (getName().equals("test_getImageI")) test_getImageI();
+ else if (getName().equals("test_getItemI")) test_getItemI();
else if (getName().equals("test_getItemCount")) test_getItemCount();
else if (getName().equals("test_getItems")) test_getItems();
else if (getName().equals("test_getParent")) test_getParent();