harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [13/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/JInternalFrameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrameTest.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,19 +29,15 @@
 import java.awt.LayoutManager;
 import java.awt.Point;
 import java.awt.Rectangle;
-
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyVetoException;
 import java.beans.VetoableChangeListener;
-
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleValue;
-
 import javax.swing.event.InternalFrameEvent;
 import javax.swing.event.InternalFrameListener;
-
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicInternalFrameUI;
 
@@ -54,7 +48,9 @@
      */
     static private class TestInternalFrame extends JInternalFrame {
         public static boolean createRootPaneCalled = false;
+
         public static boolean setRootPaneCalled = false;
+
         public static boolean disposeCalled = false;
 
         @Override
@@ -93,8 +89,9 @@
         }
 
         public void vetoableChange(final PropertyChangeEvent evt) throws PropertyVetoException {
-            if (evt.getPropertyName() == name)
+            if (evt.getPropertyName() == name) {
                 throw new PropertyVetoException("", evt);
+            }
         }
     }
 
@@ -102,11 +99,17 @@
         public int state;
 
         private static final int opened = 1;
+
         private static final int closing = 2;
+
         private static final int closed = 4;
+
         private static final int iconified = 8;
+
         private static final int deiconified = 16;
+
         private static final int activated = 32;
+
         private static final int deactivated = 64;
 
         MyInternalFrameListener() {
@@ -116,21 +119,27 @@
         public void internalFrameOpened(final InternalFrameEvent e) {
             state |= opened;
         }
+
         public void internalFrameClosing(final InternalFrameEvent e) {
             state |= closing;
         }
+
         public void internalFrameClosed(final InternalFrameEvent e) {
             state |= closed;
         }
+
         public void internalFrameIconified(final InternalFrameEvent e) {
             state |= iconified;
         }
+
         public void internalFrameDeiconified(final InternalFrameEvent e) {
             state |= deiconified;
         }
+
         public void internalFrameActivated(final InternalFrameEvent e) {
             state |= activated;
         }
+
         public void internalFrameDeactivated(final InternalFrameEvent e) {
             state |= deactivated;
         }
@@ -138,21 +147,27 @@
         public boolean openedFired() {
             return (state & opened) != 0;
         }
+
         public boolean closingFired() {
             return (state & closing) != 0;
         }
+
         public boolean closedFired() {
             return (state & closed) != 0;
         }
+
         public boolean iconifiedFired() {
             return (state & iconified) != 0;
         }
+
         public boolean deiconifiedFired() {
             return (state & deiconified) != 0;
         }
+
         public boolean activatedFired() {
             return (state & activated) != 0;
         }
+
         public boolean deactivatedFired() {
             return (state & deactivated) != 0;
         }
@@ -217,12 +232,10 @@
         final Point location = new Point(20, 21);
         final int width = 22;
         final int height = 23;
-
         frame.setBounds(location.x, location.y, width, height);
         assertTrue("location is set", frame.getLocation().equals(location));
         assertTrue("width is set", frame.getWidth() == width);
         assertTrue("height is set", frame.getHeight() == height);
-
         // Note: could test that the component was re-layouted
     }
 
@@ -231,42 +244,35 @@
      */
     public void testUpdateUI() {
         frame.updateUI();
-
         ComponentUI ui1 = frame.getUI();
         ComponentUI ui2 = UIManager.getUI(frame);
         // at least names of classes must be the same
         assertEquals(ui2.getClass().getName(), ui1.getClass().getName());
-   }
+    }
 
     /*
      * Checks correctness of the internal frame after constructor.
      */
-    protected void checkJInternalFrameCorrectness(
-        final String title, final boolean resizable, final boolean closable,
-        final boolean maximizable, final boolean iconifiable) {
+    protected void checkJInternalFrameCorrectness(final String title, final boolean resizable,
+            final boolean closable, final boolean maximizable, final boolean iconifiable) {
         assertTrue("title is set", frame.getTitle() == title);
         assertTrue("resizable is set", frame.isResizable() == resizable);
         assertTrue("closable is set", frame.isClosable() == closable);
         assertTrue("maximizable is set", frame.isMaximizable() == maximizable);
         assertTrue("iconifiable is set", frame.isIconifiable() == iconifiable);
-
         assertFalse("is visible by default", frame.isVisible());
         assertTrue("rootPane != null", frame.getRootPane() != null);
         assertTrue("locale is set", frame.getLocale() == JComponent.getDefaultLocale());
         assertTrue("", frame.getRootPane().getWindowDecorationStyle() == JRootPane.NONE);
         assertTrue("", frame.getBackground() == frame.getContentPane().getBackground());
         assertTrue("ui != null", frame.getUI() != null);
-
         assertTrue("is focus cycle root", frame.isFocusCycleRoot());
-
         assertTrue("glassPane is visible", frame.getGlassPane().isVisible());
-
         // test that defaultFocusTraversalPolicy is set
-        assertTrue("focusTraversalPolicy is set",
-                   frame.isFocusTraversalPolicySet());
+        assertTrue("focusTraversalPolicy is set", frame.isFocusTraversalPolicySet());
         assertTrue("focusTraversalPolicy is set correctly",
-                frame.getFocusTraversalPolicy() == KeyboardFocusManager.
-                    getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy());
+                frame.getFocusTraversalPolicy() == KeyboardFocusManager
+                        .getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy());
         assertTrue(frame.isFocusCycleRoot());
         assertFalse(frame.isFocusTraversalPolicyProvider());
     }
@@ -287,28 +293,25 @@
         MyInternalFrameListener listener = new MyInternalFrameListener();
         frame.addInternalFrameListener(listener);
         frame.setVisible(true);
-
         // test DO_NOTHING_ON_CLOSE operation
         TestInternalFrame.initStaticVars();
         listener.state = 0;
-        frame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
+        frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
         frame.doDefaultCloseAction();
         assertTrue("INTERNAL_FRAME_CLOSING was fired", listener.closingFired());
         assertFalse("dispose() was not called", TestInternalFrame.disposeCalled);
         assertTrue("setVisible(false) was not called", frame.isVisible());
-
         // test DISPOSE_ON_CLOSE operation
         TestInternalFrame.initStaticVars();
         listener.state = 0;
-        frame.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
+        frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         frame.doDefaultCloseAction();
         assertTrue("dispose() was called", TestInternalFrame.disposeCalled);
         assertTrue("INTERNAL_FRAME_CLOSING was fired", listener.closingFired());
-
         // test HIDE_ON_CLOSE operation
         TestInternalFrame.initStaticVars();
         listener.state = 0;
-        frame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
+        frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
         frame.doDefaultCloseAction();
         assertFalse("dispose() was not called", TestInternalFrame.disposeCalled);
         assertFalse("setVisible(false) was called", frame.isVisible());
@@ -326,11 +329,10 @@
         frame.getContentPane().add(comp1, BorderLayout.NORTH);
         frame.getContentPane().add(comp2, BorderLayout.SOUTH);
         frame.getContentPane().add(comp3, BorderLayout.CENTER);
-
         createAndShowRootFrame();
         frame.pack();
