Index: modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSliderUITest.java
===================================================================
--- modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSliderUITest.java (revision 489577)
+++ modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicSliderUITest.java (working copy)
@@ -20,8 +20,11 @@
*/
package javax.swing.plaf.basic;
+import java.awt.IllegalComponentStateException;
import java.awt.Point;
import java.util.Hashtable;
+
+import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.SwingTestCase;
@@ -224,4 +227,62 @@
sliderUI.setThumbLocation(-200, 500);
assertEquals(new Point(-200, 500), sliderUI.thumbRect.getLocation());
}
+
+ // Regression test for HARMONY-2855
+ public void testBasicSliderUI() throws Exception {
+ assertNull(sliderUI.slider);
+ }
+
+ /**
+ * uninstallUI is called with the same instance of
+ * JSlider to which this UI was installed.
+ */
+ // Regression test for HARMONY-2855
+ public void testUninstallUI01() {
+ sliderUI.installUI(slider);
+ sliderUI.uninstallUI(slider);
+ // No exception is expected
+ }
+
+ /**
+ * uninstallUI is called before installUI
+ * was called.
+ */
+ // Regression test for HARMONY-2855
+ public void testUninstallUI02() {
+ try {
+ sliderUI.uninstallUI(slider);
+ fail("IllegalComponentStateException is expected");
+ } catch (IllegalComponentStateException e) {
+ // expected
+ }
+ }
+
+ /**
+ * uninstallUI is called with another instance of
+ * JSlider.
+ */
+ // Regression test for HARMONY-2855
+ public void testUninstallUI03() {
+ try {
+ sliderUI.uninstallUI(new JSlider());
+ fail("IllegalComponentStateException is expected");
+ } catch (IllegalComponentStateException e) {
+ // expected
+ }
+ }
+
+ /**
+ * uninstallUI is called with instance of another class, i.e.
+ * not JSlider instance.
+ */
+ // Regression test for HARMONY-2855
+ public void testUninstallUI04() {
+ try {
+ sliderUI.uninstallUI(new JButton());
+ fail("IllegalComponentStateException is expected");
+ } catch (IllegalComponentStateException e) {
+ // expected
+ }
+ }
}