harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r495927 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java test/api/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePaneTest.java
Date Sat, 13 Jan 2007 17:13:21 GMT
Author: hindessm
Date: Sat Jan 13 09:13:20 2007
New Revision: 495927

URL: http://svn.apache.org/viewvc?view=rev&rev=495927
Log:
Applied patches from:

  [#HARMONY-2588] [classlib][swing] javax.swing.plaf.basic.
    BasicInternalFrameTitlePane.SizeAction.getKeys() returns empty array

  [#HARMONY-2604] [classlib][swing] javax.swing.plaf.basic.
    BasicInternalFrameTitlePane.SizeAction.actionPerformed(null) throws NPE

  [#HARMONY-2608] [classlib][swing] javax.swing.plaf.basic.
    BasicInternalFrameTitlePane.MoveAction has inconsistencies with RI

and common regression test patch.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePaneTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java?view=diff&rev=495927&r1=495926&r2=495927
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
Sat Jan 13 09:13:20 2007
@@ -140,14 +140,33 @@
     }
 
     public class MoveAction extends AbstractAction {
+        private static final String MOVE_ACTION_NAME = "Move";
+        
+        public MoveAction() {
+            putValue(Action.NAME, MOVE_ACTION_NAME);
+        }
+        
         public void actionPerformed(final ActionEvent e) {
+            if (e == null) {
+                return;
+            }
+            
             ((BasicDesktopPaneUI)frame.getDesktopPane().getUI()).
                 frameOperation = BasicDesktopPaneUI.DRAGGING;
         }
     }
 
     public class SizeAction extends AbstractAction {
+        private static final String SIZE_ACTION_NAME = "Size";
+        
+        public SizeAction() {
+            putValue(Action.NAME, SIZE_ACTION_NAME);
+        }
+        
         public void actionPerformed(final ActionEvent e) {
+            if (e == null) {
+                return;
+            }
             ((BasicDesktopPaneUI)frame.getDesktopPane().getUI()).
                 frameOperation = BasicDesktopPaneUI.RESIZING;
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePaneTest.java?view=diff&rev=495927&r1=495926&r2=495927
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePaneTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicInternalFrameTitlePaneTest.java
Sat Jan 13 09:13:20 2007
@@ -27,6 +27,8 @@
 import java.awt.Rectangle;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyVetoException;
+
+import javax.swing.Action;
 import javax.swing.JDesktopPane;
 import javax.swing.JFrame;
 import javax.swing.JInternalFrame;
@@ -37,6 +39,7 @@
 import javax.swing.UIManager;
 import javax.swing.event.InternalFrameAdapter;
 import javax.swing.event.InternalFrameEvent;
+import javax.swing.plaf.metal.MetalInternalFrameTitlePane;
 
 public class BasicInternalFrameTitlePaneTest extends SwingTestCase {
     private BasicInternalFrameTitlePane pane;
@@ -540,4 +543,56 @@
     public void testPaintComponent() {
         // Note: painting code, cannot test
     }
+    
+    /**
+     * Regression test for HARMONY-2608
+     * */
+    public void testMoveActionKey() {
+        BasicInternalFrameTitlePane.MoveAction m = pane.new MoveAction();
+        assertEquals(1, m.getKeys().length);
+        String key = (String)m.getKeys()[0];
+        assertEquals(Action.NAME, key);
+        assertEquals("Move", m.getValue(key));
+    }
+    
+    /**
+     * Regression test for HARMONY-2608
+     * */
+    public void testMoveActionPerformed() {
+        BasicInternalFrameTitlePane.MoveAction m = pane.new MoveAction();
+        try {
+            m.actionPerformed(null);
+        } catch ( NullPointerException e) { 
+            fail("NPE shouldn't be thrown");
+        }
+    }
+    
+    /**
+     * Regression test for HARMONY-2604
+     * */
+    public void testSizeActionPerformed() {
+        String str = "test string";
+        JInternalFrame jf = new JInternalFrame(str);
+        MetalInternalFrameTitlePane jp = new MetalInternalFrameTitlePane(jf);
+        BasicInternalFrameTitlePane.SizeAction m = jp.new SizeAction();
+        try {
+            m.actionPerformed(null);
+        } catch (NullPointerException e) {
+            fail("NPE shouldn't be thrown");
+        }
+    }
+    
+    /**
+     * Regression test for HARMONY-2588
+     * */
+    public void testSizeActionKey() {
+        String str = "test string";
+        JInternalFrame jf = new JInternalFrame(str);
+        MetalInternalFrameTitlePane jp = new MetalInternalFrameTitlePane(jf);
+        BasicInternalFrameTitlePane.SizeAction m = jp.new SizeAction();
+        assertEquals(1, m.getKeys().length);
+        String key = (String)m.getKeys()[0];
+        assertEquals(Action.NAME, key);
+        assertEquals("Size", m.getValue(key));
+   } 
 }



Mime
View raw message