This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Re: FYI: New JSlider Test
Sorry... Forgot to attach the patch. Here it is.
On Mon, 2006-11-20 at 14:51 -0500, Tania Bento wrote:
> Hey,
>
> This patch adds a new test to javax.swing.JSlider.setLabelTable().
>
> Cheers,
> Tania
>
> 2006-11-20 Tania Bento <tbento@redhat.com>
>
> * gnu/testlet/javax/swing/JSlider/setLabelTable.java: Added a
> new test.
>
Index: gnu/testlet/javax/swing/JSlider/setLabelTable.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JSlider/setLabelTable.java,v
retrieving revision 1.1
diff -u -r1.1 setLabelTable.java
--- gnu/testlet/javax/swing/JSlider/setLabelTable.java 20 Jul 2005 10:20:06 -0000 1.1
+++ gnu/testlet/javax/swing/JSlider/setLabelTable.java 20 Nov 2006 19:48:46 -0000
@@ -2,6 +2,7 @@
// Uses: MyChangeListener MyPropertyChangeListener
// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// 2006 Red Hat
// Mauve is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -23,6 +24,7 @@
import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;
+import java.util.Dictionary;
import java.util.Hashtable;
import javax.swing.JLabel;
@@ -69,6 +71,23 @@
// try null table
slider.setLabelTable(null);
harness.check(slider.getLabelTable(), null);
+
+ // This next test shows that it is not necessary to cast
+ // "list.nextElement()" to type JLabel.
+ // NOTE: With the casting, a ClassCastException was thrown.
+ boolean pass = false;
+ Dictionary labelTable = new Hashtable();
+ labelTable.put("a", "b");
+ try
+ {
+ slider.setLabelTable(labelTable);
+ pass = true;
+ }
+ catch (ClassCastException e)
+ {
+ // Do nothing.
+ }
+ harness.check(pass);
}
}