harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r785775 - in /harmony/enhanced/classlib/trunk/modules/swing: make/exclude.common src/test/api/java.injected/javax/swing/text/StyleConstantsTest.java
Date Wed, 17 Jun 2009 20:11:37 GMT
Author: hindessm
Date: Wed Jun 17 20:11:33 2009
New Revision: 785775

URL: http://svn.apache.org/viewvc?rev=785775&view=rev
Log:
There were a couple of trivial rejects but I've applied the patch from
"[#HARMONY-1866] [classlib][swing][test] j.s.t.StyleConstantsTest fails".
Passes reliably for me so I've also removed it from the exclude list.

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.common
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/StyleConstantsTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.common?rev=785775&r1=785774&r2=785775&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.common (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.common Wed Jun 17 20:11:33
2009
@@ -93,7 +93,6 @@
 javax/swing/text/PlainView_ChangesTest.java
 javax/swing/text/StringContentTest.java
 javax/swing/text/StringContentTest_CommonTest.java
-javax/swing/text/StyleConstantsTest.java
 javax/swing/text/StyleContextTest.java
 javax/swing/text/StyledEditorKitTest.java
 javax/swing/text/TextAction_MultithreadedTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/StyleConstantsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/StyleConstantsTest.java?rev=785775&r1=785774&r2=785775&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/StyleConstantsTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/StyleConstantsTest.java
Wed Jun 17 20:11:33 2009
@@ -20,12 +20,15 @@
  */
 package javax.swing.text;
 
-import junit.framework.TestCase;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics;
+
 import javax.swing.Icon;
 import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+
+import junit.framework.TestCase;
 
 public class StyleConstantsTest extends TestCase {
     protected StyleConstants sc;
@@ -34,6 +37,8 @@
 
     String message = "Test for StyleConstants";
 
+    private Component component;
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -427,11 +432,15 @@
         assertEquals("component", StyleConstants.ComponentAttribute.toString());
     }
 
-    public void testGetComponent() {
+    public void testGetComponent() throws Exception {
         assertNull(StyleConstants.getComponent(SimpleAttributeSet.EMPTY));
-        Component val = new JLabel("test component");
-        putAttribute(StyleConstants.ComponentAttribute, val);
-        assertEquals(val, StyleConstants.getComponent(attr));
+        SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    component = new JLabel("test component");
+                }
+            });
+        putAttribute(StyleConstants.ComponentAttribute, component);
+        assertEquals(component, StyleConstants.getComponent(attr));
     }
 
     public void testGetComponent_Null() {
@@ -444,15 +453,19 @@
         }
     }
 
-    public void testSetComponent() {
+    public void testSetComponent() throws Exception {
         attr.removeAttributes(attr);
-        Component val = new JLabel("test component");
-        StyleConstants.setComponent(attr, val);
-        assertEquals(AbstractDocument.ElementNameAttribute + "=component component=" + val
-                + " ", attr.toString());
-        assertEquals(val, attr.getAttribute(StyleConstants.ComponentAttribute));
-        assertEquals(StyleConstants.ComponentElementName, attr
-                .getAttribute(AbstractDocument.ElementNameAttribute));
+        SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    component = new JLabel("test component");
+                }
+            });
+        StyleConstants.setComponent(attr, component);
+        assertEquals(2, attr.getAttributeCount());
+        assertEquals(component,
+                     attr.getAttribute(StyleConstants.ComponentAttribute));
+        assertEquals(StyleConstants.ComponentElementName,
+                     attr.getAttribute(AbstractDocument.ElementNameAttribute));
     }
 
     public void testFontFamily() {
@@ -509,8 +522,7 @@
             }
         };
         StyleConstants.setIcon(attr, val);
-        assertEquals(AbstractDocument.ElementNameAttribute + "=icon icon=" + val + " ", attr
-                .toString());
+        assertEquals(2, attr.getAttributeCount());
         assertEquals(val, attr.getAttribute(StyleConstants.IconAttribute));
         assertEquals(StyleConstants.IconElementName, attr
                 .getAttribute(AbstractDocument.ElementNameAttribute));



Mime
View raw message