harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r507389 - in /harmony/enhanced/classlib/trunk/modules/awt: make/ src/main/java/common/java/awt/ src/test/api/java/common/java/awt/
Date Wed, 14 Feb 2007 04:57:49 GMT
Author: smishura
Date: Tue Feb 13 20:57:49 2007
New Revision: 507389

URL: http://svn.apache.org/viewvc?view=rev&rev=507389
Log:
Rollback commit r507046:
Patch for HARMONY-1605 "[classlib][awt]Compatibility: java.awt.Window has null default Font
on RI while it hasn't on Harmony"
ComponentTest removed from exclude list.

It causes regression on Linux - will reopen the JIRA issue. Also it is not clear (at least
for me) from comments for HARMONY-1605 why ComponentTest should be removed from the exclude
list

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/make/exclude.common
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java
    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/ComponentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/make/exclude.common?view=diff&rev=507389&r1=507388&r2=507389
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/make/exclude.common (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/make/exclude.common Tue Feb 13 20:57:49 2007
@@ -19,6 +19,7 @@
 java/awt/ButtonRTest.java
 java/awt/CardLayoutTest.java
 java/awt/ChoiceTest.java
+java/awt/ComponentTest.java
 java/awt/ContainerOrderFocusTraversalPolicyTest.java
 java/awt/DialogRTest.java
 java/awt/ListTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java?view=diff&rev=507389&r1=507388&r2=507389
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Button.java
Tue Feb 13 20:57:49 2007
@@ -186,6 +186,11 @@
         }
     }
 
+    @Override
+    boolean hasDefaultFont() {
+        return true;
+    }
+
     public String getLabel() {
         toolkit.lockAWT();
         try {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java?view=diff&rev=507389&r1=507388&r2=507389
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Component.java
Tue Feb 13 20:57:49 2007
@@ -2960,12 +2960,17 @@
     public Font getFont() {
         toolkit.lockAWT();
         try {
-            return (font == null) && (parent != null) ? parent.getFont() : font;
+            if (font == null && hasDefaultFont()) {
+                return toolkit.getDefaultFont();
+            }
+            if (font == null && parent != null) {
+                return parent.getFont();
+            }
+            return font;
         } finally {
             toolkit.unlockAWT();
         }
     }
-    
 
     public void setFont(Font f) {
         Font oldFont;
@@ -2987,6 +2992,9 @@
         }
     }
 
+    boolean hasDefaultFont() {
+        return false;
+    }
 
     /**
      * Invalidate the component if it inherits the font from the parent. This

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java?view=diff&rev=507389&r1=507388&r2=507389
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Font.java Tue
Feb 13 20:57:49 2007
@@ -75,8 +75,6 @@
     public static final int LAYOUT_NO_START_CONTEXT = 2;
 
     public static final int LAYOUT_NO_LIMIT_CONTEXT = 4;
-    
-    static final Font DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$
 
     protected String name;
 
@@ -355,17 +353,17 @@
         // as the delimiter to avoid unexpected parse results of font face names 
         // with spaces.
         
-        if (str == null) {
-            return DEFAULT_FONT;
-        }
-        
         StringTokenizer strTokens;
         String delim = "-"; //$NON-NLS-1$
         String substr;
 
-        int fontSize = DEFAULT_FONT.size;
-        int fontStyle = DEFAULT_FONT.style;
-        String fontName = DEFAULT_FONT.name;
+        int fontSize = 12;
+        int fontStyle = Font.PLAIN;
+        String fontName = "dialog"; //$NON-NLS-1$
+
+        if (str == null) {
+            return new Font(fontName, fontStyle, fontSize);
+        }
 
         strTokens = new StringTokenizer(str.trim(), delim);
 

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java?view=diff&rev=507389&r1=507388&r2=507389
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java (original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/Label.java Tue
Feb 13 20:57:49 2007
@@ -273,6 +273,11 @@
     }
 
     @Override
+    boolean hasDefaultFont() {
+        return true;
+    }
+
+    @Override
     AccessibleContext createAccessibleContext() {
         return new AccessibleAWTLabel();
     }

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=507389&r1=507388&r2=507389
==============================================================================
--- 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
Tue Feb 13 20:57:49 2007
@@ -539,11 +539,6 @@
             } else {
                 disposed = false;
             }
-            
-            if (getFont() == null) {
-                setFont(Font.DEFAULT_FONT);
-            }
-            
             super.show();
             toFront();
             if (!opened) {

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ComponentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ComponentTest.java?view=diff&rev=507389&r1=507388&r2=507389
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ComponentTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/ComponentTest.java
Tue Feb 13 20:57:49 2007
@@ -338,37 +338,6 @@
         assertTrue(tc.areFocusTraversalKeysSet(id));
 
     }
-    
-    public void testGetFont() {
-        // Regression for HARMONY-1605
-        final Font defaultFont = new Font("Dialog", Font.PLAIN, 12); //$NON-NLS-1$
-        final Window w = new Window(new Frame());
-        final Component c = tc;
-        final Button b = new Button();
-
-        assertNull(w.getFont());
-        assertNull(c.getFont());
-        w.add(c);
-        assertNull(c.getFont());
-        w.setVisible(true);
-        assertEquals(defaultFont, w.getFont());
-        assertEquals(defaultFont, c.getFont());
-
-        assertNull(b.getFont());
-        b.setVisible(true);
-        assertNull(b.getFont());
-        b.setVisible(false);
-        b.setVisible(true);
-        assertNull(b.getFont());
-        new Frame().add(b);
-        assertNull(b.getFont());
-        w.add(b);
-        assertEquals(defaultFont, b.getFont());
-
-        w.setVisible(false);
-        w.dispose();
-        // End of regression for HARMONY-1605
-    }
 
     private void createRobot() {
         try {



Mime
View raw message