harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [10/28] - /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/
Date Sun, 26 Nov 2006 00:04:16 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_AddRemoveNotifyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_AddRemoveNotifyTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_AddRemoveNotifyTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_AddRemoveNotifyTest.java Sat Nov 25 16:04:10 2006
@@ -22,26 +22,30 @@
 
 import java.awt.EventQueue;
 import java.awt.Toolkit;
-
 import org.apache.harmony.x.swing.StringConstants;
 
 public class JComponent_AddRemoveNotifyTest extends BasicSwingTestCase {
     private JPanel ancestorParent;
+
     private JPanel ancestor;
+
     private JButton component;
+
     private PropertyChangeController listener;
+
     private JFrame frame;
 
+    @Override
     protected void setUp() throws Exception {
         ancestorParent = new JPanel();
         ancestor = new JPanel();
         component = new JButton();
         ancestor.add(component);
         listener = new PropertyChangeController();
-
         component.addPropertyChangeListener(StringConstants.ANCESTOR_PROPERTY_NAME, listener);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         listener.setVerbose(false);
         ancestor = null;
@@ -53,63 +57,62 @@
         }
     }
 
-
     public void testAddNotifyWhenComponentAdded() throws Exception {
         frame = createVisibleFrameWithAncestor();
         ancestor.remove(component);
         waitEventQueueEmptiness();
         listener.reset();
-
         ancestor.add(component);
         waitEventQueueEmptiness();
         assertEquals(1, listener.getNumEvents());
-        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME, null, ancestor);
+        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME,
+                null, ancestor);
     }
 
     public void testAddNotifyWhenAncestorAdded() throws Exception {
         frame = createVisibleFrameWithAncestor();
         waitEventQueueEmptiness();
-
         assertEquals(1, listener.getNumEvents());
-        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME, null, ancestor);
+        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME,
+                null, ancestor);
     }
 
     public void testAddNotifyWhenAncestorParentAdded() throws Exception {
         frame = createVisibleFrameWithAncestorParent();
         waitEventQueueEmptiness();
-
         assertEquals(1, listener.getNumEvents());
-        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME, null, ancestor);
+        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME,
+                null, ancestor);
     }
 
     public void testRemoveNotifyWhenComponentRemoved() throws Exception {
         frame = createVisibleFrameWithAncestor();
         listener.reset();
-
         ancestor.remove(component);
         waitEventQueueEmptiness();
         assertEquals(1, listener.getNumEvents());
-        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME, ancestor, null);
+        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME,
+                ancestor, null);
     }
 
     public void testRemoveNotifyWhenAncestorRemoved() throws Exception {
         frame = createVisibleFrameWithAncestor();
         listener.reset();
-
         frame.getContentPane().remove(ancestor);
         waitEventQueueEmptiness();
         assertEquals(1, listener.getNumEvents());
-        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME, ancestor, null);
+        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME,
+                ancestor, null);
     }
 
     public void testRemoveNotifyWhenAncestorParentRemoved() throws Exception {
         frame = createVisibleFrameWithAncestorParent();
         listener.reset();
-
         frame.getContentPane().remove(ancestorParent);
         waitEventQueueEmptiness();
         assertEquals(1, listener.getNumEvents());
-        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME, ancestor, null);
+        listener.checkLastPropertyFired(component, StringConstants.ANCESTOR_PROPERTY_NAME,
+                ancestor, null);
     }
 
     private JFrame createVisibleFrameWithAncestor() {
@@ -117,7 +120,6 @@
         result.getContentPane().add(ancestor);
         result.setSize(200, 200);
         result.setVisible(true);
-
         return result;
     }
 
@@ -127,15 +129,16 @@
         result.getContentPane().add(ancestorParent);
         result.setSize(200, 200);
         result.setVisible(true);
