harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [24/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/MenuSelectionManagerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/MenuSelectionManagerTest.java Sat Nov 25 16:04:10 2006
@@ -15,54 +15,52 @@
  *  limitations under the License.
  */
 /**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
 package javax.swing;
 
 import java.awt.Component;
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.util.EventListener;
-
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
-
 public class MenuSelectionManagerTest extends SwingTestCase {
-
-//    class ConcreteMenuDragMouseListener implements MenuDragMouseListener {
-//        public Object event;
-//        public void menuDragMouseDragged(MenuDragMouseEvent e) {
-//            event = "dragged";
-//        }
-//        public void menuDragMouseEntered(MenuDragMouseEvent e) {
-//            event = "entered";
-//        }
-//        public void menuDragMouseExited(MenuDragMouseEvent e) {
-//            event = "exited";
-//        }
-//        public void menuDragMouseReleased(MenuDragMouseEvent e) {
-//            event = "released";
-//        }
-//    };
-
-
-//    JMenuItem itemitem = new JMenuItem() {
-//        public void processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager) {
-//            System.out.println("itemitem: processKeyEvent");
-//            super.processKeyEvent(event, path, manager);
-//        }
-//
-//        public int getMnemonic() {
-//            System.out.println("itemitem: getMnemonic");
-//            return super.getMnemonic();
-//        }
-//    };
-
+    //    class ConcreteMenuDragMouseListener implements MenuDragMouseListener {
+    //        public Object event;
+    //        public void menuDragMouseDragged(MenuDragMouseEvent e) {
+    //            event = "dragged";
+    //        }
+    //        public void menuDragMouseEntered(MenuDragMouseEvent e) {
+    //            event = "entered";
+    //        }
+    //        public void menuDragMouseExited(MenuDragMouseEvent e) {
+    //            event = "exited";
+    //        }
+    //        public void menuDragMouseReleased(MenuDragMouseEvent e) {
+    //            event = "released";
+    //        }
+    //    };
+    //    JMenuItem itemitem = new JMenuItem() {
+    //        public void processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager) {
+    //            System.out.println("itemitem: processKeyEvent");
+    //            super.processKeyEvent(event, path, manager);
+    //        }
+    //
+    //        public int getMnemonic() {
+    //            System.out.println("itemitem: getMnemonic");
+    //            return super.getMnemonic();
+    //        }
+    //    };
     class ConcreteMenuElement extends JComponent implements MenuElement {
+        private static final long serialVersionUID = 1L;
+
         private Component component;
+
         private String name;
+
         public boolean selected = false;
 
         public ConcreteMenuElement(String name, Component component) {
@@ -75,32 +73,36 @@
             this.name = name;
         }
 
-        public void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager) {
-//            System.out.println("processMouseEvent (" + name + ")");
+        public void processMouseEvent(MouseEvent event, MenuElement[] path,
+                MenuSelectionManager manager) {
+            //            System.out.println("processMouseEvent (" + name + ")");
         }
 
-        public void processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager) {
-//            System.out.println("processKeyEvent (" + name + ")");
+        public void processKeyEvent(KeyEvent event, MenuElement[] path,
+                MenuSelectionManager manager) {
+            //            System.out.println("processKeyEvent (" + name + ")");
         }
 
         public void menuSelectionChanged(boolean isIncluded) {
-//            System.out.println("menuSelectionChanged (" + name + ")" + ": " + isIncluded);
+            //            System.out.println("menuSelectionChanged (" + name + ")" + ": " + isIncluded);
             selected = isIncluded;
         }
 
         public MenuElement[] getSubElements() {
-//            System.out.println("getSubElements (" + name + ")");
-            return new MenuElement[] {new ConcreteMenuElement(name + "1", component), new ConcreteMenuElement(name + "2", component)};
+            //            System.out.println("getSubElements (" + name + ")");
+            return new MenuElement[] { new ConcreteMenuElement(name + "1", component),
+                    new ConcreteMenuElement(name + "2", component) };
         }
 
         public Component getComponent() {
-//            System.out.println("getComponent (" + name + ")");
+            //            System.out.println("getComponent (" + name + ")");
             return component;
         }
     }
 
     class ConcreteChangeListener implements ChangeListener {
         public ChangeEvent eventHappened;
+
         private final boolean debugOut;
 
         public ConcreteChangeListener() {
@@ -124,21 +126,13 @@
 
     protected MenuSelectionManager manager;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         manager = new MenuSelectionManager();
-
-        final String key = "asd";
-//        itemitem.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0), key);
-//        itemitem.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0), key);
-//        itemitem.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0), key);
-//        itemitem.getActionMap().put(key, new AbstractAction() {
-//            public void actionPerformed(ActionEvent e) {
-//                System.out.println(key);
-//            }
-//        });
     }
 
+    @Override
     protected void tearDown() throws Exception {
         manager = null;
         super.tearDown();
@@ -161,30 +155,23 @@
         ChangeListener listener1 = new ConcreteChangeListener();
         ChangeListener listener2 = new ConcreteChangeListener();
         ChangeListener listener3 = new ConcreteChangeListener();
-
         EventListener[] listenersArray = null;
-
         listenersArray = manager.getChangeListeners();
         int initialValue = listenersArray.length;
-
         manager.addChangeListener(listener1);
         manager.addChangeListener(listener2);
         manager.addChangeListener(listener2);
-
         listenersArray = manager.getChangeListeners();
         assertEquals(initialValue + 3, listenersArray.length);
-
         manager.removeChangeListener(listener1);
         manager.addChangeListener(listener3);
         manager.addChangeListener(listener3);
         listenersArray = manager.getChangeListeners();
         assertEquals(initialValue + 4, listenersArray.length);
-
         manager.removeChangeListener(listener3);
         manager.removeChangeListener(listener3);
         listenersArray = manager.getChangeListeners();
         assertEquals(initialValue + 2, listenersArray.length);
-
         manager.removeChangeListener(listener2);
         manager.removeChangeListener(listener2);
         listenersArray = manager.getChangeListeners();
@@ -196,39 +183,39 @@
      */
     public void testComponentForPoint() {
         // TODO implement
-//        final JMenuBar menuBar = new JMenuBar();
-//        final JMenu menu1 = new JMenu();
-//        final JMenu menu2 = new JMenu();
-//        final JMenu menu3 = new JMenu();
-//        JFrame frame = new JFrame();
-//        frame.getContentPane().add(menuBar);
-//        menuBar.add(menu1);
-//        menu1.add(menu2);
-//        menu2.add(menu3);
-//        menu1.setPreferredSize(new Dimension(20, 20));
-//        menu2.setPreferredSize(new Dimension(100, 100));
-//        menu3.setPreferredSize(new Dimension(100, 100));
-//        MenuElement[] path1 = new MenuElement[] {menuBar, menu1, menu2};
-//        MenuElement[] path2 = new MenuElement[] {menu3, menu1, menu2};
-//        MenuElement[] path4 = new MenuElement[] {menu1};
-//        MenuElement[] path5 = new MenuElement[] {menu2};
-//        MenuElement[] path6 = new MenuElement[] {menu3};
-//        frame.pack();
-//        frame.show();
-//        manager.setSelectedPath(path1);
-//        for (int i = 0; i < 100; i++) {
-//            if (manager.componentForPoint(frame, new Point(i, i)) != null) {
-//                System.out.println(manager.componentForPoint(frame, new Point(i, i)));
-//            }
-//        }
-//        menu1.setPopupMenuVisible(true);
-//        manager.setSelectedPath(path1);
-//        for (int i = 0; i < 100; i++) {
-//            if (manager.componentForPoint(frame, new Point(i, i)) != null) {
-//                System.out.println(manager.componentForPoint(frame, new Point(i, i)));
-//            }
-//        }
-//        frame.dispose();
+        //        final JMenuBar menuBar = new JMenuBar();
+        //        final JMenu menu1 = new JMenu();
+        //        final JMenu menu2 = new JMenu();
+        //        final JMenu menu3 = new JMenu();
+        //        JFrame frame = new JFrame();
+        //        frame.getContentPane().add(menuBar);
+        //        menuBar.add(menu1);
+        //        menu1.add(menu2);
+        //        menu2.add(menu3);
+        //        menu1.setPreferredSize(new Dimension(20, 20));
+        //        menu2.setPreferredSize(new Dimension(100, 100));
+        //        menu3.setPreferredSize(new Dimension(100, 100));
+        //        MenuElement[] path1 = new MenuElement[] {menuBar, menu1, menu2};
+        //        MenuElement[] path2 = new MenuElement[] {menu3, menu1, menu2};
+        //        MenuElement[] path4 = new MenuElement[] {menu1};
+        //        MenuElement[] path5 = new MenuElement[] {menu2};
+        //        MenuElement[] path6 = new MenuElement[] {menu3};
+        //        frame.pack();
+        //        frame.show();
+        //        manager.setSelectedPath(path1);
+        //        for (int i = 0; i < 100; i++) {
+        //            if (manager.componentForPoint(frame, new Point(i, i)) != null) {
+        //                System.out.println(manager.componentForPoint(frame, new Point(i, i)));
+        //            }
+        //        }
+        //        menu1.setPopupMenuVisible(true);
+        //        manager.setSelectedPath(path1);
+        //        for (int i = 0; i < 100; i++) {
+        //            if (manager.componentForPoint(frame, new Point(i, i)) != null) {
+        //                System.out.println(manager.componentForPoint(frame, new Point(i, i)));
+        //            }
+        //        }
+        //        frame.dispose();
     }
 
     /*
@@ -236,8 +223,7 @@
      */
     public void testDefaultManager() {
         assertNotNull(MenuSelectionManager.defaultManager());
-        assertSame(MenuSelectionManager.defaultManager(),
-                   MenuSelectionManager.defaultManager());
+        assertSame(MenuSelectionManager.defaultManager(), MenuSelectionManager.defaultManager());
     }
 
     /*
@@ -248,7 +234,6 @@
         ConcreteChangeListener listener2 = new ConcreteChangeListener();
         manager.addChangeListener(listener1);
         manager.addChangeListener(listener2);
-
         manager.fireStateChanged();
         assertNotNull("event fired properly ", listener1.eventHappened);
         assertNotNull("event fired properly ", listener2.eventHappened);
@@ -256,7 +241,6 @@
         ChangeEvent event1 = listener1.eventHappened;
         listener1.eventHappened = null;
         listener2.eventHappened = null;
-
         manager.fireStateChanged();
         assertNotNull("event fired properly ", listener1.eventHappened);
         assertNotNull("event fired properly ", listener2.eventHappened);
@@ -280,45 +264,38 @@
         menu6.add(menu7);
         menu1.add(menu2);
         menu3.add(menu1);
-        MenuElement[] path1 = new MenuElement[] {menu1, menu2, new JMenuItem()};
-        MenuElement[] path2 = new MenuElement[] {menu3, menu1, new JCheckBoxMenuItem()};
-        MenuElement[] path3 = new MenuElement[] {menu4, menu1, new JCheckBoxMenuItem()};
-        MenuElement[] path4 = new MenuElement[] {menu3};
-        MenuElement[] path5 = new MenuElement[] {menu5};
-        MenuElement[] path6 = new MenuElement[] {menu6};
-
+        MenuElement[] path1 = new MenuElement[] { menu1, menu2, new JMenuItem() };
+        MenuElement[] path2 = new MenuElement[] { menu3, menu1, new JCheckBoxMenuItem() };
+        MenuElement[] path3 = new MenuElement[] { menu4, menu1, new JCheckBoxMenuItem() };
+        MenuElement[] path4 = new MenuElement[] { menu3 };
+        MenuElement[] path5 = new MenuElement[] { menu5 };
+        MenuElement[] path6 = new MenuElement[] { menu6 };
         assertFalse(manager.isComponentPartOfCurrentMenu(menu1));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu2));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu3));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu4));
-
         manager.setSelectedPath(path1);
         assertTrue(manager.isComponentPartOfCurrentMenu(menu1));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu2));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu3));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu4));
-
         manager.setSelectedPath(path2);
         assertTrue(manager.isComponentPartOfCurrentMenu(menu1));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu2));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu3));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu4));
-
         manager.setSelectedPath(path3);
         assertFalse(manager.isComponentPartOfCurrentMenu(menu1));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu2));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu3));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu4));
-
         manager.setSelectedPath(path4);
         assertTrue(manager.isComponentPartOfCurrentMenu(menu1));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu2));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu3));
         assertFalse(manager.isComponentPartOfCurrentMenu(menu4));
-
         manager.setSelectedPath(path5);
         assertTrue(manager.isComponentPartOfCurrentMenu(menu5));
-
         manager.setSelectedPath(path6);
         assertTrue(manager.isComponentPartOfCurrentMenu(menu6));
         assertTrue(manager.isComponentPartOfCurrentMenu(menu4));
@@ -331,62 +308,62 @@
      */
     public void testProcessKeyEvent() {
         // TODO implement
-//        ConcreteChangeListener listener1 = new ConcreteChangeListener();
-//        Component c = new ConcreteMenuElement("container", new JMenu());
-//        ConcreteMenuElement element1 = new ConcreteMenuElement("elem1", c);
-//        ConcreteMenuElement element2 = new ConcreteMenuElement("elem2", c);
-//        MenuElement[] path1 = new MenuElement[] {element1};
-//        MenuElement[] path2 = new MenuElement[] {element1, element2};
-//        manager.addChangeListener(listener1);
-//
-//        itemitem.setMnemonic(KeyEvent.VK_A);
-//        itemitem.addActionListener(new ActionListener() {
-//            public void actionPerformed(ActionEvent e) {
-//                System.out.println("Item");
-//            }
-//        });
-//        KeyEvent event = new KeyEvent(itemitem, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_A);
-//        manager.processKeyEvent(event);
-//        manager.setSelectedPath(new MenuElement[] {element1, element2});
-//        manager.processKeyEvent(event);
+        //        ConcreteChangeListener listener1 = new ConcreteChangeListener();
+        //        Component c = new ConcreteMenuElement("container", new JMenu());
+        //        ConcreteMenuElement element1 = new ConcreteMenuElement("elem1", c);
+        //        ConcreteMenuElement element2 = new ConcreteMenuElement("elem2", c);
+        //        MenuElement[] path1 = new MenuElement[] {element1};
+        //        MenuElement[] path2 = new MenuElement[] {element1, element2};
+        //        manager.addChangeListener(listener1);
+        //
+        //        itemitem.setMnemonic(KeyEvent.VK_A);
+        //        itemitem.addActionListener(new ActionListener() {
+        //            public void actionPerformed(ActionEvent e) {
+        //                System.out.println("Item");
+        //            }
+        //        });
+        //        KeyEvent event = new KeyEvent(itemitem, KeyEvent.KEY_PRESSED, EventQueue.getMostRecentEventTime(), 0, KeyEvent.VK_A);
+        //        manager.processKeyEvent(event);
+        //        manager.setSelectedPath(new MenuElement[] {element1, element2});
+        //        manager.processKeyEvent(event);
     }
 
     /*
      * Test method for 'javax.swing.MenuSelectionManager.processMouseEvent(MouseEvent)'
      */
     public void testProcessMouseEvent() {
-//        JMenuItem menuItem = new JMenuItem();
-//        MouseEvent event1 = new MouseEvent(menuItem, MouseEvent.MOUSE_DRAGGED,
-//                                           0, 0, 10, 10, 1, true);
-//        MouseEvent event2 = new MouseEvent(menuItem, MouseEvent.MOUSE_EXITED,
-//                                           0, 0, 10, 10, 1, true);
-//        MouseEvent event3 = new MouseEvent(new JButton(), MouseEvent.MOUSE_ENTERED,
-//                                           0, 0, 10, 10, 1, true);
-//        MouseEvent event4 = new MouseEvent(menuItem, MouseEvent.MOUSE_RELEASED,
-//                                           0, MouseEvent.BUTTON1, 10, 10, 1, false);
-//        ConcreteMenuDragMouseListener listener1 = new ConcreteMenuDragMouseListener();
-//        menuItem.addMenuDragMouseListener(listener1);
-//
-//        manager.setSelectedPath(new MenuElement[] {menuItem});
-//        manager.processMouseEvent(event1);
-//        assertEquals("exited", listener1.event);
-//
-//        manager.processMouseEvent(event1);
-//        assertEquals("dragged", listener1.event);
-//
-//        manager.processMouseEvent(event3);
-//        assertEquals("entered", listener1.event);
-//        listener1.event = null;
-//
-//        manager.processMouseEvent(event4);
-//        assertNull(listener1.event);
-//
-//        manager.processMouseEvent(event1);
-//        assertEquals("dragged", listener1.event);
-//        listener1.event = null;
-//
-//        manager.processMouseEvent(event4);
-//        assertEquals("released", listener1.event);
+        //        JMenuItem menuItem = new JMenuItem();
+        //        MouseEvent event1 = new MouseEvent(menuItem, MouseEvent.MOUSE_DRAGGED,
+        //                                           0, 0, 10, 10, 1, true);
+        //        MouseEvent event2 = new MouseEvent(menuItem, MouseEvent.MOUSE_EXITED,
+        //                                           0, 0, 10, 10, 1, true);
+        //        MouseEvent event3 = new MouseEvent(new JButton(), MouseEvent.MOUSE_ENTERED,
+        //                                           0, 0, 10, 10, 1, true);
+        //        MouseEvent event4 = new MouseEvent(menuItem, MouseEvent.MOUSE_RELEASED,
+        //                                           0, MouseEvent.BUTTON1, 10, 10, 1, false);
+        //        ConcreteMenuDragMouseListener listener1 = new ConcreteMenuDragMouseListener();
+        //        menuItem.addMenuDragMouseListener(listener1);
+        //
+        //        manager.setSelectedPath(new MenuElement[] {menuItem});
+        //        manager.processMouseEvent(event1);
+        //        assertEquals("exited", listener1.event);
+        //
+        //        manager.processMouseEvent(event1);
+        //        assertEquals("dragged", listener1.event);
+        //
+        //        manager.processMouseEvent(event3);
+        //        assertEquals("entered", listener1.event);
+        //        listener1.event = null;
+        //
+        //        manager.processMouseEvent(event4);
+        //        assertNull(listener1.event);
+        //
+        //        manager.processMouseEvent(event1);
+        //        assertEquals("dragged", listener1.event);
+        //        listener1.event = null;
+        //
+        //        manager.processMouseEvent(event4);
+        //        assertEquals("released", listener1.event);
     }
 
     /*
@@ -394,10 +371,10 @@
      */
     public void testSetGetClearSelectedPath() {
         ConcreteChangeListener listener1 = new ConcreteChangeListener();
-        MenuElement[] path1 = new MenuElement[] {new JMenu(), new JMenu(), new JMenuItem()};
-        MenuElement[] path2 = new MenuElement[] {new JMenu(), new JMenu(), new JCheckBoxMenuItem()};
+        MenuElement[] path1 = new MenuElement[] { new JMenu(), new JMenu(), new JMenuItem() };
+        MenuElement[] path2 = new MenuElement[] { new JMenu(), new JMenu(),
+                new JCheckBoxMenuItem() };
         manager.addChangeListener(listener1);
-
         manager.setSelectedPath(path1);
         assertNotSame(path1, manager.getSelectedPath());
         assertEquals(path1.length, manager.getSelectedPath().length);
@@ -408,12 +385,10 @@
         assertSame(manager, listener1.eventHappened.getSource());
         listener1.eventHappened = null;
         assertNotSame(manager.getSelectedPath(), manager.getSelectedPath());
-
         manager.clearSelectedPath();
         assertEquals(0, manager.getSelectedPath().length);
         assertNotNull(listener1.eventHappened);
         assertSame(manager, listener1.eventHappened.getSource());
-
         manager.setSelectedPath(path2);
         assertNotSame(path2, manager.getSelectedPath());
         assertEquals(path2.length, manager.getSelectedPath().length);
@@ -423,7 +398,6 @@
         assertNotNull(listener1.eventHappened);
         assertSame(manager, listener1.eventHappened.getSource());
         listener1.eventHappened = null;
-
         manager.setSelectedPath(path2);
         assertEquals(path2.length, manager.getSelectedPath().length);
         if (!isHarmony()) {
@@ -432,7 +406,6 @@
             assertNull(listener1.eventHappened);
         }
         listener1.eventHappened = null;
-
         manager.setSelectedPath(null);
         assertEquals(0, manager.getSelectedPath().length);
         assertNotNull(listener1.eventHappened);
@@ -443,30 +416,24 @@
         ConcreteChangeListener listener1 = new ConcreteChangeListener();
         ConcreteMenuElement element1 = new ConcreteMenuElement("elem1", null);
         ConcreteMenuElement element2 = new ConcreteMenuElement("elem2", null);
-        MenuElement[] path1 = new MenuElement[] {element1};
-        MenuElement[] path2 = new MenuElement[] {element1, element2};
+        MenuElement[] path1 = new MenuElement[] { element1 };
+        MenuElement[] path2 = new MenuElement[] { element1, element2 };
         manager.addChangeListener(listener1);
-
         manager.setSelectedPath(path1);
         assertTrue(element1.selected);
         assertFalse(element2.selected);
-
         manager.setSelectedPath(path2);
         assertTrue(element1.selected);
         assertTrue(element2.selected);
-
         manager.setSelectedPath(path1);
         assertTrue(element1.selected);
         assertFalse(element2.selected);
-
         manager.clearSelectedPath();
         assertFalse(element1.selected);
         assertFalse(element2.selected);
-
         manager.setSelectedPath(path2);
         assertTrue(element1.selected);
         assertTrue(element2.selected);
-
         manager.clearSelectedPath();
         assertFalse(element1.selected);
         assertFalse(element2.selected);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/OverlayLayoutTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/OverlayLayoutTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/OverlayLayoutTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/OverlayLayoutTest.java Sat Nov 25 16:04:10 2006
@@ -33,11 +33,9 @@
 import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-
 import javax.swing.border.EmptyBorder;
 
 public class OverlayLayoutTest extends SwingTestCase {
-
     protected OverlayLayout layout = null;
 
     public static void main(final String[] args) {
@@ -47,18 +45,15 @@
     public void testOverlayLayout() {
         Container container = new JPanel();
         boolean thrown = false;
-        String text = null;
         try {
-            layout =  new OverlayLayout(container);
+            layout = new OverlayLayout(container);
         } catch (AWTError e) {
             thrown = true;
         }
         assertFalse("No exception thrown", thrown);
-
         thrown = false;
-        text = null;
         try {
-            layout =  new OverlayLayout(null);
+            layout = new OverlayLayout(null);
         } catch (AWTError e) {
             thrown = true;
         }
@@ -74,21 +69,18 @@
         JComponent component2 = new JPanel();
         JComponent component3 = new JPanel();
         JComponent component4 = new JPanel();
-        OverlayLayout layout =  new OverlayLayout(container);
+        OverlayLayout layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
         component1.setMinimumSize(new Dimension(50, 50));
         component2.setMinimumSize(new Dimension(70, 80));
         component3.setMinimumSize(new Dimension(90, 70));
         component4.setMinimumSize(new Dimension(80, 120));
-
         assertEquals("Sizes ", new Dimension(70, 80), layout.minimumLayoutSize(container));
-
         container.add(component3);
         assertEquals("Sizes ", new Dimension(70, 80), layout.minimumLayoutSize(container));
         layout.addLayoutComponent(component3, null);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
-
         container.add(component4);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
         layout.addLayoutComponent(component4, null);
@@ -105,29 +97,26 @@
         component2.setPreferredSize(new Dimension(48, 26));
         component3.setPreferredSize(new Dimension(55, 26));
         component4.setPreferredSize(new Dimension(62, 26));
-
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
-
-        assertEquals("Preferred size: ", new Dimension(48, 26), layout.preferredLayoutSize(container));
-
+        assertEquals("Preferred size: ", new Dimension(48, 26), layout
+                .preferredLayoutSize(container));
         component1.setPreferredSize(new Dimension(50, 50));
         component2.setPreferredSize(new Dimension(70, 120));
         component3.setPreferredSize(new Dimension(90, 150));
         component4.setPreferredSize(new Dimension(80, 90));
-
-        layout =  new OverlayLayout(container);
-        assertEquals("Preferred size: ", new Dimension(70, 120), layout.preferredLayoutSize(container));
-
-        container.add(component3);
-        layout =  new OverlayLayout(container);
-        assertEquals("Preferred size: ", new Dimension(90, 150), layout.preferredLayoutSize(container));
-
-        container.add(component4);
-        layout =  new OverlayLayout(container);
-        assertEquals("Preferred size: ", new Dimension(90, 150), layout.preferredLayoutSize(container));
-
+        layout = new OverlayLayout(container);
+        assertEquals("Preferred size: ", new Dimension(70, 120), layout
+                .preferredLayoutSize(container));
+        container.add(component3);
+        layout = new OverlayLayout(container);
+        assertEquals("Preferred size: ", new Dimension(90, 150), layout
+                .preferredLayoutSize(container));
+        container.add(component4);
+        layout = new OverlayLayout(container);
+        assertEquals("Preferred size: ", new Dimension(90, 150), layout
+                .preferredLayoutSize(container));
         container = new JPanel();
         container.add(component1);
         container.add(component2);
@@ -135,18 +124,18 @@
         component2.setAlignmentY(0.75f);
         component3.setAlignmentX(0.25f);
         component4.setAlignmentY(0.25f);
-
-        layout =  new OverlayLayout(container);
-        assertEquals("Preferred size: ", new Dimension(72, 120), layout.preferredLayoutSize(container));
-
-        container.add(component3);
-        layout =  new OverlayLayout(container);
-        assertEquals("Preferred size: ", new Dimension(105, 165), layout.preferredLayoutSize(container));
-
+        layout = new OverlayLayout(container);
+        assertEquals("Preferred size: ", new Dimension(72, 120), layout
+                .preferredLayoutSize(container));
+        container.add(component3);
+        layout = new OverlayLayout(container);
+        assertEquals("Preferred size: ", new Dimension(105, 165), layout
+                .preferredLayoutSize(container));
         container.add(component4);
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         container.setBorder(new EmptyBorder(20, 20, 20, 20));
-        assertEquals("Preferred size: ", new Dimension(148, 205), layout.preferredLayoutSize(container));
+        assertEquals("Preferred size: ", new Dimension(148, 205), layout
+                .preferredLayoutSize(container));
     }
 
     public void testMinimumLayoutSize() {
@@ -159,28 +148,26 @@
         component2.setMinimumSize(new Dimension(48, 26));
         component3.setMinimumSize(new Dimension(55, 26));
         component4.setMinimumSize(new Dimension(62, 26));
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
-
-        assertEquals("Minimum size: ", new Dimension(48, 26), layout.minimumLayoutSize(container));
-
+        assertEquals("Minimum size: ", new Dimension(48, 26), layout
+                .minimumLayoutSize(container));
         component1.setMinimumSize(new Dimension(50, 50));
         component2.setMinimumSize(new Dimension(70, 120));
         component3.setMinimumSize(new Dimension(90, 150));
         component4.setMinimumSize(new Dimension(80, 90));
-
-        layout =  new OverlayLayout(container);
-        assertEquals("Minimum size: ", new Dimension(70, 120), layout.minimumLayoutSize(container));
-
-        container.add(component3);
-        layout =  new OverlayLayout(container);
-        assertEquals("Minimum size: ", new Dimension(90, 150), layout.minimumLayoutSize(container));
-
-        container.add(component4);
-        layout =  new OverlayLayout(container);
-        assertEquals("Minimum size: ", new Dimension(90, 150), layout.minimumLayoutSize(container));
-
+        layout = new OverlayLayout(container);
+        assertEquals("Minimum size: ", new Dimension(70, 120), layout
+                .minimumLayoutSize(container));
+        container.add(component3);
+        layout = new OverlayLayout(container);
+        assertEquals("Minimum size: ", new Dimension(90, 150), layout
+                .minimumLayoutSize(container));
+        container.add(component4);
+        layout = new OverlayLayout(container);
+        assertEquals("Minimum size: ", new Dimension(90, 150), layout
+                .minimumLayoutSize(container));
         container = new JPanel();
         container.add(component1);
         container.add(component2);
@@ -188,18 +175,18 @@
         component2.setAlignmentY(0.75f);
         component3.setAlignmentX(0.25f);
         component4.setAlignmentY(0.25f);
-
-        layout =  new OverlayLayout(container);
-        assertEquals("Minimum size: ", new Dimension(72, 120), layout.minimumLayoutSize(container));
-
-        container.add(component3);
-        layout =  new OverlayLayout(container);
-        assertEquals("Minimum size: ", new Dimension(105, 165), layout.minimumLayoutSize(container));
-
+        layout = new OverlayLayout(container);
+        assertEquals("Minimum size: ", new Dimension(72, 120), layout
+                .minimumLayoutSize(container));
+        container.add(component3);
+        layout = new OverlayLayout(container);
+        assertEquals("Minimum size: ", new Dimension(105, 165), layout
+                .minimumLayoutSize(container));
         container.add(component4);
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         container.setBorder(new EmptyBorder(20, 20, 20, 20));
-        assertEquals("Minimum size: ", new Dimension(148, 205), layout.minimumLayoutSize(container));
+        assertEquals("Minimum size: ", new Dimension(148, 205), layout
+                .minimumLayoutSize(container));
     }
 
     public void testMaximumLayoutSize() {
@@ -212,29 +199,26 @@
         component2.setMaximumSize(new Dimension(48, 26));
         component3.setMaximumSize(new Dimension(55, 26));
         component4.setMaximumSize(new Dimension(62, 26));
-
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
-
-        assertEquals("Maximum size: ", new Dimension(48, 26), layout.maximumLayoutSize(container));
-
+        assertEquals("Maximum size: ", new Dimension(48, 26), layout
+                .maximumLayoutSize(container));
         component1.setMaximumSize(new Dimension(50, 50));
         component2.setMaximumSize(new Dimension(70, 120));
         component3.setMaximumSize(new Dimension(90, 150));
         component4.setMaximumSize(new Dimension(80, 90));
-
-        layout =  new OverlayLayout(container);
-        assertEquals("Maximum size: ", new Dimension(70, 120), layout.maximumLayoutSize(container));
-
-        container.add(component3);
-        layout =  new OverlayLayout(container);
-        assertEquals("Maximum size: ", new Dimension(90, 150), layout.maximumLayoutSize(container));
-
-        container.add(component4);
-        layout =  new OverlayLayout(container);
-        assertEquals("Maximum size: ", new Dimension(90, 150), layout.maximumLayoutSize(container));
-
+        layout = new OverlayLayout(container);
+        assertEquals("Maximum size: ", new Dimension(70, 120), layout
+                .maximumLayoutSize(container));
+        container.add(component3);
+        layout = new OverlayLayout(container);
+        assertEquals("Maximum size: ", new Dimension(90, 150), layout
+                .maximumLayoutSize(container));
+        container.add(component4);
+        layout = new OverlayLayout(container);
+        assertEquals("Maximum size: ", new Dimension(90, 150), layout
+                .maximumLayoutSize(container));
         container = new JPanel();
         container.add(component1);
         container.add(component2);
@@ -242,18 +226,18 @@
         component2.setAlignmentY(0.75f);
         component3.setAlignmentX(0.25f);
         component4.setAlignmentY(0.25f);
-
-        layout =  new OverlayLayout(container);
-        assertEquals("Maximum size: ", new Dimension(72, 120), layout.maximumLayoutSize(container));
-
-        container.add(component3);
-        layout =  new OverlayLayout(container);
-        assertEquals("Maximum size: ", new Dimension(105, 165), layout.maximumLayoutSize(container));
-
+        layout = new OverlayLayout(container);
+        assertEquals("Maximum size: ", new Dimension(72, 120), layout
+                .maximumLayoutSize(container));
+        container.add(component3);
+        layout = new OverlayLayout(container);
+        assertEquals("Maximum size: ", new Dimension(105, 165), layout
+                .maximumLayoutSize(container));
         container.add(component4);
         container.setBorder(new EmptyBorder(20, 20, 20, 20));
-        layout =  new OverlayLayout(container);
-        assertEquals("Maximum size: ", new Dimension(148, 205), layout.maximumLayoutSize(container));
+        layout = new OverlayLayout(container);
+        assertEquals("Maximum size: ", new Dimension(148, 205), layout
+                .maximumLayoutSize(container));
     }
 
     /*
@@ -277,21 +261,18 @@
         component2.setMaximumSize(new Dimension(34, 26));
         component3.setMaximumSize(new Dimension(34, 26));
         component4.setMaximumSize(new Dimension(34, 26));
-        OverlayLayout layout =  new OverlayLayout(container);
+        OverlayLayout layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
         component1.setMinimumSize(new Dimension(50, 50));
         component2.setMinimumSize(new Dimension(70, 80));
         component3.setMinimumSize(new Dimension(90, 70));
         component4.setMinimumSize(new Dimension(80, 120));
-
         assertEquals("Sizes ", new Dimension(70, 80), layout.minimumLayoutSize(container));
-
         container.add(component3);
         assertEquals("Sizes ", new Dimension(70, 80), layout.minimumLayoutSize(container));
         layout.addLayoutComponent("name", component3);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
-
         container.add(component4);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
         layout.addLayoutComponent("name", component4);
@@ -316,32 +297,30 @@
         component3.setMaximumSize(new Dimension(48, 26));
         component2.setMaximumSize(new Dimension(55, 26));
         component1.setMaximumSize(new Dimension(62, 26));
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         container.setLayout(layout);
         container.setBorder(new EmptyBorder(20, 20, 20, 20));
         container.add(component1);
         container.add(component2);
         container.add(component3);
         container.add(component4);
-
         component1.setAlignmentX(0);
         component2.setAlignmentX(0.2f);
         component3.setAlignmentX(0.3f);
         component4.setAlignmentX(1);
-
         component1.setAlignmentY(0);
         component2.setAlignmentY(0.2f);
         component3.setAlignmentY(0.3f);
         component4.setAlignmentY(1);
-
         JDialog window = new JDialog();
         window.getContentPane().add(container);
         window.pack();
-
-        assertEquals("Container's minimum requirements", new Dimension(143, 92), layout.minimumLayoutSize(container));
-        assertEquals("Container's preferred requirements", new Dimension(143, 92), layout.preferredLayoutSize(container));
-        assertEquals("Container's maximum requirements", new Dimension(143, 92), layout.maximumLayoutSize(container));
-
+        assertEquals("Container's minimum requirements", new Dimension(143, 92), layout
+                .minimumLayoutSize(container));
+        assertEquals("Container's preferred requirements", new Dimension(143, 92), layout
+                .preferredLayoutSize(container));
+        assertEquals("Container's maximum requirements", new Dimension(143, 92), layout
+                .maximumLayoutSize(container));
         assertEquals("Component1 location ", new Point(61, 46), component1.getLocation());
         assertEquals("Component2 location ", new Point(50, 41), component2.getLocation());
         assertEquals("Component3 location ", new Point(47, 39), component3.getLocation());
@@ -364,7 +343,6 @@
         panel2.setMinimumSize(new Dimension(100, 100));
         panel3.setMinimumSize(new Dimension(100, 100));
         panel.setPreferredSize(new Dimension(300, 300));
-
         panel.setLayout(new OverlayLayout(panel));
         panel1.setAlignmentX(1.0f);
         panel2.setAlignmentX(0.3f);
@@ -378,7 +356,6 @@
         window.setSize(150, 150);
         window.getContentPane().add(panel);
         window.show();
-
         assertEquals("component's location ", new Point(0, 0), panel1.getLocation());
         assertEquals("component's location ", new Point(45, 45), panel2.getLocation());
         assertEquals("component's location ", new Point(75, 75), panel3.getLocation());
@@ -390,20 +367,17 @@
         JComponent component2 = new JPanel();
         JComponent component3 = new JPanel();
         JComponent component4 = new JPanel();
-        OverlayLayout layout =  new OverlayLayout(container);
+        OverlayLayout layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
         component1.setMinimumSize(new Dimension(50, 50));
         component2.setMinimumSize(new Dimension(70, 80));
         component3.setMinimumSize(new Dimension(90, 70));
         component4.setMinimumSize(new Dimension(80, 120));
-
         assertEquals("Sizes ", new Dimension(70, 80), layout.minimumLayoutSize(container));
-
         container.add(component3);
         layout.invalidateLayout(container);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
-
         container.add(component4);
         layout.invalidateLayout(container);
         assertEquals("Sizes ", new Dimension(90, 120), layout.minimumLayoutSize(container));
@@ -427,28 +401,23 @@
         component2.setMaximumSize(new Dimension(10, 10));
         component3.setMaximumSize(new Dimension(10, 10));
         component4.setMaximumSize(new Dimension(10, 10));
-
-        OverlayLayout layout =  new OverlayLayout(container);
+        OverlayLayout layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
         float value1 = 0.02f;
         float value2 = 0.47f;
         float value3 = 0.51f;
         float value4 = 0.94f;
-        float defaultValue = 0.5f;
         component1.setAlignmentY(value1);
         component2.setAlignmentY(value2);
         component3.setAlignmentY(value3);
         component4.setAlignmentY(value4);
-
         assertEquals("Alignment ", 0.2857143f, layout.getLayoutAlignmentY(container), 1e-5f);
-
         container.add(component3);
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         assertEquals("Alignment ", 0.333333f, layout.getLayoutAlignmentY(container), 1e-5f);
-
         container.add(component4);
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         assertEquals("Alignment ", 0.4736842f, layout.getLayoutAlignmentY(container), 1e-5f);
     }
 
@@ -470,27 +439,23 @@
         component2.setMaximumSize(new Dimension(34, 26));
         component3.setMaximumSize(new Dimension(34, 26));
         component4.setMaximumSize(new Dimension(34, 26));
-        OverlayLayout layout =  new OverlayLayout(container);
+        OverlayLayout layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
         float value1 = 0.02f;
         float value2 = 0.47f;
         float value3 = 0.51f;
         float value4 = 0.94f;
-        float defaultValue = 0.5f;
         component1.setAlignmentX(value1);
         component2.setAlignmentX(value2);
         component3.setAlignmentX(value3);
         component4.setAlignmentX(value4);
-
         assertEquals("Alignment ", 0.306122f, layout.getLayoutAlignmentX(container), 1e-5f);
-
         container.add(component3);
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         assertEquals("Alignment ", 0.333333f, layout.getLayoutAlignmentX(container), 1e-5f);
-
         container.add(component4);
-        layout =  new OverlayLayout(container);
+        layout = new OverlayLayout(container);
         assertEquals("Alignment ", 0.4769230f, layout.getLayoutAlignmentX(container), 1e-5f);
     }
 
@@ -500,7 +465,7 @@
         JComponent component2 = new JPanel();
         JComponent component3 = new JPanel();
         JComponent component4 = new JPanel();
-        OverlayLayout layout =  new OverlayLayout(container);
+        OverlayLayout layout = new OverlayLayout(container);
         container.add(component1);
         container.add(component2);
         container.add(component3);
@@ -509,20 +474,15 @@
         component2.setMinimumSize(new Dimension(70, 80));
         component3.setMinimumSize(new Dimension(90, 70));
         component4.setMinimumSize(new Dimension(80, 120));
-
         assertEquals("Sizes ", new Dimension(90, 120), layout.minimumLayoutSize(container));
-
         container.remove(component4);
         assertEquals("Sizes ", new Dimension(90, 120), layout.minimumLayoutSize(container));
-
         container.add(component4);
         layout.removeLayoutComponent(component4);
         container.remove(component4);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
-
         container.remove(component3);
         assertEquals("Sizes ", new Dimension(90, 80), layout.minimumLayoutSize(container));
-
         container.add(component3);
         layout.removeLayoutComponent(component3);
         container.remove(component3);
@@ -532,8 +492,7 @@
     // Layout sharing testcases and so on
     public void testSharingLayout() {
         Container container = new JPanel();
-        layout =  new OverlayLayout(container);
-
+        layout = new OverlayLayout(container);
         boolean thrown = false;
         String text = null;
         try {
@@ -544,7 +503,6 @@
         }
         assertTrue("AWTError exception thrown", thrown);
         assertEquals(text, "OverlayLayout can't be shared");
-
         thrown = false;
         text = null;
         try {
@@ -555,7 +513,6 @@
         }
         assertTrue("AWTError exception thrown", thrown);
         assertEquals(text, "OverlayLayout can't be shared");
-
         thrown = false;
         text = null;
         try {
@@ -566,7 +523,6 @@
         }
         assertTrue("AWTError exception thrown", thrown);
         assertEquals(text, "OverlayLayout can't be shared");
-
         thrown = false;
         text = null;
         try {
@@ -577,7 +533,6 @@
         }
         assertTrue("AWTError exception thrown", thrown);
         assertEquals(text, "OverlayLayout can't be shared");
-
         thrown = false;
         text = null;
         try {
@@ -588,7 +543,6 @@
         }
         assertTrue("AWTError exception thrown", thrown);
         assertEquals(text, "OverlayLayout can't be shared");
-
         thrown = false;
         text = null;
         try {
@@ -599,7 +553,6 @@
         }
         assertTrue("AWTError exception thrown", thrown);
         assertEquals(text, "OverlayLayout can't be shared");
-
         thrown = false;
         text = null;
         try {
@@ -614,7 +567,7 @@
 
     public void testWriteObject() throws IOException {
         Container container = new JPanel();
-        OverlayLayout layout1 =  new OverlayLayout(container);
+        OverlayLayout layout1 = new OverlayLayout(container);
         ByteArrayOutputStream fo = new ByteArrayOutputStream();
         ObjectOutputStream so = new ObjectOutputStream(fo);
         so.writeObject(layout1);
@@ -623,13 +576,13 @@
 
     public void testReadObject() throws ClassNotFoundException, IOException {
         Container container = new Panel();
-        OverlayLayout layout1 =  new OverlayLayout(container);
+        OverlayLayout layout1 = new OverlayLayout(container);
         ByteArrayOutputStream fo = new ByteArrayOutputStream();
         ObjectOutputStream so = new ObjectOutputStream(fo);
         so.writeObject(layout1);
         so.flush();
         InputStream fi = new ByteArrayInputStream(fo.toByteArray());
         ObjectInputStream si = new ObjectInputStream(fi);
-        OverlayLayout resurrectedLayout = (OverlayLayout)si.readObject();
+        OverlayLayout resurrectedLayout = (OverlayLayout) si.readObject();
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryRTest.java Sat Nov 25 16:04:10 2006
@@ -30,7 +30,6 @@
         p1.show();
         p1.hide();
         p1.hide();
-
         Popup p11 = PopupFactory.getSharedInstance().getPopup(null, new JPanel(), 20, 20);
         Popup p12 = PopupFactory.getSharedInstance().getPopup(null, new JPanel(), 20, 20);
         if (isHarmony()) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupFactoryTest.java Sat Nov 25 16:04:10 2006
@@ -29,12 +29,11 @@
 
     public void testGetSetSharedInstance() throws Exception {
         assertNotNull(PopupFactory.getSharedInstance());
-
         PopupFactory factory = new PopupFactory();
         PopupFactory.setSharedInstance(factory);
         assertSame(factory, PopupFactory.getSharedInstance());
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 PopupFactory.setSharedInstance(null);
             }
@@ -45,19 +44,15 @@
         JButton content1 = new JButton();
         Popup p1 = PopupFactory.getSharedInstance().getPopup(null, content1, 10, 10);
         p1.show();
-
         Window w1 = SwingUtilities.getWindowAncestor(content1);
         assertNotNull(w1);
         assertTrue(w1.isVisible());
-
         p1.hide();
         assertFalse(w1.isVisible());
-
         Popup p11 = PopupFactory.getSharedInstance().getPopup(null, content1, 10, 10);
         if (isHarmony()) {
             assertSame(p1, p11);
         }
-
         JFrame frame = new JFrame();
         JButton content2 = new JButton();
         frame.getContentPane().add(content1);
@@ -66,10 +61,8 @@
         p2.show();
         Window w2 = SwingUtilities.getWindowAncestor(content2);
         assertTrue(w2.isVisible());
-
         frame.setVisible(false);
         assertFalse(w2.isVisible());
-
         if (isHarmony()) {
             frame.dispose();
             Popup p21 = PopupFactory.getSharedInstance().getPopup(frame, content2, 10, 10);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/PopupTest.java Sat Nov 25 16:04:10 2006
@@ -30,6 +30,7 @@
         super(name);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         popup = null;
     }
@@ -37,19 +38,16 @@
     public void testPopup() throws Exception {
         Component content = new JButton("content");
         assertNull(content.getParent());
-
         popup = new Popup(null, content, 10, 10);
         assertNotNull(content.getParent());
         assertFalse(content.isShowing());
         popup.show();
         assertTrue(content.isShowing());
         assertEquals(new Point(10, 10), content.getLocationOnScreen());
-
         popup.show();
         assertTrue(content.isShowing());
         popup.hide();
         assertFalse(content.isShowing());
-
         JPanel owner = new JPanel();
         popup = new Popup(owner, content, 10, 10);
         assertNotNull(content.getParent());
@@ -57,18 +55,16 @@
         popup.show();
         assertTrue(content.isShowing());
         assertEquals(new Point(10, 10), content.getLocationOnScreen());
-
         JFrame ownedFrame = new JFrame();
         ownedFrame.setLocation(100, 100);
         ownedFrame.getContentPane().add(owner);
         ownedFrame.setVisible(true);
         SwingWaitTestCase.isRealized(ownedFrame);
-        
         popup = new Popup(owner, content, 10, 10);
         popup.show();
         assertEquals(new Point(10, 10), content.getLocationOnScreen());
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 new Popup(null, null, 10, 10);
             }
@@ -83,10 +79,8 @@
         popup.show();
         assertTrue(content.isShowing());
         assertEquals(new Point(100, 200), content.getLocationOnScreen());
-
         popup.hide();
         assertNull(SwingUtilities.getWindowAncestor(content));
         assertFalse(content.isShowing());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorInputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorInputStreamTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorInputStreamTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorInputStreamTest.java Sat Nov 25 16:04:10 2006
@@ -29,8 +29,11 @@
 
 public class ProgressMonitorInputStreamTest extends BasicSwingTestCase {
     private JFrame window;
+
     private ProgressMonitorInputStream in;
+
     private ByteArrayInputStream realIn;
+
     private byte[] bytes;
 
     private static class ErrorStream extends FilterInputStream {
@@ -38,21 +41,24 @@
             super(in);
         }
 
+        @Override
         public int available() throws IOException {
             throw new IOException();
         }
     }
 
+    @Override
     public void setUp() {
         window = new JFrame();
         int l = 300;
         bytes = new byte[l];
         for (int i = 0; i < l; i++) {
-            bytes[i] = (byte)i;
+            bytes[i] = (byte) i;
         }
         realIn = new ByteArrayInputStream(bytes);
     }
 
+    @Override
     public void tearDown() {
         in = null;
         realIn = null;
@@ -63,7 +69,6 @@
     public void testProgressMonitorInputStream() throws Exception {
         in = new ProgressMonitorInputStream(window, "Here we go...", realIn);
         assertNotNull(in.getProgressMonitor());
-
         in.read();
         Thread.sleep(600);
         in.skip(30);
@@ -74,50 +79,45 @@
     public void testMaximum() throws Exception {
         in = new ProgressMonitorInputStream(window, "Here we go...", new ErrorStream(realIn));
         assertEquals(0, in.getProgressMonitor().getMaximum());
-
         in.read();
         Thread.sleep(600);
         in.skip(30);
         Thread.sleep(600);
-
         assertEquals(0, window.getOwnedWindows().length);
-
         in.close();
     }
 
     public void testReset() throws Exception {
         in = new ProgressMonitorInputStream(window, "Here we go...", realIn);
-
         ProgressMonitor pm = in.getProgressMonitor();
         in.read();
         Thread.sleep(600);
         in.skip(30);
         in.reset();
         assertSame(pm, in.getProgressMonitor());
-
         in.close();
     }
 
     public void testInterrupted() throws Exception {
         in = new ProgressMonitorInputStream(window, "Here we go...", realIn);
-
         in.read();
         Thread.sleep(600);
         in.skip(30);
-
-        JDialog dialog = (JDialog)window.getOwnedWindows()[0];
+        JDialog dialog = (JDialog) window.getOwnedWindows()[0];
         dialog.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
         in.reset();
         in.skip(30);
         testExceptionalCase(new ExceptionalCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 in.read();
             }
+
+            @Override
             public Class expectedExceptionClass() {
                 return InterruptedIOException.class;
             }
         });
-
         Thread.sleep(600);
         in.close();
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/ProgressMonitorTest.java Sat Nov 25 16:04:10 2006
@@ -24,13 +24,16 @@
 
 public class ProgressMonitorTest extends BasicSwingTestCase {
     private ProgressMonitor progressMonitor;
+
     private JFrame window;
 
+    @Override
     public void setUp() throws Exception {
         super.setUp();
         window = new JFrame();
     }
 
+    @Override
     public void tearDown() throws Exception {
         progressMonitor = null;
         window = null;
@@ -45,26 +48,21 @@
 
     public void testSetProgress() throws Exception {
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 100);
-
         assertEquals(0, window.getOwnedWindows().length);
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(2);
         assertEquals(1, window.getOwnedWindows().length);
-
         JProgressBar pb = getProgressBar();
         assertEquals(2, pb.getValue());
         progressMonitor.close();
-
         progressMonitor = new ProgressMonitor(window, "message test", "note test", -100, 100);
         assertEquals(1, window.getOwnedWindows().length);
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(2);
         assertEquals(1, window.getOwnedWindows().length);
-
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 300);
-
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(2);
@@ -73,11 +71,9 @@
 
     public void testGetSetMaximum() throws Exception {
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 300);
-
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(20);
-
         assertEquals(300, getProgressBar().getMaximum());
         progressMonitor.setMaximum(500);
         if (isHarmony()) {
@@ -88,11 +84,9 @@
 
     public void testGetSetMinimum() throws Exception {
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 300);
-
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(20);
-
         assertEquals(0, getProgressBar().getMinimum());
         progressMonitor.setMinimum(-100);
         if (isHarmony()) {
@@ -103,25 +97,20 @@
 
     public void testIsCancelled() throws Exception {
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 100);
-
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(20);
-
-        JDialog dialog = (JDialog)window.getOwnedWindows()[0];
-        JOptionPane comp = (JOptionPane)dialog.getContentPane().getComponent(0);
-        JPanel bottomPanel = (JPanel)comp.getComponent(1);
-        JButton cancelButton = (JButton)bottomPanel.getComponent(0);
+        JDialog dialog = (JDialog) window.getOwnedWindows()[0];
+        JOptionPane comp = (JOptionPane) dialog.getContentPane().getComponent(0);
+        JPanel bottomPanel = (JPanel) comp.getComponent(1);
+        JButton cancelButton = (JButton) bottomPanel.getComponent(0);
         cancelButton.doClick();
         assertTrue(progressMonitor.isCanceled());
-
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 100);
-
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(20);
-
-        dialog = (JDialog)window.getOwnedWindows()[1];
+        dialog = (JDialog) window.getOwnedWindows()[1];
         dialog.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
         assertTrue(progressMonitor.isCanceled());
         progressMonitor.setProgress(98);
@@ -130,28 +119,25 @@
 
     public void testClose() throws Exception {
         progressMonitor = new ProgressMonitor(window, "message test", "note test", 0, 100);
-
         progressMonitor.setProgress(1);
         Thread.sleep(500 + 100);
         progressMonitor.setProgress(20);
-
         progressMonitor.close();
         assertEquals(1, window.getOwnedWindows().length);
         assertFalse(window.getOwnedWindows()[0].isVisible());
         assertFalse(window.getOwnedWindows()[0].isDisplayable());
-
         progressMonitor.setProgress(25);
         assertEquals(2, window.getOwnedWindows().length);
         assertTrue(window.getOwnedWindows()[1].isVisible());
     }
 
     private JProgressBar getProgressBar() {
-        JDialog dialog = (JDialog)window.getOwnedWindows()[0];
-        JOptionPane comp = (JOptionPane)dialog.getContentPane().getComponent(0);
-        JPanel topPanel = (JPanel)comp.getComponent(0);
-        JPanel panel = (JPanel)topPanel.getComponent(0);
-        JPanel panel2 = (JPanel)panel.getComponent(1);
-        JProgressBar pb = (JProgressBar)panel2.getComponent(2);
+        JDialog dialog = (JDialog) window.getOwnedWindows()[0];
+        JOptionPane comp = (JOptionPane) dialog.getContentPane().getComponent(0);
+        JPanel topPanel = (JPanel) comp.getComponent(0);
+        JPanel panel = (JPanel) topPanel.getComponent(0);
+        JPanel panel2 = (JPanel) panel.getComponent(1);
+        JProgressBar pb = (JProgressBar) panel2.getComponent(2);
         return pb;
     }
 }



Mime
View raw message