-        assertTrue("size is set to preferred size", frame.getRootPane().getSize().
-                   equals(frame.getRootPane().getPreferredSize()));
+        assertTrue("size is set to preferred size", frame.getRootPane().getSize().equals(
+                frame.getRootPane().getPreferredSize()));
     }
 
     /*
@@ -339,17 +341,14 @@
     public void testMoveToBack() {
         // test without JDesktopPane set
         frame.moveToBack();
-
         // test with JDesktopPane set
         JDesktopPane desktop = new JDesktopPane();
         desktop.add(frame);
         desktop.add(new JInternalFrame());
         desktop.add(new JInternalFrame());
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
-
         frame.moveToBack();
         assertTrue("frame index is 2", desktop.getIndexOf(frame) == 2);
-
         // test with different layer
         frame.setLayer(1);
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
@@ -363,7 +362,6 @@
     public void testMoveToFront() {
         // test without JDesktopPane set
         frame.moveToFront();
-
         // test with JDesktopPane set
         //JDesktopPane desktop = new JDesktopPane();
         JLayeredPane desktop = new JLayeredPane();
@@ -371,10 +369,8 @@
         desktop.add(new JInternalFrame());
         desktop.add(frame);
         assertTrue("frame index is 2", desktop.getIndexOf(frame) == 2);
-
         frame.moveToFront();
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
-
         // test with different layer
         frame.setLayer(-1);
         assertTrue("frame index is 2", desktop.getIndexOf(frame) == 2);
@@ -388,17 +384,14 @@
     public void testToBack() {
         // test without JDesktopPane set
         frame.toBack();
-
         // test with JDesktopPane set
         JDesktopPane desktop = new JDesktopPane();
         desktop.add(frame);
         desktop.add(new JInternalFrame());
         desktop.add(new JInternalFrame());
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
-
         frame.toBack();
         assertTrue("frame index is 2", desktop.getIndexOf(frame) == 2);
-
         // test with different layer
         frame.setLayer(1);
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
@@ -412,17 +405,14 @@
     public void testToFront() {
         // test without JDesktopPane set
         frame.toFront();
-
         // test with JDesktopPane set
         JLayeredPane desktop = new JLayeredPane();
         desktop.add(new JInternalFrame());
         desktop.add(new JInternalFrame());
         desktop.add(frame);
         assertTrue("frame index is 2", desktop.getIndexOf(frame) == 2);
-
         frame.toFront();
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
-
         // test with different layer
         frame.setLayer(-1);
         assertTrue("frame index is 2", desktop.getIndexOf(frame) == 2);
@@ -437,37 +427,29 @@
         TestInternalFrame frame = new TestInternalFrame();
         MyInternalFrameListener l = new MyInternalFrameListener();
         frame.addInternalFrameListener(l);
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
         assertTrue("INTERNAL_FRAME_OPENED was fired", l.openedFired());
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING);
         assertTrue("INTERNAL_FRAME_CLOSING was fired", l.closingFired());
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED);
         assertTrue("INTERNAL_FRAME_CLOSED was fired", l.closedFired());
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
         assertTrue("INTERNAL_FRAME_ICONIFIED was fired", l.iconifiedFired());
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
         assertTrue("INTERNAL_FRAME_DEICONIFIED was fired", l.deiconifiedFired());
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED);
         assertTrue("INTERNAL_FRAME_ACTIVATED was fired", l.activatedFired());
-
         l.state = 0;
         frame.fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
         assertTrue("INTERNAL_FRAME_DEACTIVATED was fired", l.deactivatedFired());
-
         l.state = 0;
-        frame.fireInternalFrameEvent(101);  // test invalid value
+        frame.fireInternalFrameEvent(101); // test invalid value
         assertTrue("nothing happens", l.state == 0);
     }
 
@@ -478,16 +460,13 @@
      */
     public void testSetGetDefaultCloseOperation() {
         // default value is JInternalFrame.DISPOSE_ON_CLOSE
-        assertEquals(JInternalFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation());
-
+        assertEquals(WindowConstants.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation());
         // test setting valid value
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener("defaultCloseOperation", listener);
-        frame.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
-        assertEquals(JInternalFrame.DO_NOTHING_ON_CLOSE,
-                     frame.getDefaultCloseOperation());
+        frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+        assertEquals(WindowConstants.DO_NOTHING_ON_CLOSE, frame.getDefaultCloseOperation());
         assertFalse("defaultCloseOperation is not a bound property", listener.ok);
-
         // test setting invalid value
         boolean ok = false;
         try {
@@ -507,16 +486,13 @@
      */
     public void testSetGetLayer() {
         assertTrue("default level is 0", frame.getLayer() == 0);
-
         // test setLayer() without JDesktopPane set
         frame.setLayer(1);
         assertTrue("layer is set", frame.getLayer() == 1);
-
         // tes setLayer with JLayeredPane set
         JLayeredPane desktop = new JLayeredPane();
         desktop.add(frame);
         desktop.add(new JInternalFrame());
-
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
         frame.setLayer(-1);
         assertTrue("frame index is 1", desktop.getIndexOf(frame) == 1);
@@ -533,7 +509,6 @@
         JDesktopPane desktop = new JDesktopPane();
         desktop.add(frame);
         desktop.add(new JInternalFrame());
-
         assertTrue("frame index is 0", desktop.getIndexOf(frame) == 0);
         frame.setLayer(new Integer(-1));
         assertTrue("frame index is 1", desktop.getIndexOf(frame) == 1);
@@ -546,7 +521,6 @@
      */
     public void testSetIsClosable() {
         assertFalse("closable is false by default", frame.isClosable());
-
         frame.setClosable(true);
         assertTrue("closable is set", frame.isClosable());
     }
@@ -564,20 +538,18 @@
         //try {
         //    SwingUtilities.invokeAndWait(new Runnable() {
         //        public void run() {
-                    createAndShowRootFrame();
+        createAndShowRootFrame();
         //        }
         //    });
         //} catch (Exception e) {
         //    assertFalse("exception", true);
         //}
-
         assertFalse("false by default", frame.isClosed());
-
         // test that this is a constrained property
         boolean thrown = false;
         l.ok = false;
         MyVetoableChangeListener vetoableListener = new MyVetoableChangeListener(
-            JInternalFrame.IS_CLOSED_PROPERTY);
+                JInternalFrame.IS_CLOSED_PROPERTY);
         frame.addVetoableChangeListener(vetoableListener);
         try {
             frame.setSelected(true);
@@ -595,7 +567,6 @@
             assertFalse("property change was not fired", l.ok);
             assertTrue("not removed", rootFrame.isAncestorOf(frame));
         }
-
         // test that this a a bound property
         thrown = false;
         l.ok = false;
@@ -615,7 +586,6 @@
             assertTrue("property change was not fired", l.ok);
             assertFalse("removed", rootFrame.isAncestorOf(frame));
         }
-
         // test setting to try second time
         thrown = false;
         l.ok = false;
@@ -644,9 +614,7 @@
         MyInternalFrameListener frameListener = new MyInternalFrameListener();
         frame.addInternalFrameListener(frameListener);
         boolean thrown;
-
         assertFalse("isIcon is false by default", frame.isIcon());
-
         // test correct set to true
         thrown = false;
         frameListener.state = 0;
@@ -658,10 +626,8 @@
             assertFalse("exception is not thrown", thrown);
             assertTrue("isIcon is set", frame.isIcon());
             assertTrue("isIcon is a bound property", listener.ok);
-            assertTrue("INTERNAL_FRAME_ICONIFIED event",
-                       frameListener.iconifiedFired());
+            assertTrue("INTERNAL_FRAME_ICONIFIED event", frameListener.iconifiedFired());
         }
-
         // test correct set to false
         thrown = false;
         frameListener.state = 0;
@@ -672,10 +638,8 @@
         } finally {
             assertFalse("exception is not thrown", thrown);
             assertFalse("isIcon is set", frame.isIcon());
-            assertTrue("INTERNAL_FRAME_DEICONIFIED event",
-                       frameListener.deiconifiedFired());
+            assertTrue("INTERNAL_FRAME_DEICONIFIED event", frameListener.deiconifiedFired());
         }
-
         // test set to false when it is false already
         thrown = false;
         frameListener.state = 0;
@@ -688,12 +652,11 @@
             assertFalse("isIcon is set", frame.isIcon());
             assertTrue("no events", frameListener.state == 0);
         }
-
         // test that this is a constrained property
         thrown = false;
         frameListener.state = 0;
-        frame.addVetoableChangeListener(
-            new MyVetoableChangeListener(JInternalFrame.IS_ICON_PROPERTY));
+        frame.addVetoableChangeListener(new MyVetoableChangeListener(
+                JInternalFrame.IS_ICON_PROPERTY));
         try {
             frame.setIcon(true);
         } catch (PropertyVetoException e) {
@@ -712,7 +675,6 @@
      */
     public void testSetIsIconifiable() {
         assertFalse("iconable is false by default", frame.isIconifiable());
-
         frame.setIconifiable(true);
         assertTrue("iconable is set", frame.isIconifiable());
     }
@@ -724,7 +686,6 @@
      */
     public void testSetIsMaximizable() {
         assertFalse("maximizable is false by default", frame.isMaximizable());
-
         frame.setMaximizable(true);
         assertTrue("maximizable is set", frame.isMaximizable());
     }
@@ -740,9 +701,7 @@
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.IS_MAXIMUM_PROPERTY, listener);
         boolean thrown;
-
         assertFalse("isMaximum is false by default", frame.isMaximum());
-
         // test correct set to true
         thrown = false;
         try {
@@ -754,7 +713,6 @@
             assertTrue("isMaximum is set", frame.isMaximum());
             assertTrue("isMaximum is a bound property", listener.ok);
         }
-
         // test correct set to false
         thrown = false;
         try {
@@ -765,7 +723,6 @@
             assertFalse("exception is not thrown", thrown);
             assertFalse("isMaximum is set", frame.isMaximum());
         }
-
         // test set to false when it is false already
         thrown = false;
         try {
@@ -776,10 +733,10 @@
             assertFalse("exception is not thrown", thrown);
             assertFalse("isMaximum is set", frame.isMaximum());
         }
-
         // test that this is a constrained property
         thrown = false;