-
         return result;
     }
 
     private void waitEventQueueEmptiness() {
         try {
-            while (Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent() != null || EventQueue.getCurrentEvent() != null) {
+            while (Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent() != null
+                    || EventQueue.getCurrentEvent() != null) {
                 Thread.sleep(10);
             }
-        } catch (InterruptedException e) {}
+        } catch (InterruptedException e) {
+        }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_MultithreadedTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_MultithreadedTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_MultithreadedTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JComponent_MultithreadedTest.java Sat Nov 25 16:04:10 2006
@@ -26,18 +26,17 @@
 import java.awt.Container;
 import java.awt.EventQueue;
 import java.awt.FocusTraversalPolicy;
-
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicLookAndFeel;
 
-
 public class JComponent_MultithreadedTest extends BasicSwingTestCase {
-
     protected JComponent panel;
+
     protected JFrame window;
 
-    class MyInputVerifier extends InputVerifier{
+    class MyInputVerifier extends InputVerifier {
         public boolean invoked = false;
+
         private boolean returnedValue = true;
 
         MyInputVerifier() {
@@ -47,6 +46,7 @@
             this.returnedValue = returnedValue;
         }
 
+        @Override
         public boolean verify(final JComponent input) {
             invoked = true;
             return returnedValue;
@@ -64,11 +64,11 @@
     private boolean requestFocusInWindowForComponent(final JComponent c) throws Exception {
         boolean result = c.requestFocusInWindow();
         waitForFocus(c);
-
         return result;
     }
 
-    private boolean requestFocusInWindowForComponent(final JComponent c, final boolean temporarily) throws Exception {
+    private boolean requestFocusInWindowForComponent(final JComponent c,
+            final boolean temporarily) throws Exception {
         c.requestFocusInWindow(temporarily);
         return waitForFocus(c);
     }
@@ -78,12 +78,14 @@
         waitForFocus(c);
     }
 
-    protected void requestDefaultFocusForComponent(final JComponent c, final Component newFocusOwner) throws Exception {
+    protected void requestDefaultFocusForComponent(final JComponent c,
+            final Component newFocusOwner) throws Exception {
         c.requestDefaultFocus();
         waitForFocus(newFocusOwner);
     }
 
-    private void requestFocusForComponent(final JComponent c, final boolean temporarily) throws Exception {
+    private void requestFocusForComponent(final JComponent c, final boolean temporarily)
+            throws Exception {
         c.requestFocus(temporarily);
         waitForFocus(c);
     }
@@ -103,6 +105,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         panel = new JPanel();
@@ -112,6 +115,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         window.dispose();
         super.tearDown();
@@ -120,6 +124,7 @@
     /*
      * Class under test for void requestFocus()
      */
+    @SuppressWarnings("deprecation")
     public void testRequestFocus() throws Exception {
         MyInputVerifier verifier = new MyInputVerifier();
         JComponent panel1 = new JPanel();
@@ -133,7 +138,6 @@
         window.pack();
         window.show();
         waitForIdle();
-
         SwingWaitTestCase.requestFocusInWindowForComponent(panel1);
         panel1.setInputVerifier(verifier);
         panel2.setVerifyInputWhenFocusTarget(true);
@@ -141,10 +145,8 @@
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         requestFocusForComponent(panel1);
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         requestFocusForComponent(panel2);
         assertFalse("verifier's not invoked ", verifier.invoked);
@@ -154,6 +156,7 @@
     /*
      * Class under test for boolean requestFocusInWindow()
      */
+    @SuppressWarnings("deprecation")
     public void testRequestFocusInWindow() throws Exception {
         MyInputVerifier verifier = new MyInputVerifier();
         MyInputVerifier verifier2 = new MyInputVerifier(false);
@@ -168,7 +171,6 @@
         window.pack();
         window.show();
         waitForIdle();
-
         SwingWaitTestCase.requestFocusInWindowForComponent(panel1);
         panel1.setInputVerifier(verifier);
         panel2.setVerifyInputWhenFocusTarget(true);
@@ -176,15 +178,12 @@
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel1));
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel2));
         assertFalse("verifier's not invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
-
         panel1.setVerifyInputWhenFocusTarget(true);
         panel2.setInputVerifier(verifier2);
         assertFalse("focus can be gained ", requestFocusInWindowForComponent(panel1, true));
@@ -196,6 +195,7 @@
     /*
      * Class under test for boolean requestFocus(boolean)
      */
+    @SuppressWarnings("deprecation")
     public void testRequestFocusboolean() throws Exception {
         MyInputVerifier verifier = new MyInputVerifier();
         JComponent panel1 = new JPanel();
@@ -209,7 +209,6 @@
         window.pack();
         window.show();
         waitForIdle();
-
         SwingWaitTestCase.requestFocusInWindowForComponent(panel1);
         panel1.setInputVerifier(verifier);
         panel2.setVerifyInputWhenFocusTarget(true);
@@ -217,27 +216,21 @@
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         requestFocusForComponent(panel1, false);
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         requestFocusForComponent(panel2, false);
         assertFalse("verifier's not invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
-
         requestFocusForComponent(panel1, false);
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(true);
         requestFocusForComponent(panel2, true);
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         requestFocusForComponent(panel1, true);
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         requestFocusForComponent(panel2, true);
         assertFalse("verifier's not invoked ", verifier.invoked);
@@ -247,6 +240,7 @@
     /*
      * Class under test for boolean requestFocusInWindow(boolean)
      */
+    @SuppressWarnings("deprecation")
     public void testRequestFocusInWindowboolean() throws Exception {
         MyInputVerifier verifier = new MyInputVerifier();
         MyInputVerifier verifier2 = new MyInputVerifier(false);
@@ -261,7 +255,6 @@
         window.pack();
         window.show();
         waitForIdle();
-
         SwingWaitTestCase.requestFocusInWindowForComponent(panel1);
         panel1.setInputVerifier(verifier);
         panel2.setVerifyInputWhenFocusTarget(true);
@@ -269,32 +262,25 @@
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel1, false));
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel2, false));
         assertFalse("verifier's not invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
-
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel1, false));
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(true);
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel2, true));
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel1, true));
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         assertTrue("focus can be gained ", requestFocusInWindowForComponent(panel2, true));
         assertFalse("verifier's not invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
-
         panel1.setVerifyInputWhenFocusTarget(true);
         panel2.setInputVerifier(verifier2);
         assertFalse("focus can be gained ", requestFocusInWindowForComponent(panel1, true));
@@ -303,6 +289,7 @@
         verifier.invoked = false;
     }
 
