harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r502613 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/plaf/basic/BasicMenuUI.java test/api/java/common/javax/swing/plaf/basic/BasicMenuUITest.java
Date Fri, 02 Feb 2007 14:34:02 GMT
Author: ayza
Date: Fri Feb  2 06:34:01 2007
New Revision: 502613

URL: http://svn.apache.org/viewvc?view=rev&rev=502613
Log:
Committing patches from HARMONY-2663 ([classlib][swing] javax.swing.plaf.basic.BasicMenuUI
is inconsistent with RI)

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

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuUI.java?view=diff&rev=502613&r1=502612&r2=502613
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicMenuUI.java
Fri Feb  2 06:34:01 2007
@@ -219,7 +219,7 @@
     }
 
     protected MenuListener createMenuListener(final JComponent c) {
-        return (menuHandler == null) ? new MenuHandler() : menuHandler;
+        return menuHandler;
     }
 
     protected PropertyChangeListener createPropertyChangeListener(final JComponent c) {
@@ -247,7 +247,7 @@
     }
 
     public Dimension getMaximumSize(final JComponent c) {
-        if (!((JMenu)c).isTopLevelMenu()) {
+        if (!((JMenu) menuItem).isTopLevelMenu()) {
             return super.getMaximumSize(c);
         }
         Dimension result = c.getPreferredSize();
@@ -324,4 +324,4 @@
     boolean isPaintArmed() {
         return menuItem.isArmed() || menuItem.isSelected();
     }
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicMenuUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicMenuUITest.java?view=diff&rev=502613&r1=502612&r2=502613
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicMenuUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicMenuUITest.java
Fri Feb  2 06:34:01 2007
@@ -30,6 +30,7 @@
 import javax.swing.ImageIcon;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
+import javax.swing.JOptionPane;
 import javax.swing.SwingTestCase;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
@@ -77,6 +78,18 @@
         menu1.setPreferredSize(new Dimension(1000, 1000));
         assertEquals(1000, menuUI.getMaximumSize(menu1).width);
         assertEquals(Short.MAX_VALUE, menuUI.getMaximumSize(menu1).height);
+        testExceptionalCase(new NullPointerCase() {
+            @Override
+            public void exceptionalAction() throws Exception {
+                new BasicMenuUI().getMaximumSize(null);
+            }
+        });
+        testExceptionalCase(new NullPointerCase() {
+            @Override // Regression for HARMONY-2663
+            public void exceptionalAction() throws Exception {
+                new BasicMenuUI().getMaximumSize(new JOptionPane());
+            }
+        });
     }
 
     /*
@@ -178,9 +191,7 @@
         menuUI.menuItem = menu;
         menuUI.installListeners();
         assertNull(menuUI.changeListener);
-        if (isHarmony()) {
-            assertNotNull(menuUI.menuListener);
-        }
+        assertNull(menuUI.menuListener);
         assertNotNull(menuUI.propertyChangeListener);
         assertNotNull(menuUI.mouseInputListener);
         if (!isHarmony()) {
@@ -284,8 +295,9 @@
         if (!isHarmony()) {
             return;
         }
-        assertNotNull(menuUI.createMenuListener(null));
-        assertNotNull(menuUI.createMenuListener(new JMenu()));
+        // Updated for regression of HARMONY-2663
+        assertNull(menuUI.createMenuListener(null));
+        assertNull(menuUI.createMenuListener(new JMenu()));
     }
 
     /*



Mime
View raw message