-        frame.addVetoableChangeListener(new MyVetoableChangeListener(JInternalFrame.IS_MAXIMUM_PROPERTY));
+        frame.addVetoableChangeListener(new MyVetoableChangeListener(
+                JInternalFrame.IS_MAXIMUM_PROPERTY));
         try {
             frame.setMaximum(true);
         } catch (PropertyVetoException e) {
@@ -797,7 +754,6 @@
      */
     public void testSetIsResizable() {
         assertFalse("resizable is false by default", frame.isResizable());
-
         frame.setResizable(true);
         assertTrue("resizable is set", frame.isResizable());
     }
@@ -809,11 +765,11 @@
      */
     public void testSetIsRootPaneCheckingEnabled() {
         TestInternalFrame frame = new TestInternalFrame();
-
-        assertTrue("rootPaneCheckingEnabled is true by default", frame.isRootPaneCheckingEnabled());
-
+        assertTrue("rootPaneCheckingEnabled is true by default", frame
+                .isRootPaneCheckingEnabled());
         frame.setRootPaneCheckingEnabled(false);
-        assertFalse("rootPaneCheckingEnabled is set to false", frame.isRootPaneCheckingEnabled());
+        assertFalse("rootPaneCheckingEnabled is set to false", frame
+                .isRootPaneCheckingEnabled());
     }
 
     /*
@@ -830,9 +786,7 @@
         MyInternalFrameListener frameListener = new MyInternalFrameListener();
         frame.addInternalFrameListener(frameListener);
         boolean thrown;
-
         assertFalse("isSelected is false by default", frame.isSelected());
-
         // test set to true when the internal frame is invisible
         thrown = false;
         frame.setVisible(false);
@@ -844,7 +798,6 @@
             assertFalse("exception is not thrown", thrown);
             assertFalse("isSelected is not set", frame.isSelected());
         }
-
         // test correct set to true
         thrown = false;
         frame.setVisible(true);
@@ -866,7 +819,6 @@
             assertTrue("event fired", frameListener.activatedFired());
             assertFalse("glassPane is invisible", frame.getGlassPane().isVisible());
         }
-
         // test set to false when the internal frame is invisible
         thrown = false;
         frame.setVisible(false);
@@ -879,7 +831,6 @@
             assertFalse("exception is not thrown", thrown);
             assertFalse("isSelected is set", frame.isSelected());
         }
-
         // test correct set to false
         thrown = false;
         frame.setVisible(true);
@@ -896,7 +847,6 @@
             assertTrue("event fired", frameListener.deactivatedFired());
             assertTrue("glassPane is visible", frame.getGlassPane().isVisible());
         }
-
         // test set to false when it is false already
         thrown = false;
         try {
@@ -907,11 +857,10 @@
             assertFalse("exception is not thrown", thrown);
             assertFalse("isSelected is set", frame.isSelected());
         }
-
         // test that this is a constrained property
         thrown = false;
-        MyVetoableChangeListener vetoableListener =
-                new MyVetoableChangeListener(JInternalFrame.IS_SELECTED_PROPERTY);
+        MyVetoableChangeListener vetoableListener = new MyVetoableChangeListener(
+                JInternalFrame.IS_SELECTED_PROPERTY);
         frame.addVetoableChangeListener(vetoableListener);
         try {
             frame.setSelected(true);
@@ -922,7 +871,6 @@
             assertFalse("isSelected is not set", frame.isSelected());
             frame.removeVetoableChangeListener(vetoableListener);
         }
-
         // test set to true when it is iconified
         thrown = false;
         try {
@@ -942,13 +890,10 @@
      */
     public void testJInternalFrameStringbooleanbooleanbooleanboolean() {
         final String title = "Test title";
-
         frame = new JInternalFrame(title, true, true, true, true);
         checkJInternalFrameCorrectness(title, true, true, true, true);
-
         frame = new JInternalFrame(title, true, true, true, false);
         checkJInternalFrameCorrectness(title, true, true, true, false);
-
         frame = new JInternalFrame(title, true, true, false, true);
         checkJInternalFrameCorrectness(title, true, true, false, true);
     }
@@ -958,13 +903,10 @@
      */
     public void testJInternalFrameStringbooleanbooleanboolean() {
         final String title = "Test title";
-
         frame = new JInternalFrame(title, true, true, true);
         checkJInternalFrameCorrectness(title, true, true, true, false);
-
         frame = new JInternalFrame(title, false, false, true);
         checkJInternalFrameCorrectness(title, false, false, true, false);
-
         frame = new JInternalFrame(title, false, true, false);
         checkJInternalFrameCorrectness(title, false, true, false, false);
     }
@@ -974,13 +916,10 @@
      */
     public void testJInternalFrameStringbooleanboolean() {
         final String title = "Test title";
-
         frame = new JInternalFrame(title, true, true);
         checkJInternalFrameCorrectness(title, true, true, false, false);
-
         frame = new JInternalFrame(title, false, true);
         checkJInternalFrameCorrectness(title, false, true, false, false);
-
         frame = new JInternalFrame(title, true, false);
         checkJInternalFrameCorrectness(title, true, false, false, false);
     }
@@ -990,10 +929,8 @@
      */
     public void testJInternalFrameStringboolean() {
         final String title = "Test title";
-
         frame = new JInternalFrame(title, false);
         checkJInternalFrameCorrectness(title, false, false, false, false);
-
         frame = new JInternalFrame(title, true);
         checkJInternalFrameCorrectness(title, true, false, false, false);
     }
@@ -1003,7 +940,6 @@
      */
     public void testJInternalFrameString() {
         final String title = "Test title";
-
         frame = new JInternalFrame(title);
         checkJInternalFrameCorrectness(title, false, false, false, false);
     }
@@ -1014,7 +950,6 @@
     public void testAddImpl() {
         TestInternalFrame frame = new TestInternalFrame();
         JComponent comp = new JPanel();
-
         // rootPaneCheckingEnabled is true, no exception since 1.5
         frame.setRootPaneCheckingEnabled(true);
         boolean ok = false;
@@ -1024,10 +959,9 @@
             ok = true;
         } finally {
             assertFalse("no exception", ok);
-            assertTrue("The component is added to contentPane",
-                        comp.getParent() == frame.getContentPane());
+            assertTrue("The component is added to contentPane", comp.getParent() == frame
+                    .getContentPane());
         }
-
         // rootPaneCheckingEnabled is false, no exception
         frame.setRootPaneCheckingEnabled(false);
         ok = false;
@@ -1037,8 +971,7 @@
             ok = true;
         } finally {
             assertFalse("no exception", ok);
-            assertTrue("the component is added to the frame",
-                       comp.getParent() == frame);
+            assertTrue("the component is added to the frame", comp.getParent() == frame);
             assertTrue("index of the component is 0", frame.getComponent(0) == comp);
         }
     }
@@ -1059,14 +992,12 @@
      */
     protected boolean contains(final Object[] array, final Object obj) {
         boolean ok = false;
-
         for (int i = 0; i < array.length; i++) {
             if (array[i] == obj) {
                 ok = true;
                 break;
             }
         }
-
         return ok;
     }
 
@@ -1078,14 +1009,10 @@
      */
     public void testAddRemoveGetInternalFrameListener() {
         InternalFrameListener l = new MyInternalFrameListener();
-
         frame.addInternalFrameListener(l);
-
         InternalFrameListener[] listeners = frame.getInternalFrameListeners();
         assertTrue("listener was added", contains(listeners, l));
-
         frame.removeInternalFrameListener(l);
-
         listeners = frame.getInternalFrameListeners();
         assertFalse("listener was removed", contains(listeners, l));
     }
@@ -1099,14 +1026,12 @@
         TestInternalFrame frame = new TestInternalFrame();
         assertTrue("setRootPane() is called from the constructor",
                 TestInternalFrame.setRootPaneCalled);
-
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.ROOT_PANE_PROPERTY, listener);
         JRootPane root = new JRootPane();
         frame.setRootPane(root);
         assertTrue(frame.getRootPane() == root);
         assertTrue("rootPane is a bound property", listener.ok);
-
         // test setting rootPane to null
         frame.setRootPane(null);
         assertNull(frame.getRootPane());
@@ -1120,7 +1045,6 @@
         TestInternalFrame frame = new TestInternalFrame();
         assertTrue("createRootPane() is called from the constructor",
                 TestInternalFrame.createRootPaneCalled);
-
         JRootPane root = frame.createRootPane();
         assertTrue("createRootPane() cannot return null", root != null);
     }
@@ -1130,19 +1054,15 @@
      *     void setMenuBar(JMenuBar)
      *     JMenuBar getMenuBar()
      */
-    /**
-     * @deprecated
-     */
+    @SuppressWarnings("deprecation")
     public void testSetGetMenuBar() {
         assertNull(frame.getMenuBar());
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.MENU_BAR_PROPERTY, listener);
-
         JMenuBar menuBar = new JMenuBar();
         frame.setMenuBar(menuBar);
         assertTrue(frame.getMenuBar() == menuBar);
         assertTrue("menuBar is a bound property", listener.ok);
-
         frame.setMenuBar(null);
         assertNull(frame.getMenuBar());
     }
@@ -1156,12 +1076,10 @@
         assertNull(frame.getJMenuBar());
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.MENU_BAR_PROPERTY, listener);
-
         JMenuBar menuBar = new JMenuBar();
         frame.setJMenuBar(menuBar);
         assertTrue(frame.getJMenuBar() == menuBar);
         assertTrue("menuBar is a bound property", listener.ok);
-
         frame.setJMenuBar(null);
         assertNull(frame.getJMenuBar());
     }
@@ -1174,12 +1092,10 @@
     public void testSetGetLayeredPane() {
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.LAYERED_PANE_PROPERTY, listener);
-
         JLayeredPane pane = new JLayeredPane();
         frame.setLayeredPane(pane);
         assertTrue(frame.getLayeredPane() == pane);
         assertTrue("layeredPane is a bound property", listener.ok);
-
         // test throwing exception if the parameter is null
         boolean ok = false;
         try {
@@ -1191,7 +1107,6 @@
         }
         // layeredPane cannot be null, even after setLayeredPane(null)
         assertTrue(frame.getLayeredPane() != null);
-
         // setLayeredPane() method is not called by the constructor
         // (seems that there is an error in docs)
     }
@@ -1203,13 +1118,10 @@
      */
     public void testSetGetDesktopIcon() {
         assertTrue("desktopIcon is not null by default", frame.getDesktopIcon() != null);
-
         JInternalFrame.JDesktopIcon icon = new JInternalFrame.JDesktopIcon(frame);
         assertTrue("desktopIcon is not set", frame.getDesktopIcon() != icon);
-
         frame.setDesktopIcon(icon);
         assertTrue("desktopIcon is set", frame.getDesktopIcon() == icon);
-
         frame.setDesktopIcon(null);
         assertNull("desktopIcon is null", frame.getDesktopIcon());
     }