+    @SuppressWarnings("deprecation")
     public void testGrabFocus() throws Exception {
         MyInputVerifier verifier = new MyInputVerifier();
         JComponent panel1 = new JPanel();
@@ -316,7 +303,6 @@
         window.pack();
         window.show();
         waitForIdle();
-
         SwingWaitTestCase.requestFocusInWindowForComponent(panel1);
         panel1.setInputVerifier(verifier);
         panel2.setVerifyInputWhenFocusTarget(true);
@@ -324,43 +310,47 @@
         assertTrue("verifier's invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
         verifier.invoked = false;
-
         grabFocusForComponent(panel1);
         assertTrue("focus's gained ", panel1.isFocusOwner());
-
         panel2.setVerifyInputWhenFocusTarget(false);
         grabFocusForComponent(panel2);
         assertFalse("verifier's not invoked ", verifier.invoked);
         assertTrue("focus's gained ", panel2.isFocusOwner());
     }
 
+    @SuppressWarnings("deprecation")
     public void testRequestDefaultFocus() throws Exception {
         final JComponent panel1 = new JPanel();
         final JComponent panel2 = new JPanel();
         final JComponent panel3 = new JPanel();
         final JComponent panel4 = new JPanel(); // this component is to be returned
-                                                // by our FocusTraversalPolicy()
+        // by our FocusTraversalPolicy()
         FocusTraversalPolicy policy = new FocusTraversalPolicy() {
+            @Override
             public Component getComponentAfter(final Container a0, final Component a1) {
                 return null;
             }
+
+            @Override
             public Component getComponentBefore(final Container a0, final Component a1) {
                 return null;
             }
 
+            @Override
             public Component getDefaultComponent(final Container a0) {
                 return panel4;
             }
 
+            @Override
             public Component getFirstComponent(final Container a0) {
                 return null;
             }
 
+            @Override
             public Component getLastComponent(final Container a0) {
                 return null;
             }
         };
-
         window.getContentPane().add(panel1);
         window.getContentPane().add(panel2);
         window.getContentPane().add(panel3);
@@ -368,19 +358,15 @@
         window.pack();
         window.show();
         waitForIdle();
-
         requestDefaultFocusForComponent(panel2, window);
         assertTrue("focus's gained ", window.isFocusOwner());
-
         panel3.setFocusCycleRoot(false);
         panel3.setFocusTraversalPolicy(policy);
         requestDefaultFocusForComponent(panel3, window);
         assertTrue("focus's gained ", window.isFocusOwner());
-
         panel3.setFocusCycleRoot(true);
         requestDefaultFocusForComponent(panel3, panel4);
         assertTrue("focus's gained ", panel4.isFocusOwner());
-
         panel3.setFocusCycleRoot(false);
         requestDefaultFocusForComponent(panel3, window);
         assertFalse("focus's gained ", window.isFocusOwner());
@@ -390,32 +376,42 @@
         LookAndFeel laf = UIManager.getLookAndFeel();
         try {
             JButton button = new JButton();
-
             BasicLookAndFeel lookAndFeel1 = new BasicLookAndFeel() {
+                private static final long serialVersionUID = 1L;
+
+                @Override
                 public boolean isSupportedLookAndFeel() {
                     return true;
                 }
+
+                @Override
                 public boolean isNativeLookAndFeel() {
                     return false;
                 }
+
+                @Override
                 public String getName() {
                     return "BasicLookAndFeel";
                 }
+
+                @Override
                 public String getID() {
                     return "BasicLookAndFeel";
                 }
+
+                @Override
                 public String getDescription() {
                     return "BasicLookAndFeel";
                 }
             };
             UIManager.setLookAndFeel(lookAndFeel1);
-
             ComponentUI ui = button.getUI();
-            assertTrue("current component's ui is correct ", ui.getClass().getName().endsWith("MetalButtonUI"));
-
+            assertTrue("current component's ui is correct ", ui.getClass().getName().endsWith(
+                    "MetalButtonUI"));
             button.updateUI();
             ui = button.getUI();
-            assertTrue("L&F change affected component's ui ", ui.getClass().getName().endsWith("BasicButtonUI"));
+            assertTrue("L&F change affected component's ui ", ui.getClass().getName().endsWith(
+                    "BasicButtonUI"));
         } finally {
             UIManager.setLookAndFeel(laf);
         }
@@ -441,12 +437,11 @@
                 frame.dispose();
             }
         });
-
     }
 
+    @SuppressWarnings("deprecation")
     public void testAddNotify() throws Exception {
         PropertyChangeController listener = new PropertyChangeController();
-
         JButton panel1 = new JButton();
         JPanel panel2 = new JPanel();
         JPanel panel3 = new JPanel();
@@ -457,19 +452,16 @@
         window.show();
         waitForIdle();
         SwingWaitTestCase.requestFocusInWindowForComponent(panel2);
-
         panel2.add(panel1);
-
         listener.checkPropertyFired(panel1, "ancestor", null, panel2);
         listener.reset();
-
         panel3.add(panel1);
         listener.checkPropertyFired(panel1, "ancestor", null, panel3);
     }
 
