harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r489362 - in /harmony/enhanced/classlib/trunk/modules/swing: make/ src/main/java/common/javax/swing/plaf/basic/ src/test/api/java/common/javax/swing/plaf/basic/
Date Thu, 21 Dec 2006 14:17:37 GMT
Author: apetrenko
Date: Thu Dec 21 06:17:36 2006
New Revision: 489362

URL: http://svn.apache.org/viewvc?view=rev&rev=489362
Log:
Patch for HARMONY-1799 "[classlib][swing] JTextPane throws NPE after we set null font."
BasicTextPaneUITest.java test is removed from exclude lists

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextPaneUI.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTextPaneUITest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl Thu Dec 21 06:17:36
2006
@@ -89,7 +89,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm Thu Dec 21 06:17:36
2006
@@ -89,7 +89,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl Thu Dec 21
06:17:36 2006
@@ -92,7 +92,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm Thu Dec 21
06:17:36 2006
@@ -89,7 +89,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl Thu Dec 21
06:17:36 2006
@@ -93,7 +93,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm Thu Dec 21
06:17:36 2006
@@ -100,7 +100,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl Thu Dec
21 06:17:36 2006
@@ -89,7 +89,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm Thu Dec
21 06:17:36 2006
@@ -89,7 +89,6 @@
 javax/swing/plaf/basic/BasicTableUITest.java
 javax/swing/plaf/basic/BasicTextAreaUITest.java
 javax/swing/plaf/basic/BasicTextFieldUITest.java
-javax/swing/plaf/basic/BasicTextPaneUITest.java
 javax/swing/plaf/basic/BasicToolBarUI$DragWindowTest.java
 javax/swing/plaf/basic/BasicToolBarUITest.java
 javax/swing/plaf/metal/MetalComboBoxIconTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextPaneUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextPaneUI.java?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextPaneUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextPaneUI.java
Thu Dec 21 06:17:36 2006
@@ -67,9 +67,6 @@
         }
 
         final Font f = pane.getFont();
-        if (f == null) {
-            return;
-        }
 
         final Style style = getDefaultStyle(e);
 
@@ -83,9 +80,16 @@
 
 
     private void updateFontAttributes(final Style style, final Font f) {
-        style.addAttribute(StyleConstants.Italic, Boolean.valueOf(f.isItalic()));
-        style.addAttribute(StyleConstants.Bold, Boolean.valueOf(f.isBold()));
-        style.addAttribute(StyleConstants.FontFamily, f.getName());
-        style.addAttribute(StyleConstants.FontSize, new Integer(f.getSize()));
+        if (f == null){
+            style.removeAttribute(StyleConstants.Italic);
+            style.removeAttribute(StyleConstants.Bold);
+            style.removeAttribute(StyleConstants.FontFamily);
+            style.removeAttribute(StyleConstants.FontSize);
+        } else {
+            style.addAttribute(StyleConstants.Italic, Boolean.valueOf(f.isItalic()));
+            style.addAttribute(StyleConstants.Bold, Boolean.valueOf(f.isBold()));
+            style.addAttribute(StyleConstants.FontFamily, f.getName());
+            style.addAttribute(StyleConstants.FontSize, new Integer(f.getSize()));
+        }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTextPaneUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTextPaneUITest.java?view=diff&rev=489362&r1=489361&r2=489362
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTextPaneUITest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/basic/BasicTextPaneUITest.java
Thu Dec 21 06:17:36 2006
@@ -141,4 +141,37 @@
         assertFalse(font.getFamily().equals(newStyle.getAttribute(StyleConstants.FontFamily)));
         assertEquals(font.getName(), newStyle.getAttribute(StyleConstants.FontFamily));
     }
+    public void testPropertyChange_NullFont() {
+        // regression test to HARMONY-1799
+        
+        textPane = new JTextPane();
+
+        textPane.setFont(font);
+        Style style = textPane.getStyle(StyleContext.DEFAULT_STYLE);
+        style.addAttribute(StyleConstants.Italic, Boolean.TRUE);
+        style.addAttribute(StyleConstants.Bold, Boolean.TRUE);
+        textPane.setFont(null);
+        assertNull(style.getAttribute(StyleConstants.FontFamily));
+        assertNull(style.getAttribute(StyleConstants.Italic));
+        assertNull(style.getAttribute(StyleConstants.Bold));
+
+        StyledDocument newDoc = new DefaultStyledDocument();
+        Style newStyle = newDoc.getStyle(StyleContext.DEFAULT_STYLE);
+        assertEquals(1, newStyle.getAttributeCount());
+        newStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
+        newStyle.addAttribute(StyleConstants.Bold, Boolean.TRUE);
+        newStyle.addAttribute(StyleConstants.StrikeThrough, Boolean.FALSE);
+        textPane.setForeground(Color.RED);
+        textPane.setDocument(newDoc);
+        assertSame(textPane.getStyle(StyleContext.DEFAULT_STYLE), newStyle);
+        assertNull(textPane.getFont());
+        assertNull(newStyle.getAttribute(StyleConstants.FontFamily));
+        assertNull(newStyle.getAttribute(StyleConstants.Italic));
+        assertNull(newStyle.getAttribute(StyleConstants.Bold));
+        assertSame(newStyle.getAttribute(StyleConstants.Foreground),
+                   textPane.getForeground());
+        assertFalse(((Boolean)newStyle.getAttribute(StyleConstants.StrikeThrough))
+                     .booleanValue());
+    }
+
 }



Mime
View raw message