@@ -1220,23 +1132,18 @@
     public void testGetDesktopPane() {
         // no desktopPane
         assertNull("desktopPane is null by default", frame.getDesktopPane());
-
         //JInternalFrame.JDesktopIcon icon = new JInternalFrame.JDesktopIcon(frame);
         //frame.setDesktopIcon(icon);
         JDesktopPane desktop = new JDesktopPane();
-
         // frame is added to desktopPane
         desktop.add(frame);
         assertTrue("desktopPane is set", frame.getDesktopPane() == desktop);
-
         // frame is removed from desktopPane
         desktop.remove(frame);
         assertNull("desktopPane is null", frame.getDesktopPane());
-
         // icon is added to desktoPane
         desktop.add(frame.getDesktopIcon());
         assertTrue("desktopPane is set", frame.getDesktopPane() == desktop);
-
         // icon is removed from desktopPane, desktopIcon == null
         // default implementation crashes here
         //desktop.remove(frame.getDesktopIcon());
@@ -1251,12 +1158,9 @@
      */
     public void testSetGetFrameIcon() {
         Icon icon = new ImageIcon();
-
         assertTrue("frameIcon is not null by default", frame.getFrameIcon() != null);
-
         frame.setFrameIcon(icon);
         assertTrue("frameIcon is set", frame.getFrameIcon() == icon);
-
         frame.setFrameIcon(null);
         assertNull("frameIcon is set to null", frame.getFrameIcon());
     }
@@ -1266,53 +1170,40 @@
      */
     public void testGetAccessibleContext() {
         AccessibleContext c = frame.getAccessibleContext();
-
         assertTrue("instanceof AccessibleJInternalFrame",
-                   c instanceof JInternalFrame.AccessibleJInternalFrame);
-
+                c instanceof JInternalFrame.AccessibleJInternalFrame);
         // test getAccessibleName()
         assertTrue("AccessibleName is ok", c.getAccessibleName() == "");
         frame.setTitle("aa");
         assertTrue("AccessibleName is ok", c.getAccessibleName() == "aa");
-
         // test getAccessibleRole()
-        assertTrue("AccessibleRole ok",
-                   c.getAccessibleRole() == AccessibleRole.INTERNAL_FRAME);
-
+        assertTrue("AccessibleRole ok", c.getAccessibleRole() == AccessibleRole.INTERNAL_FRAME);
         // test getAccessibleValue()
         assertTrue("AccessibleValue ok", c.getAccessibleValue() == c);
-
         // test setCurrentAccessibleValue(), getCurrentAccessibleValue()
         AccessibleValue value = c.getAccessibleValue();
         assertTrue("currentAccessibleValue == 0",
-                   value.getCurrentAccessibleValue().intValue() == 0);
+                value.getCurrentAccessibleValue().intValue() == 0);
         Integer currentAccessibleValue = new Integer(4);
         boolean set = value.setCurrentAccessibleValue(currentAccessibleValue);
         assertTrue("setCurrentAccessibleValue returns true", set);
         set = value.setCurrentAccessibleValue(new Float(5));
         assertTrue("setCurrentAccessibleValue returns true", set);
-
         assertTrue("currentAccessibleValue == 5",
                 value.getCurrentAccessibleValue().intValue() == 5);
         assertTrue("the object is not the same",
-                   value.getCurrentAccessibleValue() != currentAccessibleValue);
-
+                value.getCurrentAccessibleValue() != currentAccessibleValue);
         set = value.setCurrentAccessibleValue(null);
         assertFalse("setCurrentAccessibleValue returns false", set);
-
         // test getMinimumAccessibleValue()
         assertTrue("minimumAccessibleValue ok",
-                   value.getMinimumAccessibleValue().intValue() == Integer.MIN_VALUE);
-
+                value.getMinimumAccessibleValue().intValue() == Integer.MIN_VALUE);
         // test getMaximumAccessibleValue()
         assertTrue("maximumAccessibleValue ok",
-                   value.getMaximumAccessibleValue().intValue() == Integer.MAX_VALUE);
-
+                value.getMaximumAccessibleValue().intValue() == Integer.MAX_VALUE);
         // test other methods
-        assertNull("AccessibleDescription is ok",
-                c.getAccessibleDescription());
-        assertTrue("AccessibleChildrenCount == 1",
-                   c.getAccessibleChildrenCount() == 1);
+        assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
+        assertTrue("AccessibleChildrenCount == 1", c.getAccessibleChildrenCount() == 1);
     }
 
     /*
@@ -1324,14 +1215,11 @@
         final String title = "Test title";
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.TITLE_PROPERTY, listener);
-
         assertTrue("Default title is an empty title", frame.getTitle() == "");
-
         // test setting the correct title
         frame.setTitle(title);
         assertTrue("Title is set correctly", frame.getTitle() == title);
         assertTrue("title is a bound property", listener.ok);
-
         // test setting null title
         frame.setTitle(null);
         assertNull("Title is set to null", frame.getTitle());
@@ -1365,17 +1253,11 @@
         Rectangle normal = new Rectangle(100, 150); // normal bounds
         Rectangle bounds = new Rectangle(150, 200); // bounds
         frame.setBounds(bounds);
-
-        assertTrue("normalBounds is not null by default",
-                   frame.getNormalBounds() != null);
+        assertTrue("normalBounds is not null by default", frame.getNormalBounds() != null);
         assertFalse("normalBounds is not affected by setBounds()",
-                    frame.getNormalBounds() == bounds);
-
+                frame.getNormalBounds() == bounds);
         frame.setNormalBounds(normal);
-
-        assertFalse("bounds is not affected by setNormalBounds()",
-                    frame.getBounds() == normal);
-
+        assertFalse("bounds is not affected by setNormalBounds()", frame.getBounds() == normal);
         // test getNormalBounds() when isMaximum == false
         try {
             frame.setMaximum(false);
@@ -1384,7 +1266,6 @@
         }
         assertTrue("normalBounds is set", frame.getNormalBounds() == normal);
         assertFalse("normalBounds is not a bound property", listener.ok);
-
         // test getNormalBounds() when isMaximum == true
         try {
             frame.setMaximum(true);
@@ -1402,7 +1283,6 @@
         TestInternalFrame frame = new TestInternalFrame();
         LayoutManager contentLayout = frame.getContentPane().getLayout();
         LayoutManager frameLayout = frame.getLayout();
-
         // rootPaneCheckingEnabled is true, no exception since 1.5
         frame.setRootPaneCheckingEnabled(true);
         boolean ok = false;
@@ -1414,11 +1294,9 @@
             assertFalse("no exception since 1.5", ok);
             assertTrue("contentPane layout is changed",
                     frame.getContentPane().getLayout() != contentLayout);
-            assertTrue("Frame layout shouldn't be changed",
-                    frame.getLayout() == frameLayout);
+            assertTrue("Frame layout shouldn't be changed", frame.getLayout() == frameLayout);
             frame.getContentPane().setLayout(contentLayout);
         }
-
         // rootPaneCheckingEnabled is false
         frame.setRootPaneCheckingEnabled(false);
         ok = false;
@@ -1428,10 +1306,9 @@
             ok = true;
         } finally {
             assertFalse("no exception", ok);
-            assertTrue("contentPane layout shouldn't be changed",
-                    frame.getContentPane().getLayout() == contentLayout);
-            assertTrue("Frame layout is changed",
-                    frame.getLayout() != frameLayout);
+            assertTrue("contentPane layout shouldn't be changed", frame.getContentPane()
+                    .getLayout() == contentLayout);
+            assertTrue("Frame layout is changed", frame.getLayout() != frameLayout);
         }
     }
 
@@ -1450,12 +1327,10 @@
     public void testSetGetContentPane() {
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.CONTENT_PANE_PROPERTY, listener);
-
         JPanel pane = new JPanel();
         frame.setContentPane(pane);
         assertTrue(frame.getContentPane() == pane);
         assertTrue("contentPane is a bound property", listener.ok);
-
         // test throwing exception if the parameter is null
         boolean ok = false;
         try {
@@ -1467,7 +1342,6 @@
         }
         // contentPane cannot be null, even after setContentPane(null)
         assertTrue(frame.getContentPane() != null);
-
         // setContentPane() method is not called by the constructor
         // (seems that there is an error in docs)
     }
@@ -1480,12 +1354,10 @@
     public void testSetGetGlassPane() {
         MyPropertyChangeListener listener = new MyPropertyChangeListener();
         frame.addPropertyChangeListener(JInternalFrame.GLASS_PANE_PROPERTY, listener);
-
         JPanel pane = new JPanel();
         frame.setGlassPane(pane);
         assertTrue(frame.getGlassPane() == pane);
         assertTrue("glassPane is a bound property", listener.ok);
-
         // test throwing exception if the parameter is null
         boolean ok = false;
         try {
@@ -1497,7 +1369,6 @@
         }
         // glassPane cannot be null, even after setGlassPane(null)
         assertTrue(frame.getGlassPane() != null);
-
         // setGlassPane() method is not called by the constructor
         // (seems that there is an error in docs)
     }
@@ -1511,28 +1382,24 @@
         assertTrue("label is in contentPane", frame.isAncestorOf(comp));
         frame.remove(comp);
         assertFalse("label is removed from contentPane", frame.isAncestorOf(comp));
-
-        ((JPanel)frame.getGlassPane()).add(comp);
+        ((JPanel) frame.getGlassPane()).add(comp);
         frame.remove(comp);
         assertTrue("label is not removed from glassPane", frame.isAncestorOf(comp));
-
         // test removing from JInternalFrame
         frame.setRootPaneCheckingEnabled(false);
         frame.add(comp);
         assertTrue("added", comp.getParent() == frame);
         frame.remove(comp);
         assertTrue("removed", comp.getParent() != frame);
-
         // test removing null
         boolean ok = false;
         try {
-            frame.remove((Component)null);
+            frame.remove((Component) null);
         } catch (NullPointerException e) {
             ok = true;
         } finally {
             assertTrue("exception", ok);
         }
-
         // test removing rootPane
         assertTrue(frame.isAncestorOf(frame.getRootPane()));
         frame.remove(frame.getRootPane());
@@ -1551,9 +1418,7 @@
         rootFrame = new JFrame();
         JDesktopPane desktop = new JDesktopPane();
         rootFrame.setContentPane(desktop);
-
         rootFrame.getContentPane().add(frame);
-
         rootFrame.setSize(100, 200);
         frame.setVisible(true);
         rootFrame.setVisible(true);
@@ -1567,10 +1432,10 @@
         //try {
         //    SwingUtilities.invokeAndWait(new Runnable() {
         //        public void run() {
-                    try {
-                        frame.setSelected(selected);
-                    } catch (PropertyVetoException e) {
-                    }
+        try {
+            frame.setSelected(selected);
+        } catch (PropertyVetoException e) {
+        }
         //        }
         //    });
         //} catch (Exception e) {
@@ -1592,10 +1457,8 @@
      */
     public void testFocusCycleRoot() {
         assertTrue("isFocusCycleRoot is always true", frame.isFocusCycleRoot());
-
         frame.setFocusCycleRoot(false);
         assertTrue("isFocusCycleRoot is always true", frame.isFocusCycleRoot());
-
         frame.setFocusCycleRoot(true);
         assertTrue("isFocusCycleRoot is always true", frame.isFocusCycleRoot());
     }
