harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r513642 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/java/awt/Window.java test/api/java/common/java/awt/WindowTest.java
Date Fri, 02 Mar 2007 07:28:13 GMT
Author: apetrenko
Date: Thu Mar  1 23:28:13 2007
New Revision: 513642

URL: http://svn.apache.org/viewvc?view=rev&rev=513642
Log:
Patch for HARMONY-3204 "[awt] Window.pack() throws NPE if the font of nested components is
not set"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/WindowTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java?view=diff&rev=513642&r1=513641&r2=513642
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Window.java
Thu Mar  1 23:28:13 2007
@@ -691,6 +691,10 @@
     public void pack() {
         toolkit.lockAWT();
         try {
+            if (getFont() == null) {
+                setFont(Font.DEFAULT_FONT);
+            }
+            
             if ((parent != null) && !parent.isDisplayable()) {
                 parent.mapToDisplay(true);
             }

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/WindowTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/WindowTest.java?view=diff&rev=513642&r1=513641&r2=513642
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/WindowTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/WindowTest.java
Thu Mar  1 23:28:13 2007
@@ -178,5 +178,19 @@
         // regression test for Harmony-1605
         assertEquals(null, w.getFont());
     }
-    
+
+    public void testPack() {
+        final Button b = new Button();
+
+        assertNull(b.getFont());
+        f.add(b);
+        assertNull(b.getFont());
+        assertFalse(b.isDisplayable());
+        f.pack();
+        assertTrue(f.isDisplayable());
+        assertTrue(b.isDisplayable());
+        assertNotNull(b.getFont());
+        assertNotNull(f.getFont());
+        f.dispose();
+    }
 }



Mime
View raw message