public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* List test update
@ 2006-07-28 15:07 Anthony Balkissoon
  0 siblings, 0 replies; only message in thread
From: Anthony Balkissoon @ 2006-07-28 15:07 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 130 bytes --]

2006-07-28  Anthony Balkissoon  <abalkiss@redhat.com>

	* gnu/testlet/java/awt/List/testSelected.java: Added more checks.

--Tony

[-- Attachment #2: ListSelectedUpdate.diff --]
[-- Type: text/x-patch, Size: 1747 bytes --]

Index: gnu/testlet/java/awt/List/testSelected.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/List/testSelected.java,v
retrieving revision 1.1
diff -u -r1.1 testSelected.java
--- gnu/testlet/java/awt/List/testSelected.java	26 Jul 2006 14:06:43 -0000	1.1
+++ gnu/testlet/java/awt/List/testSelected.java	28 Jul 2006 15:05:01 -0000
@@ -60,6 +60,7 @@
     // Testing that only one item can be selected when 
     // multipleMode is set to false.
     list = new List();
+    harness.check (list.getSelectedIndex() == -1);
     list.setMultipleMode(false);
     list.add("item1");
     list.add("item2");
@@ -252,15 +253,28 @@
     list.add("item1");
     list.add("item2");
     list.add("item3");
-    list.select(1);
+    list.select(2);
     harness.check(list.getItemCount(), 3);
     harness.check(list.isSelected(0), false);
-    harness.check(list.isSelected(1), true);
-    harness.check(list.isSelected(2), false);
-    list.delItem(1);
+    harness.check(list.isSelected(1), false);
+    harness.check(list.isSelected(2), true);
+    list.delItem(2);
     harness.check(list.getItemCount(), 2);
     harness.check(list.isSelected(0), false);
-    harness.check(list.isSelected(1), true);
+    harness.check(list.isSelected(1), false);
+    harness.check(list.isSelected(2), true);
+    boolean exceptionCaught = false;
+    try
+    {
+    	// This will throw an exception, you cannot call getItem(2)
+    	// despite the fact that isSelected(2) returns true.
+    	list.getItem(2);
+    }
+    catch (ArrayIndexOutOfBoundsException ex)
+    {
+    	exceptionCaught = true;
+    }
+    harness.check(exceptionCaught);
   }
 
   public void test12(TestHarness harness)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-28 15:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-28 15:07 List test update Anthony Balkissoon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).