@@ -1612,7 +1475,6 @@
      */
     public void testHide() {
         frame.setVisible(true);
-
         frame.hide();
         assertFalse("frame is hided", frame.isVisible());
         if (isHarmony()) {
@@ -1631,14 +1493,12 @@
         assertTrue("frame is visible", frame.isVisible());
         assertTrue("icon is visible", frame.getDesktopIcon().isVisible());
         assertFalse("is selected", frame.isSelected());
-
         // test show() the first time
         frame = new JInternalFrame();
         frame.addInternalFrameListener(l);
         l.state = 0;
         createAndShowRootFrame();
         assertTrue("INTERNAL_FRAME_OPENED was fired", l.openedFired());
-
         // test show() the second time
         frame.dispose();
         JInternalFrame frame2 = new JInternalFrame("frame2");
@@ -1649,20 +1509,17 @@
         l.state = 0;
         frame.show();
         assertFalse("INTERNAL_FRAME_OPENED was not fired", l.openedFired());
-        assertTrue("moved to the front", ((JLayeredPane)rootFrame.
-                                          getContentPane()).getIndexOf(frame) == 0);
+        assertTrue("moved to the front", ((JLayeredPane) rootFrame.getContentPane())
+                .getIndexOf(frame) == 0);
         assertTrue("is visible", frame.isVisible());
         assertTrue("is selected", frame.isSelected());
-
         // test when the frame is already shown
         frame.show();
         assertFalse("INTERNAL_FRAME_OPENED was not fired", l.openedFired());
-
         // test show() when the internal frame is iconified
         try {
             frame.setIcon(true);
         } catch (PropertyVetoException e) {
-
         }
         frame.setVisible(false);
         frame.show();
@@ -1675,7 +1532,6 @@
         createAndShowRootFrame();
         MyInternalFrameListener l = new MyInternalFrameListener();
         frame.addInternalFrameListener(l);
-
         // test when the internal frame is visible
         l.state = 0;
         MyPropertyChangeListener l2 = new MyPropertyChangeListener();
@@ -1688,13 +1544,11 @@
         assertTrue("INTERNAL_FRAME_CLOSED was fired", l.closedFired());
         assertFalse("INTERNAL_FRAME_CLOSING was not fired", l.closingFired());
         assertFalse("removed from the containter", rootFrame.isAncestorOf(frame));
-
         // test already disposed internal frame
         l.state = 0;
         frame.dispose();
         if (isHarmony()) {
-            assertFalse("INTERNAL_FRAME_CLOSED was not fired",
-                        l.closedFired());
+            assertFalse("INTERNAL_FRAME_CLOSED was not fired", l.closedFired());
         }
     }
 
@@ -1708,7 +1562,7 @@
                 validateMarker.setOccurred();
                 super.validate();
             }
-            
+
             @Override
             public void revalidate() {
                 revalidateMarker.setOccurred();
@@ -1717,7 +1571,6 @@
         };
         validateMarker.reset();
         revalidateMarker.reset();