+    @SuppressWarnings("deprecation")
     public void testRemoveNotify() throws Exception {
         PropertyChangeController listener = new PropertyChangeController();
-
         JPanel panel1 = new JPanel();
         JPanel panel2 = new JPanel();
         JPanel panel3 = new JPanel();
@@ -480,12 +472,9 @@
         window.show();
         waitForIdle();
         SwingWaitTestCase.requestFocusInWindowForComponent(panel2);
-
         panel2.add(panel1);
-
         listener.checkPropertyFired(panel1, "ancestor", null, panel2);
         listener.reset();
-
         panel3.add(panel1);
         listener.checkPropertyFired(panel1, "ancestor", null, panel3);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDesktopPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDesktopPaneTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDesktopPaneTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDesktopPaneTest.java Sat Nov 25 16:04:10 2006
@@ -18,25 +18,24 @@
  * @author Vadim L. Bogdanov
  * @version $Revision$
  */
-
 package javax.swing;
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyVetoException;
-
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.ComponentUI;
-
 import javax.swing.plaf.basic.BasicDesktopPaneUI;
 
-
 public class JDesktopPaneTest extends SwingTestCase {
     /*
      * This class is used to test protected methods.
      */
     private class TestJDesktopPane extends JDesktopPane {
+        private static final long serialVersionUID = 1L;
+
+        @Override
         public String paramString() {
             return super.paramString();
         }
@@ -66,6 +65,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         desktop = new JDesktopPane();
@@ -74,6 +74,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -83,7 +84,6 @@
      */
     public void testIsOpaque() {
         assertTrue("always returns true", desktop.isOpaque());
-
         desktop.setOpaque(false);
         assertTrue("always returns true", desktop.isOpaque());
     }
@@ -93,7 +93,6 @@
      */
     public void testUpdateUI() {
         desktop.updateUI();
-
         ComponentUI ui1 = desktop.getUI();
         ComponentUI ui2 = UIManager.getUI(desktop);
         // at least names of classes must be the same
@@ -105,11 +104,9 @@
      */
     public void testGetAccessibleContext() {
         AccessibleContext c = desktop.getAccessibleContext();
-
         assertTrue("instanceof AccessibleJDesktopPane",
-                   c instanceof JDesktopPane.AccessibleJDesktopPane);
-        assertTrue("AccessibleRole is ok",
-                c.getAccessibleRole() == AccessibleRole.DESKTOP_PANE);
+                c instanceof JDesktopPane.AccessibleJDesktopPane);
+        assertTrue("AccessibleRole is ok", c.getAccessibleRole() == AccessibleRole.DESKTOP_PANE);
     }
 
     /*
@@ -124,7 +121,6 @@
         desktop = new JDesktopPane();
         assertTrue(desktop.isFocusCycleRoot());
         assertFalse(desktop.isFocusTraversalPolicyProvider());
-
         assertTrue("ui != null", desktop.getUI() != null);
     }
 
@@ -146,12 +142,9 @@
      */
     public void testSetGetSelectedFrame() {
         JInternalFrame f = new JInternalFrame();
-
         assertNull("null by default", desktop.getSelectedFrame());
-
         desktop.setSelectedFrame(f);
         assertTrue("is set", desktop.getSelectedFrame() == f);
-
         desktop.setSelectedFrame(null);
         assertNull("is set to null", desktop.getSelectedFrame());
     }
@@ -164,7 +157,6 @@
         JInternalFrame frame1 = new JInternalFrame("frame1");
         frame1.setVisible(true);
         desktop.add(frame1);
-
         // add iconified frame, layer 1
         JInternalFrame frame2 = new JInternalFrame("frame2");
         frame2.setVisible(true);
@@ -175,7 +167,6 @@
         } catch (PropertyVetoException e) {
             assertFalse("exception", true);
         }
-
         // add some non JInternalFrame component
         JComponent comp = new JPanel();
         desktop.add(comp);
@@ -187,9 +178,7 @@
     public void testGetAllFrames() {
         JInternalFrame[] frames = desktop.getAllFrames();
         assertTrue("empty array", frames.length == 0);
-
         addComponents();
-
         frames = desktop.getAllFrames();
         assertTrue("2 frames", frames.length == 2);
     }
@@ -200,23 +189,18 @@
     public void testGetAllFramesInLayer() {
         JInternalFrame[] frames; // = desktop.getAllFramesInLayer(1);
         //assertTrue("empty array", frames.length == 0);
-
         addComponents();
-
         frames = desktop.getAllFramesInLayer(0);
         assertTrue("1 frame", frames.length == 1);
         assertTrue("frame1", frames[0].getTitle() == "frame1");
-
         // invisible frames are counted
         frames[0].setVisible(false);
         frames = desktop.getAllFramesInLayer(0);
         assertTrue("1 frame", frames.length == 1);
-
         // iconified frames are counted
         frames = desktop.getAllFramesInLayer(1);
         assertTrue("1 frame", frames.length == 1);
         assertTrue("frame2", frames[0].getTitle() == "frame2");
-
         // no frames in this layer
         frames = desktop.getAllFramesInLayer(2);
         assertTrue("empty array", frames.length == 0);
@@ -230,14 +214,11 @@
     public void testSetGetDesktopManager() {
         MyPropertyChangeListener l = new MyPropertyChangeListener();
         DesktopManager m = new DefaultDesktopManager();
-
         assertTrue("not null by default", desktop.getDesktopManager() != null);
-
         desktop.addPropertyChangeListener("desktopManager", l);
         desktop.setDesktopManager(m);
         assertTrue("is set", desktop.getDesktopManager() == m);
         assertTrue("bound property", l.ok);
-
         desktop.setDesktopManager(null);
         assertTrue("is not set to null", desktop.getDesktopManager() != null);
     }
@@ -255,12 +236,9 @@
      *     int getDragMode()
      */
     public void testSetGetDragMode() {
-        assertTrue("initial ok",
-                   desktop.getDragMode() == JDesktopPane.LIVE_DRAG_MODE);
-
+        assertTrue("initial ok", desktop.getDragMode() == JDesktopPane.LIVE_DRAG_MODE);
         desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
         assertTrue("set", desktop.getDragMode() == JDesktopPane.OUTLINE_DRAG_MODE);
-
         desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
         assertTrue("set", desktop.getDragMode() == JDesktopPane.LIVE_DRAG_MODE);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDialogTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDialogTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDialogTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JDialogTest.java Sat Nov 25 16:04:10 2006
@@ -14,12 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Vadim L. Bogdanov
  * @version $Revision$
  */
-
 package javax.swing;
 
 import java.awt.BorderLayout;
@@ -31,12 +29,9 @@
 import java.awt.IllegalComponentStateException;
 import java.awt.KeyboardFocusManager;
 import java.awt.LayoutManager;
-
 import java.awt.event.WindowEvent;
-
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleState;
@@ -46,15 +41,21 @@
      * This class is used to test that some methods were called.
      */
     private static class TestDialog extends JDialog {
+        private static final long serialVersionUID = 1L;
+
         public static boolean createRootPaneCalled = false;
+
         public static boolean setRootPaneCalled = false;
+
         public boolean disposeCalled = false;
 
+        @Override
         public JRootPane createRootPane() {
             createRootPaneCalled = true;
             return super.createRootPane();
         }
 
+        @Override
         public void setRootPane(final JRootPane root) {
             setRootPaneCalled = true;
             super.setRootPane(root);
@@ -65,6 +66,7 @@
             setRootPaneCalled = false;
         }
 
+        @Override
         public void dispose() {
             disposeCalled = true;
             super.dispose();
@@ -98,6 +100,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         dialog = new JDialog();
@@ -107,6 +110,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         if (dialog.isDisplayable()) {
@@ -117,11 +121,11 @@
     /*
      * Auxiliary method to check JDialog correctness after constructor's call.
      */
-    protected void checkDialogCorrectness(final JDialog dialog, final String title, final boolean modal) {
+    protected void checkDialogCorrectness(final JDialog dialog, final String title,
+            final boolean modal) {
         assertFalse("JDialog is invisible by default", dialog.isVisible());
         assertTrue("locale is set", dialog.getLocale() == JComponent.getDefaultLocale());
         assertTrue("owner is not null", dialog.getOwner() != null);
-
         assertTrue("isModal is set", dialog.isModal() == modal);
         assertTrue("title is set", dialog.getTitle() == title);
     }
@@ -131,7 +135,6 @@
      */
     public void testJDialog() {
         dialog = new JDialog();
-
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, false);
     }
@@ -141,39 +144,30 @@
      */
     public void testDialogInit() {
         TestDialog dialog = new TestDialog();
-
         assertTrue("onwer is not null", dialog.getOwner() != null);
-
         assertTrue("rootPaneCheckingEnabled is true", dialog.isRootPaneCheckingEnabled());
-
         assertTrue("layout is not null", dialog.getLayout() != null);
-
         assertTrue("rootPane is not null", dialog.getRootPane() != null);
-
         assertTrue("locale is set", dialog.getLocale() == JComponent.getDefaultLocale());
-
-        assertFalse("defaultLookAndFeelDecorated is false", JDialog.isDefaultLookAndFeelDecorated());
+        assertFalse("defaultLookAndFeelDecorated is false", JDialog
+                .isDefaultLookAndFeelDecorated());
         assertFalse("isUndecorated is false", dialog.isUndecorated());
-        assertTrue("rootPane.windowDecorationStyle is NONE",
-                dialog.getRootPane().getWindowDecorationStyle() == JRootPane.NONE);
-
+        assertTrue("rootPane.windowDecorationStyle is NONE", dialog.getRootPane()
+                .getWindowDecorationStyle() == JRootPane.NONE);
         // test that defaultFocusTraversalPolicy is set
         //dialog.setFocusTraversalPolicy(null);
         //dialog.dialogInit();
         assertTrue("focusTraversalPolicy is set correctly",
-                dialog.getFocusTraversalPolicy() == KeyboardFocusManager.
-                    getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy());
-        assertTrue("focusTraversalPolicy is set",
-                   dialog.isFocusTraversalPolicySet());
+                dialog.getFocusTraversalPolicy() == KeyboardFocusManager
+                        .getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy());
+        assertTrue("focusTraversalPolicy is set", dialog.isFocusTraversalPolicySet());
         assertTrue(dialog.isFocusCycleRoot());
         assertFalse(dialog.isFocusTraversalPolicyProvider());
-
         JDialog.setDefaultLookAndFeelDecorated(true);
         dialog.dialogInit();
         assertTrue("isUndecorated is true", dialog.isUndecorated());
-        assertTrue("rootPane.windowDecorationStyle is PLAIN_DIALOG",
-                dialog.getRootPane().getWindowDecorationStyle() == JRootPane.PLAIN_DIALOG);
-
+        assertTrue("rootPane.windowDecorationStyle is PLAIN_DIALOG", dialog.getRootPane()
+                .getWindowDecorationStyle() == JRootPane.PLAIN_DIALOG);
         // restore default value
         JDialog.setDefaultLookAndFeelDecorated(false);
     }
@@ -185,16 +179,14 @@
      */
     public void testSetGetDefaultCloseOperation() {
         // default value is JDialog.HIDE_ON_CLOSE
-        assertEquals(JDialog.HIDE_ON_CLOSE, dialog.getDefaultCloseOperation());
-
+        assertEquals(WindowConstants.HIDE_ON_CLOSE, dialog.getDefaultCloseOperation());
         // test setting valid value
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         dialog.addPropertyChangeListener("defaultCloseOperation", listener);
-        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-        assertEquals(JDialog.DISPOSE_ON_CLOSE, dialog.getDefaultCloseOperation());
+        dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        assertEquals(WindowConstants.DISPOSE_ON_CLOSE, dialog.getDefaultCloseOperation());
         // it is not a bound property
         assertFalse("defaultCloseOperation is a bound property", listener.ok);
-
         // test setting invalid value
         boolean ok = false;
         try {
@@ -214,13 +206,11 @@
      *     static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
      *     static boolean isDefaultLookAndFeelDecorated()
      */
-     public void testSetIsDefaultLookAndFeelDecorated() {
+    public void testSetIsDefaultLookAndFeelDecorated() {
         // test for default value
         assertFalse(JDialog.isDefaultLookAndFeelDecorated());
-
         JDialog.setDefaultLookAndFeelDecorated(true);
         assertTrue(JDialog.isDefaultLookAndFeelDecorated());
-
         // restore default value
         JDialog.setDefaultLookAndFeelDecorated(false);
     }
@@ -232,11 +222,11 @@
      */
     public void testSetIsRootPaneCheckingEnabled() {
         TestDialog dialog = new TestDialog();
-
-        assertTrue("rootPaneCheckingEnabled is true by default", dialog.isRootPaneCheckingEnabled());
-
+        assertTrue("rootPaneCheckingEnabled is true by default", dialog
+                .isRootPaneCheckingEnabled());
         dialog.setRootPaneCheckingEnabled(false);
-        assertFalse("rootPaneCheckingEnabled is set to false", dialog.isRootPaneCheckingEnabled());
+        assertFalse("rootPaneCheckingEnabled is set to false", dialog
+                .isRootPaneCheckingEnabled());
     }
 
     /*
@@ -244,32 +234,28 @@
      */
     public void testJDialogFrameStringbooleanGraphicsConfiguration() {
         Frame owner = new Frame();
-        final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
-                getDefaultScreenDevice().getDefaultConfiguration();
-
+        final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice().getDefaultConfiguration();
         // test with corrent owner, correct title, modal == false, correct gc
         dialog = new JDialog(owner, "Test JDialog", false, gc);
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
         assertTrue("gc is set", dialog.getGraphicsConfiguration() == gc);
-
         // test with corrent owner, correct title, modal == false, incorrect gc
         dialog = new JDialog(owner, "Test JDialog", false, null);
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-        assertTrue("gc is set from the owner",
-                dialog.getGraphicsConfiguration() == dialog.getOwner().getGraphicsConfiguration());
-
+        assertTrue("gc is set from the owner", dialog.getGraphicsConfiguration() == dialog
+                .getOwner().getGraphicsConfiguration());
         // test with null owner, correct title, modal == false, incorrect gc
-        dialog = new JDialog((Frame)null, "Test JDialog", false, null);
+        dialog = new JDialog((Frame) null, "Test JDialog", false, null);
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() != null);
         // this case is not described in docs, but gc definitely can't be null
-        assertTrue("gc is set",
-                dialog.getGraphicsConfiguration() != null);
+        assertTrue("gc is set", dialog.getGraphicsConfiguration() != null);
     }
 
     /*
@@ -277,23 +263,21 @@
      */
     public void testJDialogDialogStringbooleanGraphicsConfiguration() {
         Dialog owner = new Dialog(new Frame());
-        final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
-                getDefaultScreenDevice().getDefaultConfiguration();
-
+        final GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice().getDefaultConfiguration();
         // test with corrent owner, correct title, modal == true, correct gc
         dialog = new JDialog(owner, "Test JDialog", true, gc);
         // title is set, isModal() == true
         checkDialogCorrectness(dialog, "Test JDialog", true);
         assertTrue("owner is set", dialog.getOwner() == owner);
         assertTrue("gc is set", dialog.getGraphicsConfiguration() == gc);
-
         // test with corrent owner, correct title, modal == false, incorrect gc
         dialog = new JDialog(owner, "Test JDialog", false, null);
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-        assertTrue("gc is set from the owner",
-                dialog.getGraphicsConfiguration() == dialog.getOwner().getGraphicsConfiguration());
+        assertTrue("gc is set from the owner", dialog.getGraphicsConfiguration() == dialog
+                .getOwner().getGraphicsConfiguration());
     }
 
     /*
@@ -301,27 +285,23 @@
      */
     public void testJDialogFrameStringboolean() {
         Frame owner = new Frame();
-
         // test with corrent owner, correct title, modal == false
         dialog = new JDialog(owner, "Test JDialog", false);
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, correct title, modal == true
         dialog = new JDialog(owner, "Test JDialog", true);
         // title is set, isModal() == true
         checkDialogCorrectness(dialog, "Test JDialog", true);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, incorrect title, modal == true
         dialog = new JDialog(owner, null, true);
         // title is not set, isModal() == true
         checkDialogCorrectness(dialog, null, true);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with incorrent owner, correct title, modal == true
-        dialog = new JDialog((Frame)null, "Test JDialog", true);
+        dialog = new JDialog((Frame) null, "Test JDialog", true);
         checkDialogCorrectness(dialog, "Test JDialog", true);
     }
 
@@ -330,21 +310,18 @@
      */
     public void testJDialogFrameString() {
         Frame owner = new Frame();
-
         // test with corrent owner, correct title
         dialog = new JDialog(owner, "Test JDialog");
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, incorrect title
         dialog = new JDialog(owner, null);
         // title is not set, isModal() == false
         checkDialogCorrectness(dialog, null, false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with incorrent owner, correct title
-        dialog = new JDialog((Frame)null, "Test JDialog");
+        dialog = new JDialog((Frame) null, "Test JDialog");
         checkDialogCorrectness(dialog, "Test JDialog", false);
     }
 
@@ -353,25 +330,21 @@
      */
     public void testJDialogDialogStringboolean() {
         Dialog owner = new Dialog(new Frame());
-
         // test with corrent owner, correct title, modal == false
         dialog = new JDialog(owner, "Test JDialog", false);
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, correct title, modal == true
         dialog = new JDialog(owner, "Test JDialog", true);
         // title not set, isModal() == true
         checkDialogCorrectness(dialog, "Test JDialog", true);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, incorrect title, modal == true
         dialog = new JDialog(owner, null, true);
         // title is not set, isModal() == true
         checkDialogCorrectness(dialog, null, true);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // owner cannot be null in this case
     }
 
@@ -380,19 +353,16 @@
      */
     public void testJDialogDialogString() {
         Dialog owner = new Dialog(new Frame());
-
         // test with corrent owner, correct title
         dialog = new JDialog(owner, "Test JDialog");
         // title is set, isModal() == false
         checkDialogCorrectness(dialog, "Test JDialog", false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, incorrect title
         dialog = new JDialog(owner, null);
         // title is not set, isModal() == false
         checkDialogCorrectness(dialog, null, false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // owner cannot be null in this case
     }
 
@@ -401,21 +371,18 @@
      */
     public void testJDialogFrameboolean() {
         Frame owner = new Frame();
-
         // test with corrent owner, modal == false
         dialog = new JDialog(owner, false);
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, modal == true
         dialog = new JDialog(owner, true);
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, true);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with incorrect owner
-        dialog = new JDialog((Frame)null, true);
+        dialog = new JDialog((Frame) null, true);
         // title == null, isModal() == true
         checkDialogCorrectness(dialog, null, true);
     }
@@ -425,15 +392,13 @@
      */
     public void testJDialogFrame() {
         Frame owner = new Frame();
-
         // test with corrent owner
         dialog = new JDialog(owner);
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with incorrect owner
-        dialog = new JDialog((Frame)null);
+        dialog = new JDialog((Frame) null);
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, false);
     }
@@ -443,19 +408,16 @@
      */
     public void testJDialogDialogboolean() {
         Dialog owner = new Dialog(new Frame());
-
         // test with corrent owner, modal == false
         dialog = new JDialog(owner, false);
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // test with corrent owner, modal == true
         dialog = new JDialog(owner, true);
         // title == null, isModal() == true
         checkDialogCorrectness(dialog, null, true);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // owner cannot be null in this case
     }
 
@@ -464,13 +426,11 @@
      */
     public void testJDialogDialog() {
         Dialog owner = new Dialog(new Frame());
-
         // test with corrent owner
         dialog = new JDialog(owner);
         // title == null, isModal() == false
         checkDialogCorrectness(dialog, null, false);
         assertTrue("owner is set", dialog.getOwner() == owner);
-
         // owner cannot be null in this case
     }
 
@@ -480,7 +440,6 @@
     public void testAddImpl() {
         TestDialog dialog = new TestDialog();
         JComponent comp = new JPanel();
-
         // rootPaneCheckingEnabled is true, no exception since 1.5
         dialog.setRootPaneCheckingEnabled(true);
         boolean ok = false;
@@ -490,10 +449,9 @@
             ok = true;
         } finally {
             assertFalse("no exception", ok);
-            assertTrue("The component is added to contentPane",
-                       comp.getParent() == dialog.getContentPane());
+            assertTrue("The component is added to contentPane", comp.getParent() == dialog
+                    .getContentPane());
         }
-
         // rootPaneCheckingEnabled is false, no exception
         dialog.setRootPaneCheckingEnabled(false);
         ok = false;
@@ -503,10 +461,8 @@
             ok = true;
         } finally {
             assertFalse("no exception", ok);
-            assertTrue("the component is added to JWindow",
-                       comp.getParent() == dialog);
-            assertTrue("index of the component is 0",
-                       dialog.getComponent(0) == comp);
+            assertTrue("the component is added to JWindow", comp.getParent() == dialog);
+            assertTrue("index of the component is 0", dialog.getComponent(0) == comp);
         }
     }
 
@@ -517,16 +473,13 @@
      */
     public void testSetGetRootPane() {
         TestDialog dialog = new TestDialog();
-        assertTrue("setRootPane() is called from the constructor",
-                TestDialog.setRootPaneCalled);
-
+        assertTrue("setRootPane() is called from the constructor", TestDialog.setRootPaneCalled);
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         dialog.addPropertyChangeListener("rootPane", listener);
         JRootPane root = new JRootPane();
         dialog.setRootPane(root);
         assertTrue(dialog.getRootPane() == root);
         assertFalse("rootPane is not a bound property", listener.ok);
-
         // test setting rootPane to null
         dialog.setRootPane(null);
         assertNull(dialog.getRootPane());
@@ -540,7 +493,6 @@
         TestDialog dialog = new TestDialog();
         assertTrue("createRootPane() is called from the constructor",
                 TestDialog.createRootPaneCalled);
-
         JRootPane root = dialog.createRootPane();
         assertTrue("createRootPane() cannot return null", root != null);
     }
@@ -552,11 +504,9 @@
      */
     public void testSetGetJMenuBarJMenuBar() {
         assertNull(dialog.getJMenuBar());
-
         JMenuBar menuBar = new JMenuBar();
         dialog.setJMenuBar(menuBar);
         assertTrue(dialog.getJMenuBar() == menuBar);
-
         dialog.setJMenuBar(null);
         assertNull(dialog.getJMenuBar());
     }
@@ -569,12 +519,10 @@
     public void testSetGetLayeredPane() {
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         dialog.addPropertyChangeListener("layeredPane", listener);
-
         JLayeredPane pane = new JLayeredPane();
         dialog.setLayeredPane(pane);
         assertTrue(dialog.getLayeredPane() == pane);
         assertFalse("layeredPane is not a bound property", listener.ok);
-
         // test throwing exception if the parameter is null
         boolean ok = false;
         try {
@@ -586,7 +534,6 @@
         }
         // layeredPane cannot be null, even after setLayeredPane(null)
         assertTrue(dialog.getLayeredPane() != null);
-
         // setLayeredPane() method is not called by the constructor
         // (seems that there is an error in docs)
     }
@@ -596,24 +543,17 @@
      */
     public void testGetAccessibleContext() {
         AccessibleContext c = dialog.getAccessibleContext();
-
         assertTrue("class is ok", c instanceof JDialog.AccessibleJDialog);
-        assertTrue("AccessibleRole is ok",
-                c.getAccessibleRole() == AccessibleRole.DIALOG);
-        assertNull("AccessibleDescription is ok",
-                c.getAccessibleDescription());
-        assertTrue("AccessibleChildrenCount == 1",
-                   c.getAccessibleChildrenCount() == 1);
-
+        assertTrue("AccessibleRole is ok", c.getAccessibleRole() == AccessibleRole.DIALOG);
+        assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
+        assertTrue("AccessibleChildrenCount == 1", c.getAccessibleChildrenCount() == 1);
         // test getAccessibleName()
         assertNull("AccessibleName is ok", c.getAccessibleName());
         dialog.setTitle("aa");
         assertTrue("AccessibleName is ok", c.getAccessibleName() == "aa");
-
         // test getAccessibleStateSet()
         AccessibleState[] states = c.getAccessibleStateSet().toArray();
         assertTrue("more than 2 states", states.length > 2);
-
         dialog.setVisible(true);
         states = c.getAccessibleStateSet().toArray();
         assertTrue("more than 4 states", states.length > 4);
@@ -634,23 +574,20 @@
         TestDialog dialog = new TestDialog();
         dialog.setVisible(true);
         WindowEvent e = new WindowEvent(dialog, WindowEvent.WINDOW_CLOSING);
-
         // test DO_NOTHING_ON_CLOSE
-        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
+        dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
         dialog.disposeCalled = false;
         dialog.processWindowEvent(e);
         assertFalse("didn't call dispose()", dialog.disposeCalled);
         assertTrue("is visible", dialog.isVisible());
-
         // test HIDE_ON_CLOSE
-        dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+        dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
         dialog.disposeCalled = false;
         dialog.processWindowEvent(e);
         assertFalse("didn't call dispose()", dialog.disposeCalled);
         assertFalse("is not visible", dialog.isVisible());
-
         // test DISPOSE_ON_CLOSE
-        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+        dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         dialog.disposeCalled = false;
         dialog.setVisible(true);
         dialog.processWindowEvent(e);
@@ -665,7 +602,6 @@
         TestDialog dialog = new TestDialog();
         LayoutManager contentLayout = dialog.getContentPane().getLayout();
         LayoutManager dialogLayout = dialog.getLayout();
-
         // rootPaneCheckingEnabled is true, no exception since 1.5
         dialog.setRootPaneCheckingEnabled(true);
         boolean ok = false;
@@ -676,12 +612,10 @@
         } finally {
             assertFalse("no exception since 1.5", ok);
             assertTrue("contentPane layout is changed",
-                       dialog.getContentPane().getLayout() != contentLayout);
-            assertTrue("Dialog layout shouldn't be changed",
-                       dialog.getLayout() == dialogLayout);
+                    dialog.getContentPane().getLayout() != contentLayout);
+            assertTrue("Dialog layout shouldn't be changed", dialog.getLayout() == dialogLayout);
             dialog.getContentPane().setLayout(contentLayout);
         }
-
         // rootPaneCheckingEnabled is false
         dialog.setRootPaneCheckingEnabled(false);
         ok = false;
@@ -691,10 +625,9 @@
             ok = true;
         } finally {
             assertFalse("no exception", ok);
-            assertTrue("contentPane layout shouldn't be changed",
-                       dialog.getContentPane().getLayout() == contentLayout);
-            assertTrue("Dialog layout is changed",
-                       dialog.getLayout() != dialogLayout);
+            assertTrue("contentPane layout shouldn't be changed", dialog.getContentPane()
+                    .getLayout() == contentLayout);
+            assertTrue("Dialog layout is changed", dialog.getLayout() != dialogLayout);
         }
     }
 
@@ -713,12 +646,10 @@
     public void testSetGetContentPane() {
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         dialog.addPropertyChangeListener("contentPane", listener);
-
         JPanel pane = new JPanel();
         dialog.setContentPane(pane);
         assertTrue(dialog.getContentPane() == pane);
         assertFalse("contentPane is not a bound property", listener.ok);
-
         // test throwing exception if the parameter is null
         boolean ok = false;
         try {
@@ -730,12 +661,10 @@
         }
         // contentPane cannot be null, even after setContentPane(null)
         assertTrue(dialog.getContentPane() != null);
-
         // setContentPane() method is not called by the constructor
         // (seems that there is an error in docs)
     }
 
-
     /*
      * Class under test for
      *     void setGlassPane(Component)
@@ -744,12 +673,10 @@
     public void testSetGetGlassPane() {
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         dialog.addPropertyChangeListener("glassPane", listener);
-
         JPanel pane = new JPanel();
         dialog.setGlassPane(pane);
         assertTrue(dialog.getGlassPane() == pane);
         assertFalse("glassPane is not a bound property", listener.ok);
-
         // test throwing exception if the parameter is null
         boolean ok = false;
         try {
@@ -761,7 +688,6 @@
         }
         // glassPane cannot be null, even after setGlassPane(null)
         assertTrue(dialog.getGlassPane() != null);
-
         // setGlassPane() method is not called by the constructor
         // (seems that there is an error in docs)
     }
@@ -775,28 +701,24 @@
         assertTrue("added to contentPane", dialog.isAncestorOf(comp));
         dialog.remove(comp);
         assertFalse("removed from contentPane", dialog.isAncestorOf(comp));
-
-        ((JPanel)dialog.getGlassPane()).add(comp);
+        ((JPanel) dialog.getGlassPane()).add(comp);
         dialog.remove(comp);
         assertTrue("not removed from glassPane", dialog.isAncestorOf(comp));
-
         // test removing directly from the container
         dialog.setRootPaneCheckingEnabled(false);
         dialog.add(comp, BorderLayout.EAST);
         assertTrue("added", comp.getParent() == dialog);
         dialog.remove(comp);
         assertTrue("not removed", comp.getParent() == dialog);
-
         // test removing null
-//        boolean ok = false;
-//        try {
-//            dialog.remove((Component)null);
-//        } catch (NullPointerException e) {
-//            ok = true;
-//        } finally {
-//            assertTrue("exception", ok);
-//        }
-
+        //        boolean ok = false;
+        //        try {
+        //            dialog.remove((Component)null);
+        //        } catch (NullPointerException e) {
+        //            ok = true;
+        //        } finally {
+        //            assertTrue("exception", ok);
+        //        }
         // test removing rootPane
         assertTrue(dialog.isAncestorOf(dialog.getRootPane()));
         dialog.remove(dialog.getRootPane());

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JEditorPaneRTest.java Sat Nov 25 16:04:10 2006
@@ -20,9 +20,7 @@
  */
 package javax.swing;
 
-import javax.swing.SwingTestCase;
 import javax.swing.plaf.metal.MetalIconFactory;
-import javax.swing.text.AbstractDocument;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.EditorKit;
 import javax.swing.text.MutableAttributeSet;
@@ -30,52 +28,57 @@
 import javax.swing.text.StyleConstants;
 import javax.swing.text.StyledDocument;
 import javax.swing.text.StyledEditorKit;
+
 public class JEditorPaneRTest extends SwingTestCase {
     public void testPlainViewFactory() {
         JEditorPane jp = new JEditorPane();
-        String name = jp.getUI().getRootView(jp).getView(0).getClass()
-            .getName();
+        String name = jp.getUI().getRootView(jp).getView(0).getClass().getName();
         assertEquals("javax.swing.text.WrappedPlainView", name);
     }
 
     public void testCreateDefaultEditorKit() {
-        JEditorPane  pane  = new JEditorPane() {
-          protected EditorKit createDefaultEditorKit() {
-              return new StyledEditorKit();
-          }
-        };
+        JEditorPane pane = new JEditorPane() {
+            private static final long serialVersionUID = 1L;
 
+            @Override
+            protected EditorKit createDefaultEditorKit() {
+                return new StyledEditorKit();
+            }
+        };
         assertTrue(pane.getEditorKit() instanceof StyledEditorKit);
     }
 
     public boolean wasInstallCall;
 
     public void testCreateDefaultEditorKit_installCall() {
-        JEditorPane  pane  = new JEditorPane() {
+        JEditorPane pane = new JEditorPane() {
+            private static final long serialVersionUID = 1L;
         };
         pane.setEditorKit(new StyledEditorKit() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             public void install(JEditorPane component) {
                 wasInstallCall = true;
                 super.install(component);
             }
-          });
-
+        });
         assertTrue(wasInstallCall);
     }
 
     public void testInputAttributes() {
-        JEditorPane pane  = new JEditorPane() {
+        JEditorPane pane = new JEditorPane() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             protected EditorKit createDefaultEditorKit() {
-                    return new StyledEditorKit();
+                return new StyledEditorKit();
             }
         };
         pane.setEditorKit(new StyledEditorKit());
-
         StyledDocument doc = (StyledDocument) pane.getDocument();
         StyledEditorKit kit = (StyledEditorKit) pane.getEditorKit();
-
         try {
-
             MutableAttributeSet attrs = new SimpleAttributeSet();
             StyleConstants.setUnderline(attrs, true);
             doc.insertString(0, "Hello word!", attrs);
@@ -83,13 +86,11 @@
             attrs = new SimpleAttributeSet();
             StyleConstants.setIcon(attrs, MetalIconFactory.getTreeFolderIcon());
             doc.insertString(4, " ", attrs);
-
             pane.setCaretPosition(4);
             doc.insertString(4, "\n", kit.getInputAttributes());
             assertFalse(StyleConstants.isUnderline(kit.getInputAttributes()));
             pane.setCaretPosition(5);
             assertFalse(StyleConstants.isUnderline(kit.getInputAttributes()));
-
         } catch (BadLocationException e) {
         }
     }



Mime
View raw message