public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: New BasicOptionPaneUI
@ 2006-08-01 20:50 Roman Kennke
  0 siblings, 0 replies; only message in thread
From: Roman Kennke @ 2006-08-01 20:50 UTC (permalink / raw)
  To: mauve-patches

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

Another regression test for a reported bug in Classpath.

2006-08-01  Roman Kennke  <kennke@aicas.com>

	* 
gnu/testlet/javax/swing/plaf/basic/BasicOptionPaneUI/PropertyChangeHandler/propertyChange.java:
	New test.


/Roman

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

Index: gnu/testlet/javax/swing/plaf/basic/BasicOptionPaneUI/PropertyChangeHandler/propertyChange.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicOptionPaneUI/PropertyChangeHandler/propertyChange.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicOptionPaneUI/PropertyChangeHandler/propertyChange.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicOptionPaneUI/PropertyChangeHandler/propertyChange.java	1 Aug 2006 20:49:14 -0000
@@ -0,0 +1,118 @@
+// Tags: JDK1.2 
+
+// Copyright (C) 2006 Roman Kennke (kennke@aicas.com)
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version. 
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.plaf.basic.BasicOptionPaneUI.PropertyChangeHandler;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.ImageIcon;
+import javax.swing.JOptionPane;
+import javax.swing.plaf.basic.BasicOptionPaneUI;
+
+public class propertyChange
+  implements Testlet
+{
+
+  class TestOptionPaneUI
+    extends BasicOptionPaneUI
+  {
+    protected void installComponents()
+    {
+      super.installComponents();
+      // Uncomment to see that the call originates in propertyChange().
+      //Thread.dumpStack();
+      installComponentsCalled = true;
+    }
+
+    protected void uninstallComponents()
+    {
+      super.uninstallComponents();
+      // Uncomment to see that the call originates in propertyChange().
+      // Thread.dumpStack();
+      uninstallComponentsCalled = true;
+    }
+  }
+
+  boolean installComponentsCalled;
+  boolean uninstallComponentsCalled;
+
+  /**
+   * The entry point.
+   *
+   * @param h the test harness
+   */
+  public void test(TestHarness h)
+  {
+    testVisualProperties(h);
+  }
+
+  /**
+   * This tests if the BasicOptionPaneUI correctly uninstalls and reinstalls
+   * the components on the JOptionPane. That is, it should call
+   * uninstallComponents() and installComponents() when any of the
+   * visual properties changes.
+   *
+   * @param h the test harness
+   */
+  private void testVisualProperties(TestHarness h)
+  {
+    JOptionPane p = new JOptionPane();
+    TestOptionPaneUI ui = new TestOptionPaneUI();
+    p.setUI(ui);
+
+    installComponentsCalled = false;
+    uninstallComponentsCalled = false;
+
+    p.setIcon(new ImageIcon());
+    checkReinstalled(h);
+
+    p.setInitialSelectionValue("Hello World");
+    checkReinstalled(h);
+
+    p.setInitialValue(new Object());
+    checkReinstalled(h);
+
+    p.setMessage(new Object());
+    checkReinstalled(h);
+
+    p.setMessageType(JOptionPane.ERROR_MESSAGE);
+    checkReinstalled(h);
+
+    p.setOptions(new Object[0]);
+    checkReinstalled(h);
+
+    p.setOptionType(JOptionPane.NO_OPTION);
+    checkReinstalled(h);
+
+    p.setWantsInput(false);
+    p.setWantsInput(true);
+    checkReinstalled(h);
+  }
+
+  private void checkReinstalled(TestHarness h)
+  {
+    h.check(installComponentsCalled, true);
+    h.check(uninstallComponentsCalled, true);
+    installComponentsCalled = false;
+    uninstallComponentsCalled = false;
+  }
+}
\ No newline at end of file

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

only message in thread, other threads:[~2006-08-01 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-01 20:50 FYI: New BasicOptionPaneUI Roman Kennke

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).