-
         frame.setBounds(0, 0, 50, 500);
         assertFalse(revalidateMarker.isOccurred());
         assertTrue(validateMarker.isOccurred());

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrame_MultithreadedTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrame_MultithreadedTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrame_MultithreadedTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JInternalFrame_MultithreadedTest.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;
@@ -39,7 +37,6 @@
  *
  */
 public class JInternalFrame_MultithreadedTest extends BasicSwingTestCase {
-
     private JInternalFrame frame;
 
     // is used in tests where frame.isShowing() must be true
@@ -48,6 +45,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         frame = new JInternalFrame();
@@ -56,6 +54,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         if (rootFrame != null) {
             rootFrame.dispose();
@@ -75,18 +74,17 @@
     /*
      * Class under test for void restoreSubcomponentFocus()
      */
-    public void testRestoreSubcomponentFocus() throws InterruptedException, InvocationTargetException {
+    public void testRestoreSubcomponentFocus() throws InterruptedException,
+            InvocationTargetException {
         final Component comp1 = new JPanel();
         final Component comp2 = new JPanel();
         final Component comp3 = new JPanel();
         frame.getContentPane().add(comp1, BorderLayout.NORTH);
         frame.getContentPane().add(comp2, BorderLayout.SOUTH);
         frame.getContentPane().add(comp3, BorderLayout.CENTER);
-
         createAndShowRootFrame();
         setSelectedFrame(frame, true);
         SwingWaitTestCase.requestFocusInWindowForComponent(comp2);
-
         setSelectedFrame(frame, false);
         setSelectedFrame(frame, true);
         assertTrue("focus is restored", frame.getFocusOwner() == comp2);
@@ -101,9 +99,7 @@
         rootFrame = new JFrame();
         JDesktopPane desktop = new JDesktopPane();
         rootFrame.setContentPane(desktop);
-
         rootFrame.getContentPane().add(frame);
-
         rootFrame.setSize(100, 200);
         frame.setVisible(true);
         rootFrame.setVisible(true);
@@ -132,29 +128,34 @@
     /*
      * Class under test for Component getMostRecentFocusOwner()
      */
-    public void testGetMostRecentFocusOwner() throws PropertyVetoException, InterruptedException, InvocationTargetException {
+    public void testGetMostRecentFocusOwner() throws PropertyVetoException,
+            InterruptedException, InvocationTargetException {
         final Component initial = new JPanel(); // initial focus component
         final Component def = new JPanel(); // default focus component
         final Component some = new JPanel(); // some another component
         frame.getContentPane().add(initial, BorderLayout.NORTH);
         frame.getContentPane().add(def, BorderLayout.SOUTH);
         frame.getContentPane().add(some, BorderLayout.CENTER);
-
         assertNull("null by default", frame.getMostRecentFocusOwner());
-
         class MyFocusTraversalPolicy extends SortingFocusTraversalPolicy {
             Component initial;
+
             Component def;
+
             public MyFocusTraversalPolicy() {
-                setComparator(new Comparator() {
+                setComparator(new Comparator<Object>() {
                     public int compare(final Object arg0, final Object arg1) {
                         return System.identityHashCode(arg0) - System.identityHashCode(arg1);
                     }
                 });
             }
+
+            @Override
             public Component getInitialComponent(final javax.swing.JInternalFrame frame) {
                 return initial;
             }
+
+            @Override
             public Component getDefaultComponent(final Container focusCycleRoot) {
                 return def;
             }
@@ -162,29 +163,24 @@
         MyFocusTraversalPolicy traversal = new MyFocusTraversalPolicy();
         traversal.def = def;
         frame.setFocusTraversalPolicy(traversal);
-
-        if (SwingTestCase.isHarmony()) {
-            assertSame("== def (JRockit fails)", def,
-                       frame.getMostRecentFocusOwner());
+        if (BasicSwingTestCase.isHarmony()) {
+            assertSame("== def (JRockit fails)", def, frame.getMostRecentFocusOwner());
         }
-
         // no one component had ever the focus, initial is returned
         traversal.initial = initial;
         createAndShowRootFrame();
         assertTrue("== initial", frame.getMostRecentFocusOwner() == initial);
-
         // request focus for 'some' component, this component must be returned by
         // getMostRecentFocusOwner()
         setSelectedFrame(frame, true);
         SwingWaitTestCase.requestFocusInWindowForComponent(some);
         setSelectedFrame(frame, false);
         assertTrue("== some", frame.getMostRecentFocusOwner() == some);
-
         // frame is selected, returns the same component as getFocusOwner()
         setSelectedFrame(frame, true);
         SwingWaitTestCase.requestFocusInWindowForComponent(def);
-        assertTrue("== getFocusOwner()", frame.getMostRecentFocusOwner() ==
-                   frame.getFocusOwner());
+        assertTrue("== getFocusOwner()", frame.getMostRecentFocusOwner() == frame
+                .getFocusOwner());
     }
 
     /*
@@ -197,16 +193,12 @@
         frame.getContentPane().add(comp1, BorderLayout.NORTH);
         frame.getContentPane().add(comp2, BorderLayout.SOUTH);
         frame.getContentPane().add(comp3, BorderLayout.CENTER);
-
         assertNull("== null", frame.getFocusOwner());
-
         createAndShowRootFrame();
-
         // frame is selected, comp2 has focus
         setSelectedFrame(frame, true);
         SwingWaitTestCase.requestFocusInWindowForComponent(comp2);
         assertSame("== comp2", comp2, frame.getFocusOwner());
-
         // frame is not selected
         setSelectedFrame(frame, false);
         assertNull("== null", frame.getFocusOwner());

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelRTest.java Sat Nov 25 16:04:10 2006
@@ -26,6 +26,7 @@
         label.setFont(null);
         label.paint(createTestGraphics());
     }
+
     public static void main(String[] args) {
         junit.textui.TestRunner.run(JLabelRTest.class);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLabelTest.java Sat Nov 25 16:04:10 2006
@@ -24,35 +24,37 @@
 import java.awt.EventQueue;
 import java.awt.Graphics;
 import java.awt.KeyboardFocusManager;
+import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
 import java.awt.image.BufferedImage;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.util.HashSet;
 import java.util.Set;
-
 import javax.accessibility.AccessibleRole;
 import javax.swing.plaf.LabelUI;
 
 public class JLabelTest extends BasicSwingTestCase {
     private JLabel label;
+
     private TestPropertyChangeListener listener;
 
     public JLabelTest(final String name) {
         super(name);
     }
 
+    @Override
     protected void setUp() throws Exception {
         label = new JLabel();
         listener = new TestPropertyChangeListener();
         label.addPropertyChangeListener(listener);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         label = null;
     }
 
-
     public void testJLabel() throws Exception {
         label = new JLabel();
         assertEquals(SwingConstants.CENTER, label.getVerticalAlignment());
@@ -60,53 +62,49 @@
         assertEquals("", label.getText());
         assertTrue(label.getAlignmentX() == 0);
         assertTrue(label.getAlignmentY() == 0.5);
-
         final Icon icon = createTestIcon();
-
         label = new JLabel(icon);
         assertEquals(SwingConstants.CENTER, label.getVerticalAlignment());
         assertEquals(SwingConstants.CENTER, label.getHorizontalAlignment());
         assertNull(label.getText());
         assertTrue(label.getAlignmentX() == 0);
         assertTrue(label.getAlignmentY() == 0.5);
-
         label = new JLabel(icon, SwingConstants.RIGHT);
         assertEquals(SwingConstants.CENTER, label.getVerticalAlignment());
         assertEquals(SwingConstants.RIGHT, label.getHorizontalAlignment());
         assertNull(label.getText());
         assertTrue(label.getAlignmentX() == 0);
         assertTrue(label.getAlignmentY() == 0.5);
-
         label = new JLabel("any");
         assertEquals(SwingConstants.CENTER, label.getVerticalAlignment());
         assertEquals(SwingConstants.LEADING, label.getHorizontalAlignment());
         assertTrue(label.getAlignmentX() == 0);
         assertTrue(label.getAlignmentY() == 0.5);
-
         label = new JLabel("any", SwingConstants.TRAILING);
         assertEquals(SwingConstants.CENTER, label.getVerticalAlignment());
         assertEquals(SwingConstants.TRAILING, label.getHorizontalAlignment());
         assertTrue(label.getAlignmentX() == 0);
         assertTrue(label.getAlignmentY() == 0.5);
-
         label = new JLabel("any", icon, SwingConstants.RIGHT);
         assertEquals(SwingConstants.CENTER, label.getVerticalAlignment());
         assertEquals(SwingConstants.RIGHT, label.getHorizontalAlignment());
         assertEquals(SwingConstants.TRAILING, label.getHorizontalTextPosition());
         assertTrue(label.getAlignmentX() == 0);
         assertTrue(label.getAlignmentY() == 0.5);
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 new JLabel(icon, SwingConstants.BOTTOM);
             }
         });
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 new JLabel("any", SwingConstants.TOP);
             }
         });
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 new JLabel("any", icon, SwingConstants.TOP);
             }
@@ -120,7 +118,6 @@
         label.checkHorizontalKey(SwingConstants.RIGHT, null);
         label.checkHorizontalKey(SwingConstants.LEADING, null);
         label.checkHorizontalKey(SwingConstants.TRAILING, null);
-
         checkHorizontalKey(label, SwingConstants.BOTTOM);
         checkHorizontalKey(label, SwingConstants.TOP);
     }
@@ -130,14 +127,12 @@
         label.checkVerticalKey(SwingConstants.TOP, null);
         label.checkVerticalKey(SwingConstants.CENTER, null);
         label.checkVerticalKey(SwingConstants.BOTTOM, null);
-
         checkVerticalKey(label, SwingConstants.LEADING);
         checkVerticalKey(label, SwingConstants.TRAILING);
         checkVerticalKey(label, SwingConstants.LEFT);
         checkVerticalKey(label, SwingConstants.RIGHT);
     }
 
-
     public void testGetAccessibleContext() throws Exception {
         assertNotNull(label.getAccessibleContext());
         assertEquals(AccessibleRole.LABEL, label.getAccessibleContext().getAccessibleRole());
@@ -146,17 +141,15 @@
     public void testGetSetIcons() throws Exception {
         assertNull(label.getIcon());
         assertNull(label.getDisabledIcon());
-
         Icon icon = createTestIcon();
         label.setIcon(icon);
         assertEquals(icon, label.getIcon());
         assertNotNull(label.getDisabledIcon());
         assertNotSame(icon, label.getDisabledIcon());
-        assertEquals("new instances should not be produced", label.getDisabledIcon(), label.getDisabledIcon());
-
+        assertEquals("new instances should not be produced", label.getDisabledIcon(), label
+                .getDisabledIcon());
         label.setDisabledIcon(null);
         assertNotNull(label.getDisabledIcon());
-
         label.setIcon(new Icon() {
             public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
             }
@@ -170,7 +163,6 @@
             }
         });
         assertNull(label.getDisabledIcon());
-
         TestPropertyChangeListener listener = new TestPropertyChangeListener();
         label.addPropertyChangeListener(listener);
         label.setDisabledIcon(icon);
@@ -182,49 +174,44 @@
         listener.reset();
         label.setDisplayedMnemonic('a');
         assertEquals(KeyEvent.VK_A, label.getDisplayedMnemonic());
-
         label.setDisplayedMnemonic(KeyEvent.VK_B);
         assertEquals(KeyEvent.VK_B, label.getDisplayedMnemonic());
-
         assertTrue(listener.isPropertyChanged("displayedMnemonic"));
-
         label.setLabelFor(new JButton());
-        assertNull(label.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.ALT_DOWN_MASK)));
-        assertNotNull(label.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.ALT_DOWN_MASK)));
+        assertNull(label.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(
+                KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.ALT_DOWN_MASK)));
+        assertNotNull(label.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(
+                KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.ALT_DOWN_MASK)));
     }
 
     public void testGetSetDisplayedMnemonicIndex() throws Exception {
         listener.reset();
         label = new JLabel("abcd");
         label.addPropertyChangeListener(listener);
-
         assertEquals(-1, label.getDisplayedMnemonicIndex());
         label.setDisplayedMnemonic('a');
         assertEquals(0, label.getDisplayedMnemonicIndex());
         assertTrue(listener.isPropertyChanged("displayedMnemonicIndex"));
-
         label.setDisplayedMnemonic('e');
         assertEquals(-1, label.getDisplayedMnemonicIndex());
         assertTrue(listener.isPropertyChanged("displayedMnemonicIndex"));
-
         listener.reset();
         label.setDisplayedMnemonicIndex(3);
         assertEquals(3, label.getDisplayedMnemonicIndex());
         assertTrue(listener.isPropertyChanged("displayedMnemonicIndex"));
-
         label.setDisplayedMnemonicIndex(-1);
         assertEquals(-1, label.getDisplayedMnemonicIndex());
-
         label.setText(null);
         label.setDisplayedMnemonicIndex(-1);
         assertEquals(-1, label.getDisplayedMnemonicIndex());
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.setDisplayedMnemonicIndex(5);
             }
         });
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.setDisplayedMnemonicIndex(-10);
             }
@@ -236,11 +223,10 @@
         label.setHorizontalAlignment(SwingConstants.RIGHT);
         assertEquals(SwingConstants.RIGHT, label.getHorizontalAlignment());
         assertTrue(listener.isPropertyChanged("horizontalAlignment"));
-
         label = new JLabel(createTestIcon());
         assertEquals(SwingConstants.CENTER, label.getHorizontalAlignment());
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.setHorizontalAlignment(SwingConstants.BOTTOM);
             }
@@ -249,12 +235,11 @@
 
     public void testGetSetHorizontalTextPosition() throws Exception {
         assertEquals(SwingConstants.TRAILING, label.getHorizontalTextPosition());
-
         label.setHorizontalTextPosition(SwingConstants.RIGHT);
         assertEquals(SwingConstants.RIGHT, label.getHorizontalTextPosition());
         assertTrue(listener.isPropertyChanged("horizontalTextPosition"));
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.setHorizontalTextPosition(SwingConstants.BOTTOM);
             }
@@ -263,7 +248,6 @@
 
     public void testGetSetIconTextGap() throws Exception {
         assertEquals(4, label.getIconTextGap());
-
         label.setIconTextGap(7);
         assertEquals(7, label.getIconTextGap());
         assertTrue(listener.isPropertyChanged("iconTextGap"));
@@ -271,7 +255,6 @@
 
     public void testGetSetLabelFor() throws Exception {
         assertNull(label.getLabelFor());
-
         JComponent c = new JPanel();
         label.setLabelFor(c);
         assertEquals(c, label.getLabelFor());
@@ -280,23 +263,18 @@
 
     public void testGetSetText() throws Exception {
         assertEquals("", label.getText());
-
         String text = "any";
         label.setText(text);
         assertEquals(text, label.getText());
         assertTrue(listener.isPropertyChanged("text"));
-
         label = new JLabel(text);
         assertEquals(text, label.getText());
-
         label.setDisplayedMnemonic('y');
         assertEquals('Y', label.getDisplayedMnemonic());
         assertEquals(2, label.getDisplayedMnemonicIndex());
-
         label.setText("handy");
         assertEquals('Y', label.getDisplayedMnemonic());
         assertEquals(4, label.getDisplayedMnemonicIndex());
-
         label.setText("ok");
         assertEquals('Y', label.getDisplayedMnemonic());
         assertEquals(-1, label.getDisplayedMnemonicIndex());
@@ -305,11 +283,10 @@
     public void testGetSetUpdateUI() throws Exception {
         LabelUI defaultUI = label.getUI();
         assertNotNull(defaultUI);
-
-        LabelUI ui = new LabelUI() {};
+        LabelUI ui = new LabelUI() {
+        };
         label.setUI(ui);
         assertEquals(ui, label.getUI());
-
         label.updateUI();
         assertEquals(defaultUI, label.getUI());
     }
@@ -323,8 +300,8 @@
         label.setVerticalAlignment(SwingConstants.TOP);
         assertEquals(SwingConstants.TOP, label.getVerticalAlignment());
         assertTrue(listener.isPropertyChanged("verticalAlignment"));
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.setVerticalAlignment(SwingConstants.RIGHT);
             }
@@ -336,8 +313,8 @@
         label.setVerticalTextPosition(SwingConstants.TOP);
         assertEquals(SwingConstants.TOP, label.getVerticalTextPosition());
         assertTrue(listener.isPropertyChanged("verticalTextPosition"));
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.setVerticalAlignment(SwingConstants.RIGHT);
             }
@@ -347,57 +324,58 @@
     public void testImageUpdate() throws Exception {
         Icon icon = createTestIcon();
         label.setIcon(icon);
-
-        assertFalse(label.imageUpdate(((ImageIcon)createTestIcon()).getImage(), 0, 0, 0, 0, 0));
+        assertFalse(label.imageUpdate(((ImageIcon) createTestIcon()).getImage(), 0, 0, 0, 0, 0));
     }
 
     public void testMnemonicProcessing() throws Exception {
         final JFrame frame = new JFrame();
         final JLabel label = new JLabel("label");
         final JButton button = new JButton("button");
-
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 frame.setSize(100, 100);
                 frame.setLocation(100, 100);
-
                 frame.getContentPane().add(label);
                 frame.getContentPane().add(button);
-
                 label.setLabelFor(button);
                 label.setDisplayedMnemonic(KeyEvent.VK_A);
-
                 label.setFocusable(true);
                 frame.setVisible(true);
-
                 label.requestFocus();
             }
         });
-
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                assertEquals(label, KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
-
-                label.dispatchEvent(new KeyEvent(label, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), KeyEvent.ALT_DOWN_MASK, KeyEvent.VK_A, 'a'));
-                label.dispatchEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED, EventQueue.getMostRecentEventTime(), KeyEvent.ALT_DOWN_MASK, KeyEvent.VK_A, 'a'));
+                assertEquals(label, KeyboardFocusManager.getCurrentKeyboardFocusManager()
+                        .getFocusOwner());
+                label
+                        .dispatchEvent(new KeyEvent(label, KeyEvent.KEY_PRESSED, EventQueue
+                                .getMostRecentEventTime(), InputEvent.ALT_DOWN_MASK,
+                                KeyEvent.VK_A, 'a'));
+                label
+                        .dispatchEvent(new KeyEvent(label, KeyEvent.KEY_RELEASED, EventQueue
+                                .getMostRecentEventTime(), InputEvent.ALT_DOWN_MASK,
+                                KeyEvent.VK_A, 'a'));
             }
         });
-
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                assertEquals(button, KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+                assertEquals(button, KeyboardFocusManager.getCurrentKeyboardFocusManager()
+                        .getFocusOwner());
             }
         });
         frame.dispose();
     }
 
-
     private void checkHorizontalKey(final JLabel label, final int key) {
         final String message = "any";
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.checkHorizontalKey(key, message);
             }
+
+            @Override
             public String expectedExceptionMessage() {
                 return message;
             }
@@ -407,9 +385,12 @@
     private void checkVerticalKey(final JLabel label, final int key) {
         final String message = "any";
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 label.checkVerticalKey(key, message);
             }
+
+            @Override
             public String expectedExceptionMessage() {
                 return message;
             }
@@ -421,7 +402,7 @@
     }
 
     private class TestPropertyChangeListener implements PropertyChangeListener {
-        private Set changedPropertyNames = new HashSet();
+        private Set<String> changedPropertyNames = new HashSet<String>();
 
         public void propertyChange(final PropertyChangeEvent event) {
             changedPropertyNames.add(event.getPropertyName());

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLayeredPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLayeredPaneTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLayeredPaneTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JLayeredPaneTest.java Sat Nov 25 16:04:10 2006
@@ -14,23 +14,18 @@
  *  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.Canvas;
 import java.awt.Component;
-
 import java.util.Hashtable;
-
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 
-
 public class JLayeredPaneTest extends SwingTestCase {
     /*
      * components to add to the container
@@ -42,43 +37,47 @@
      * --------------------------------------
      */
     private static Component c5_0;
+
     private static Component c5_1;
+
     private static Component c5_2;
+
     private static Component c4_0;
+
     private static Component c4_1;
+
     private static Component c1_0;
 
-    // supposed indices of the above components
-    private static int i5_0 = 0;
-    private static int i5_1 = 1;
-    private static int i5_2 = 2;
     private static int i4_0 = 3;
-    private static int i4_1 = 4;
-    private static int i1_0 = 5;
 
     /*
      * This class overload protected methods with public methods
      */
     private class TestLayeredPane extends JLayeredPane {
+        private static final long serialVersionUID = 1L;
+
+        @SuppressWarnings("unchecked")
         public Hashtable getGetComponentToLayer() {
             return getComponentToLayer();
         }
 
+        @Override
         public Integer getObjectForLayer(final int layer) {
             return super.getObjectForLayer(layer);
         }
 
+        @Override
         public int insertIndexForLayer(final int layer, final int position) {
             return super.insertIndexForLayer(layer, position);
         }
 
+        @Override
         public String paramString() {
             return super.paramString();
         }
     }
 
     private JLayeredPane layered;
-
     static {
         c5_0 = new JPanel();
         c5_1 = new JPanel();
@@ -103,6 +102,7 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         layered = new JLayeredPane();
@@ -111,6 +111,7 @@
     /*
      * @see TestCase#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -128,11 +129,9 @@
      */
     public void testRemoveint() {
         addComponents();
-
         layered.remove(i4_0);
         assertFalse(layered.isAncestorOf(c4_0));
         assertEquals(5, layered.getComponentCount());
-
         // remove() with incorrect index throws ArrayIndexOutOfBoundsException
     }
 
@@ -143,31 +142,24 @@
         addComponents();
         Component comp = new Canvas();
         layered.setLayer(comp, 5);
-
         // comp is not in JLayeredPane
         assertTrue("not empty", layered.getComponentCount() != 0);
-        assertFalse("componentToLayer is not empty",
-                    layered.getComponentToLayer().isEmpty());
+        assertFalse("componentToLayer is not empty", layered.getComponentToLayer().isEmpty());
         layered.removeAll();
         assertTrue("empty", layered.getComponentCount() == 0);
-        assertFalse("componentToLayer is not empty",
-                   layered.getComponentToLayer().isEmpty());
-
+        assertFalse("componentToLayer is not empty", layered.getComponentToLayer().isEmpty());
         // comp is in JLayeredPane
         layered.add(comp);
         layered.removeAll();
-        assertTrue("componentToLayer is empty",
-                   layered.getComponentToLayer().isEmpty());
+        assertTrue("componentToLayer is empty", layered.getComponentToLayer().isEmpty());
     }
 
     public void testIsOptimizedDrawingEnabled() {
         // no components
         assertTrue(layered.isOptimizedDrawingEnabled());
-
         // 1 component
         layered.add(new JPanel());
         assertTrue(layered.isOptimizedDrawingEnabled());
-
         // many components
         addComponents();
         assertFalse(layered.isOptimizedDrawingEnabled());
@@ -175,14 +167,12 @@
 
     public void testHighestLayer() {
         assertEquals(0, layered.highestLayer());
-
         addComponents();
         assertEquals(5, layered.highestLayer());
     }
 
     public void testLowestLayer() {
         assertEquals(0, layered.lowestLayer());
-
         addComponents();
         assertEquals(1, layered.lowestLayer());
     }
@@ -193,7 +183,6 @@
 
     public void testGetComponentCountInLayer() {
         assertEquals(0, layered.getComponentCountInLayer(5));
-
         addComponents();
         assertEquals(3, layered.getComponentCountInLayer(5));
         assertEquals(2, layered.getComponentCountInLayer(4));
@@ -207,16 +196,12 @@
      */
     public void testGetAccessibleContext() {
         AccessibleContext c = layered.getAccessibleContext();
-
         assertTrue("instanceof AccessibleJLayeredPane",
-                   c instanceof JLayeredPane.AccessibleJLayeredPane);
-        assertTrue("AccessibleRole is ok",
-                c.getAccessibleRole() == AccessibleRole.LAYERED_PANE);
+                c instanceof JLayeredPane.AccessibleJLayeredPane);
+        assertTrue("AccessibleRole is ok", c.getAccessibleRole() == AccessibleRole.LAYERED_PANE);
         assertNull("AccessibleName is ok", c.getAccessibleName());
-        assertNull("AccessibleDescription is ok",
-                   c.getAccessibleDescription());
-        assertTrue("AccessibleChildrenCount == 0",
-                   c.getAccessibleChildrenCount() == 0);
+        assertNull("AccessibleDescription is ok", c.getAccessibleDescription());
+        assertTrue("AccessibleChildrenCount == 0", c.getAccessibleChildrenCount() == 0);
     }
 
     /*
@@ -232,74 +217,58 @@
     public void testSetLayerComponentintint() {
         Component jcomp = new JPanel();
         Component comp = new Canvas();
-
         // test setLayer() for JComponent outside the container
         layered.setLayer(jcomp, 4, 0);
         assertEquals(4, layered.getLayer(jcomp));
-        assertEquals(4, JLayeredPane.getLayer((JComponent)jcomp));
+        assertEquals(4, JLayeredPane.getLayer((JComponent) jcomp));
         assertFalse(layered.isAncestorOf(jcomp));
-
         // test setLayer() for Component outside the container
         layered.setLayer(comp, 4, 5);
         assertEquals(4, layered.getLayer(comp));
         assertFalse(layered.isAncestorOf(comp));
-
         addComponents();
-
         // to the start of existing layer
         layered.setLayer(c5_2, 1, 0);
         assertEquals(1, layered.getLayer(c5_2));
         assertEquals(4, layered.getIndexOf(c5_2));
-
         // in the middle of existing layer
         layered.setLayer(c5_2, 5, 1);
         assertEquals(5, layered.getLayer(c5_2));
         assertEquals(1, layered.getIndexOf(c5_2));
-
         // to the same position
         layered.setLayer(c1_0, 1, 1);
         assertEquals(1, layered.getLayer(c1_0));
         assertEquals(5, layered.getIndexOf(c1_0));
-
         // to the same index with different layer
         layered.removeAll();
         layered.add(c1_0);
         layered.setLayer(c1_0, 5, 0);
         assertEquals(5, layered.getLayer(c1_0));
-}
+    }
 
     /*
      * Class under test for void setPosition(Component, int)
      */
     public void testSetPositionComponentint() {
         Component comp = new JPanel();
-
         layered.setPosition(comp, 1);
         assertEquals(0, layered.getComponentCount());
-
         addComponents();
-
         layered.setPosition(c4_0, -1);
         assertEquals(4, layered.getIndexOf(c4_0));
-
         layered.setPosition(c4_0, 0);
         assertEquals(3, layered.getIndexOf(c4_0));
-
         layered.setPosition(c1_0, 0);
         assertEquals(5, layered.getIndexOf(c1_0));
-
         layered.setPosition(c1_0, -1);
         assertEquals(5, layered.getIndexOf(c1_0));
-
         layered.setPosition(c5_2, 100);
         assertEquals(2, layered.getIndexOf(c5_2));
-
         layered.setPosition(c5_0, 100);
         assertEquals(2, layered.getIndexOf(c5_0));
-
         layered.setPosition(c5_0, 1);
         assertEquals(1, layered.getIndexOf(c5_0));
-}
+    }
 
     /*
      * Class under test for void setLayer(Component, int)
@@ -307,24 +276,19 @@
     public void testSetLayerComponentint() {
         Component jcomp = new JPanel();
         Component comp = new Canvas();
-
         // test setLayer() for JComponent outside the container
         layered.setLayer(jcomp, 4);
         assertEquals(4, layered.getLayer(jcomp));
-        assertEquals(4, JLayeredPane.getLayer((JComponent)jcomp));
+        assertEquals(4, JLayeredPane.getLayer((JComponent) jcomp));
         assertFalse(layered.isAncestorOf(jcomp));
-
         // test setLayer() for Component outside the container
         layered.setLayer(comp, 4);
         assertEquals(4, layered.getLayer(comp));
         assertFalse(layered.isAncestorOf(comp));
-
         addComponents();
-
         layered.setLayer(c4_0, 3);
         assertEquals(4, layered.getIndexOf(c4_0));
         assertEquals(3, layered.getLayer(c4_0));
-
         layered.setLayer(c5_1, 1);
         assertEquals(5, layered.getIndexOf(c5_1));
         assertEquals(1, layered.getLayer(c5_1));
@@ -335,16 +299,12 @@
      */
     public void testMoveToFrontComponent() {
         addComponents();
-
         layered.moveToFront(c4_1);
         assertEquals(3, layered.getIndexOf(c4_1));
-
         layered.moveToFront(c5_2);
         assertEquals(0, layered.getIndexOf(c5_2));
-
         layered.moveToFront(c1_0);
         assertEquals(5, layered.getIndexOf(c1_0));
-
         // moveToFront() does nothing if the component is not from the containter
         layered.moveToFront(new JPanel());
         assertEquals(6, layered.getComponentCount());
@@ -355,16 +315,12 @@
      */
     public void testMoveToBackComponent() {
         addComponents();
-
         layered.moveToBack(c4_0);
         assertEquals(4, layered.getIndexOf(c4_0));
-
         layered.moveToBack(c5_0);
         assertEquals(2, layered.getIndexOf(c5_0));
-
         layered.moveToBack(c1_0);
         assertEquals(5, layered.getIndexOf(c1_0));
-
         // moveToBack() does nothing if the component is not from the containter
         layered.moveToBack(new JPanel());
         assertEquals(6, layered.getComponentCount());
@@ -375,7 +331,6 @@
      */
     public void testGetPositionComponent() {
         addComponents();
-
         assertEquals(0, layered.getPosition(c5_0));
         assertEquals(1, layered.getPosition(c5_1));
         assertEquals(2, layered.getPosition(c5_2));
@@ -392,24 +347,19 @@
         // getLayer() for JComponent that doesn't exist in the container
         Component c = new JPanel();
         assertEquals(0, layered.getLayer(c));
-
         // getLayer() for JComponent that doesn't exist in the container
         // but has layer in the property
-        JLayeredPane.putLayer((JComponent)c, 5);
+        JLayeredPane.putLayer((JComponent) c, 5);
         assertEquals(5, layered.getLayer(c));
-
         // getLayer() for Component that doesn't exist in the container
         c = new Canvas();
         assertEquals(0, layered.getLayer(c));
-
         // getLayer() for Component from the containter
         layered.add(c, new Integer(3));
         assertEquals(3, layered.getLayer(c));
-
         // getLayer() for Component removed from the containter
         layered.remove(c);
         assertEquals(0, layered.getLayer(c));
-
         // layered.getLayer((Component)null) - throws NPE
     }
 
@@ -418,9 +368,7 @@
      */
     public void testGetIndexOfComponent() {
         Component comp = new JPanel();
-
         assertEquals(-1, layered.getIndexOf(comp));
-
         addComponents();
         assertEquals(-1, layered.getIndexOf(comp));
         assertEquals(0, layered.getIndexOf(c5_0));
@@ -432,9 +380,11 @@
     }
 
     private boolean belongs(final Component c, final Component[] array) {
-        for (int i = 0; i < array.length; i++)
-            if (array[i] == c)
+        for (int i = 0; i < array.length; i++) {
+            if (array[i] == c) {
                 return true;
+            }
+        }
         return false;
     }
 
@@ -443,25 +393,20 @@
      */
     public void testGetComponentsInLayerint() {
         assertEquals(0, layered.getComponentsInLayer(1).length);
-
         addComponents();
         Component[] components;
-
         components = layered.getComponentsInLayer(5);
         assertEquals(3, components.length);
         assertTrue(belongs(c5_0, components));
         assertTrue(belongs(c5_1, components));
         assertTrue(belongs(c5_2, components));
-
         components = layered.getComponentsInLayer(4);
         assertEquals(2, components.length);
         assertTrue(belongs(c4_0, components));
         assertTrue(belongs(c4_1, components));
-
         components = layered.getComponentsInLayer(1);
         assertEquals(1, components.length);
         assertTrue(belongs(c1_0, components));
-
         assertEquals(0, layered.getComponentsInLayer(2).length);
     }
 
@@ -472,9 +417,7 @@
         // can't use c5_0 and others because they have
         // previous JLayeredPane as their parent
         assertNull(JLayeredPane.getLayeredPaneAbove(new JPanel()));
-
         assertNull(JLayeredPane.getLayeredPaneAbove(null));
-
         addComponents();
         assertTrue(JLayeredPane.getLayeredPaneAbove(c5_0) == layered);
     }
@@ -485,7 +428,6 @@
     public void testPutGetLayerJComponent() {
         JComponent c = new JPanel();
         assertEquals(0, JLayeredPane.getLayer(c));
-
         JLayeredPane.putLayer(c, 5);
         assertEquals(5, JLayeredPane.getLayer(c));
     }
@@ -495,9 +437,7 @@
      */
     public void testAddImpl() {
         JComponent comp = new JPanel();
-
         addComponents();
-
         // test add() with string instead of layer
         // should be added to layer 0
         JComponent comp2 = new JPanel();
@@ -511,40 +451,33 @@
         assertEquals(7, layered.getIndexOf(comp));
         layered.remove(comp);
         layered.remove(comp2);
-
         // test if add() sets "layer" property of the added component
         layered.add(comp, new Integer(4));
         assertEquals(4, JLayeredPane.getLayer(comp));
         assertEquals(5, layered.getIndexOf(comp));
         layered.remove(comp);
-
         // test add() to the bottom of the layer
         layered.add(comp, new Integer(4), -1);
         assertEquals(5, layered.getIndexOf(comp));
         layered.remove(comp);
-
         // test add() on the top of the layer
         layered.add(comp, new Integer(4), 0);
         assertEquals(3, layered.getIndexOf(comp));
         layered.remove(comp);
-
         // test add() to the inner of the layer
         layered.add(comp, new Integer(4), 1);
         assertEquals(4, layered.getIndexOf(comp));
         layered.remove(comp);
-
         // test add() to the invalid position of the layer
         layered.add(comp, new Integer(4), 100);
         assertEquals(5, layered.getIndexOf(comp));
         layered.remove(comp);
-
         // add component that already in container: the component must be removed first
         layered.add(comp, new Integer(4), 0);
         layered.add(comp, new Integer(3), 0);
         assertEquals(7, layered.getComponentCount());
         assertEquals(5, layered.getIndexOf(comp));
         layered.remove(comp);
-
         // test add() with layer set in JComponent
         JLayeredPane.putLayer(comp, 5);
         layered.add(comp);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JListRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JListRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JListRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JListRTest.java Sat Nov 25 16:04:10 2006
@@ -23,7 +23,6 @@
 import junit.framework.TestCase;
 
 public class JListRTest extends TestCase {
-
     public void testAddSelectionInterval() throws Exception {
         try {
             JList jl = new JList();
@@ -34,8 +33,8 @@
     }
 
     public void testSetSelectedIndicies() throws Exception {
-        JList l = new JList(new String[] {"", "", "", "", ""});
-        l.setSelectedIndices(new int [] {-1, 2, 3, 4, 200, 250});
+        JList l = new JList(new String[] { "", "", "", "", "" });
+        l.setSelectedIndices(new int[] { -1, 2, 3, 4, 200, 250 });
         assertEquals(2, l.getSelectionModel().getMinSelectionIndex());
         assertEquals(4, l.getSelectionModel().getMaxSelectionIndex());
     }



Mime
View raw message