harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [30/43] - in /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common: javax/swing/ javax/swing/border/ javax/swing/colorchooser/ javax/swing/event/ javax/swing/filechooser/ javax/swing/plaf/ javax/swing/plaf/basic/ j...
Date Sun, 26 Nov 2006 20:15:55 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_AttributesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_AttributesTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_AttributesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_AttributesTest.java Sun Nov 26 12:15:43 2006
@@ -23,9 +23,7 @@
 import java.awt.Color;
 import java.awt.Container;
 import java.awt.Font;
-
 import javax.swing.JTextArea;
-
 import junit.framework.TestCase;
 
 /**
@@ -34,30 +32,37 @@
  */
 public class GlyphView_AttributesTest extends TestCase {
     private DefaultStyledDocument styledDoc;
+
     private PlainDocument plainDoc;
+
     private Element leaf;
+
     private Element line;
+
     private GlyphView styledView;
+
     private GlyphView plainView;
+
     private GlyphView styledWithParent;
+
     private GlyphView plainWithParent;
 
     private Container parent;
 
     private static final int NONE = -1;
+
     private static final int FORE = 0;
+
     private static final int BACK = 1;
+
     private static final int FONT = 2;
+
     private static final int AREA_FORE = 3;
+
     private static final int AREA_FONT = 4;
-    private static final String[] PROPERTY_NAMES = {
-        "Foreground",
-        "Background",
-        "Font",
-
-        "Area.Foreground",
-        "Area.Font"
-    };
+
+    private static final String[] PROPERTY_NAMES = { "Foreground", "Background", "Font",
+            "Area.Foreground", "Area.Font" };
 
     /**
      * 0: StyledDocument.getForeground
@@ -69,125 +74,117 @@
     private final boolean[] calledMethods = new boolean[5];
 
     private static final String text = "test text";
+
     private static final Color THE_FOREGROUND = new Color(127, 152, 51);
+
     private static final Font THE_FONT = new Font("Crazy Font", Font.PLAIN, 36);
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         styledDoc = new DefaultStyledDocument() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             public Color getForeground(AttributeSet attrs) {
                 calledMethods[FORE] = true;
                 assertSame(leaf, attrs);
                 return super.getForeground(attrs);
             }
 
+            @Override
             public Color getBackground(AttributeSet attrs) {
                 calledMethods[BACK] = true;
                 assertSame(leaf, attrs);
                 return super.getBackground(attrs);
             }
 
+            @Override
             public Font getFont(AttributeSet attrs) {
                 calledMethods[FONT] = true;
                 assertSame(leaf, attrs);
                 return super.getFont(attrs);
             }
         };
-
         parent = new JTextArea() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             public Color getForeground() {
                 calledMethods[AREA_FORE] = true;
                 return THE_FOREGROUND;
             }
 
+            @Override
             public Font getFont() {
                 calledMethods[AREA_FONT] = true;
                 return THE_FONT;
             }
         };
-
         styledDoc.insertString(0, text, null);
         leaf = styledDoc.getCharacterElement(0);
         styledView = new GlyphView(leaf);
         styledWithParent = new GlyphView(leaf) {
+            @Override
             public Container getContainer() {
                 return parent;
             }
         };
-
         plainDoc = new PlainDocument();
         plainDoc.insertString(0, text, null);
         line = plainDoc.getDefaultRootElement().getElement(0);
         plainView = new GlyphView(line);
         plainWithParent = new GlyphView(line) {
+            @Override
             public Container getContainer() {
                 return parent;
             }
         };
-
         for (int i = 0; i < calledMethods.length; i++) {
             calledMethods[i] = false;
         }
     }
 
     public void testGetForeground() {
-        assertSame(StyleConstants.getForeground(leaf.getAttributes()),
-                   styledView.getForeground());
+        assertSame(StyleConstants.getForeground(leaf.getAttributes()), styledView
+                .getForeground());
         assertCalledMethods(FORE);
-
-        assertSame(StyleConstants.getForeground(leaf.getAttributes()),
-                   styledWithParent.getForeground());
+        assertSame(StyleConstants.getForeground(leaf.getAttributes()), styledWithParent
+                .getForeground());
         assertCalledMethods(FORE);
-
         assertNull(plainView.getForeground());
         assertCalledMethods(NONE);
-
-        assertSame(plainWithParent.getForeground(),
-                   plainWithParent.getForeground());
+        assertSame(plainWithParent.getForeground(), plainWithParent.getForeground());
         assertCalledMethods(AREA_FORE);
     }
 
     public void testGetBackground() {
         assertNull(styledView.getBackground());
         assertCalledMethods(NONE);
-
         assertNull(styledWithParent.getBackground());
         assertCalledMethods(NONE);
-
         assertNull(plainView.getBackground());
         assertCalledMethods(NONE);
-
         assertNull(plainWithParent.getBackground());
         assertCalledMethods(NONE);
-
-
         setAttribute(StyleConstants.Background, THE_FOREGROUND);
-
         assertSame(THE_FOREGROUND, styledView.getBackground());
         assertCalledMethods(BACK);
-
         assertSame(THE_FOREGROUND, styledWithParent.getBackground());
         assertCalledMethods(BACK);
     }
 
     public void testGetFont() {
         Font font = styledView.getFont();
-        assertEquals(StyleConstants.getFontFamily(leaf.getAttributes()),
-                     font.getFamily());
-        assertEquals(StyleConstants.getFontSize(leaf.getAttributes()),
-                     font.getSize());
+        assertEquals(StyleConstants.getFontFamily(leaf.getAttributes()), font.getFamily());
+        assertEquals(StyleConstants.getFontSize(leaf.getAttributes()), font.getSize());
         assertCalledMethods(FONT);
-
         font = styledWithParent.getFont();
-        assertEquals(StyleConstants.getFontFamily(leaf.getAttributes()),
-                     font.getFamily());
-        assertEquals(StyleConstants.getFontSize(leaf.getAttributes()),
-                     font.getSize());
+        assertEquals(StyleConstants.getFontFamily(leaf.getAttributes()), font.getFamily());
+        assertEquals(StyleConstants.getFontSize(leaf.getAttributes()), font.getSize());
         assertCalledMethods(FONT);
-
         assertNull(plainView.getFont());
         assertCalledMethods(NONE);
-
         assertSame(THE_FONT, plainWithParent.getFont());
         assertCalledMethods(AREA_FONT);
     }
@@ -195,12 +192,9 @@
     public void testIsUnderline() {
         assertFalse(styledView.isUnderline());
         assertFalse(styledWithParent.isUnderline());
-
         assertFalse(plainView.isUnderline());
         assertFalse(plainWithParent.isUnderline());
-
         setAttribute(StyleConstants.Underline, Boolean.TRUE);
-
         assertTrue(styledView.isUnderline());
         assertTrue(styledWithParent.isUnderline());
     }
@@ -208,12 +202,9 @@
     public void testIsStrikeThrough() {
         assertFalse(styledView.isStrikeThrough());
         assertFalse(styledWithParent.isStrikeThrough());
-
         assertFalse(plainView.isUnderline());
         assertFalse(plainWithParent.isStrikeThrough());
-
         setAttribute(StyleConstants.StrikeThrough, Boolean.TRUE);
-
         assertTrue(styledView.isStrikeThrough());
         assertTrue(styledWithParent.isStrikeThrough());
     }
@@ -221,12 +212,9 @@
     public void testIsSubscript() {
         assertFalse(styledView.isSubscript());
         assertFalse(styledWithParent.isSubscript());
-
         assertFalse(plainView.isSubscript());
         assertFalse(plainWithParent.isSubscript());
-
         setAttribute(StyleConstants.Subscript, Boolean.TRUE);
-
         assertTrue(styledView.isSubscript());
         assertTrue(styledWithParent.isSubscript());
     }
@@ -234,12 +222,9 @@
     public void testIsSuperscript() {
         assertFalse(styledView.isSuperscript());
         assertFalse(styledWithParent.isSuperscript());
-
         assertFalse(plainView.isSuperscript());
         assertFalse(plainWithParent.isSuperscript());
-
         setAttribute(StyleConstants.Superscript, Boolean.TRUE);
-
         assertTrue(styledView.isSuperscript());
         assertTrue(styledWithParent.isSuperscript());
     }
@@ -247,20 +232,16 @@
     private void setAttribute(final Object key, final Object value) {
         MutableAttributeSet attrs = new SimpleAttributeSet();
         attrs.addAttribute(key, value);
-        styledDoc.setCharacterAttributes(leaf.getStartOffset(),
-                                         leaf.getEndOffset()
-                                         - leaf.getStartOffset(),
-                                         attrs, false);
+        styledDoc.setCharacterAttributes(leaf.getStartOffset(), leaf.getEndOffset()
+                - leaf.getStartOffset(), attrs, false);
     }
 
     private void assertCalledMethods(final int index) {
         for (int i = 0; i < calledMethods.length; i++) {
             if (i == index) {
-                assertTrue(PROPERTY_NAMES[i] + " isn't true",
-                           calledMethods[i]);
+                assertTrue(PROPERTY_NAMES[i] + " isn't true", calledMethods[i]);
             } else {
-                assertFalse(PROPERTY_NAMES[i] + " isn't false",
-                            calledMethods[i]);
+                assertFalse(PROPERTY_NAMES[i] + " isn't false", calledMethods[i]);
             }
             calledMethods[i] = false;
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_BreakTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_BreakTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_BreakTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_BreakTest.java Sun Nov 26 12:15:43 2006
@@ -23,13 +23,11 @@
 import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Toolkit;
-
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentEvent.EventType;
 import javax.swing.text.AbstractDocument.BranchElement;
 import javax.swing.text.AbstractDocument.LeafElement;
 import javax.swing.text.GlyphViewTest.EmptyPainter;
-
 import junit.framework.TestCase;
 
 /**
@@ -38,42 +36,50 @@
  */
 public class GlyphView_BreakTest extends TestCase {
     private GlyphView view;
+
     private StyledDocument doc;
+
     private Element root;
+
     private Element leaf;
 
     private Font font;
+
     private FontMetrics metrics;
+
     private float width;
 
-    private static final String FULL_TEXT =
-        "this text to check how view breaks";
-    //   0123456789012345678901234567890123
+    private static final String FULL_TEXT = "this text to check how view breaks";
 
+    //   0123456789012345678901234567890123
     private static final int startOffset = 5;
+
     private static final int endOffset = 28;
+
     private static final int length = endOffset - startOffset;
 
-    private static final String LEAF_TEXT =
-        FULL_TEXT.substring(startOffset, endOffset);
+    private static final String LEAF_TEXT = FULL_TEXT.substring(startOffset, endOffset);
 
     private static final int X_AXIS = View.X_AXIS;
+
     private static final int Y_AXIS = View.Y_AXIS;
 
     private static final int BAD = View.BadBreakWeight;
+
     private static final int GOOD = View.GoodBreakWeight;
+
     private static final int EXCELLENT = View.ExcellentBreakWeight;
 
+    @SuppressWarnings("deprecation")
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
         root = doc.getDefaultRootElement();
         doc.insertString(0, FULL_TEXT, null);
-        doc.setCharacterAttributes(startOffset, length,
-                                   SimpleAttributeSet.EMPTY, false);
+        doc.setCharacterAttributes(startOffset, length, SimpleAttributeSet.EMPTY, false);
         leaf = root.getElement(0).getElement(1);
         view = new GlyphView(leaf);
-
         font = view.getFont();
         metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
     }
@@ -84,7 +90,6 @@
      */
     public void testBreakViewX_IncorrectOffset() {
         View part;
-
         // The text in view will be measured as if the view started at offset 0
         width = metrics.stringWidth(FULL_TEXT.substring(0, 1));
         part = view.breakView(X_AXIS, 0, 0.0f, width);
@@ -92,44 +97,34 @@
         assertSame(view.getElement(), part.getElement());
         assertEquals(0, part.getStartOffset());
         assertEquals(1, part.getEndOffset());
-
         assertEquals(5, view.getStartOffset()); // leaf.get{Start, End}Offset
         assertEquals(28, view.getEndOffset());
-
         part = view.breakView(X_AXIS, 0, 0.0f, width - 0.01f);
         assertNotSame(view, part);
         assertEquals(view.getStartOffset(), part.getStartOffset());
         assertEquals(view.getEndOffset(), part.getEndOffset());
-
         // Measuring will start at offset 1
         width = metrics.stringWidth(FULL_TEXT.substring(1, 2));
         part = view.breakView(X_AXIS, 1, 0.0f, width);
         assertNotSame(view, part);
         assertEquals(1, part.getStartOffset());
         assertEquals(2, part.getEndOffset());
-
         part = view.breakView(X_AXIS, 1, 0.0f, width - 0.01f);
         assertNotSame(view, part);
         assertEquals(view.getStartOffset(), part.getStartOffset());
         assertEquals(view.getEndOffset(), part.getEndOffset());
-
-
         width = metrics.stringWidth(FULL_TEXT.substring(0, 2));
         part = view.breakView(X_AXIS, 0, 0.0f, width);
         assertEquals(0, part.getStartOffset());
         assertEquals(2, part.getEndOffset());
-
         width = metrics.stringWidth(FULL_TEXT.substring(1, 3));
         part = view.breakView(X_AXIS, 1, 0.0f, width - 0.01f);
         assertEquals(1, part.getStartOffset());
         assertEquals(2, part.getEndOffset());
-
-
         width = metrics.stringWidth(FULL_TEXT.substring(0, 8));
         part = view.breakView(X_AXIS, 0, 0.0f, width);
         assertEquals(0, part.getStartOffset());
         assertEquals(5, part.getEndOffset());
-
         width = metrics.stringWidth(FULL_TEXT.substring(1, 9));
         part = view.breakView(X_AXIS, 1, 0.0f, width - 0.01f);
         assertEquals(1, part.getStartOffset());
@@ -142,48 +137,37 @@
      */
     public void testBreakViewX_CorrectOffset() {
         View part;
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 1));
         part = view.breakView(X_AXIS, startOffset, 0.0f, width);
         assertNotSame(view, part);
         assertSame(view.getElement(), part.getElement());
         assertEquals(5, part.getStartOffset());
         assertEquals(6, part.getEndOffset());
-
         assertEquals(5, view.getStartOffset()); // leaf.get{Start, End}Offset
         assertEquals(28, view.getEndOffset());
-
         part = view.breakView(X_AXIS, startOffset, 0.0f, width - 0.01f);
         assertEquals(5, part.getStartOffset());
         assertEquals(28, part.getEndOffset());
-
         // Measuring of text will start at startOffset + 1
         width = metrics.stringWidth(LEAF_TEXT.substring(1, 2));
         part = view.breakView(X_AXIS, startOffset + 1, 0.0f, width);
         assertEquals(6, part.getStartOffset());
         assertEquals(7, part.getEndOffset());
-
         part = view.breakView(X_AXIS, startOffset + 1, 0.0f, width - 0.01f);
         assertEquals(5, part.getStartOffset());
         assertEquals(28, part.getEndOffset());
-
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 2));
         part = view.breakView(X_AXIS, startOffset, 0.0f, width);
         assertEquals(5, part.getStartOffset());
         assertEquals(7, part.getEndOffset());
-
         width = metrics.stringWidth(LEAF_TEXT.substring(1, 3));
         part = view.breakView(X_AXIS, startOffset + 1, 0.0f, width - 0.01f);
         assertEquals(6, part.getStartOffset());
         assertEquals(7, part.getEndOffset());
-
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 8));
         part = view.breakView(X_AXIS, startOffset, 0.0f, width);
         assertEquals(5, part.getStartOffset());
         assertEquals(13, part.getEndOffset());
-
         width = metrics.stringWidth(LEAF_TEXT.substring(1, 9));
         part = view.breakView(X_AXIS, startOffset + 1, 0.0f, width - 0.01f);
         assertEquals(6, part.getStartOffset());
@@ -194,20 +178,15 @@
      * Shows the start and end offsets are updated when text is inserted
      * before the start of the part this view represents.
      */
-    public void testBreakViewX_ElementChangeBefore()
-        throws BadLocationException {
-
+    public void testBreakViewX_ElementChangeBefore() throws BadLocationException {
         View part;
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 8));
         part = view.breakView(X_AXIS, startOffset + 1, 0.0f, width - 0.01f);
         assertEquals(6, part.getStartOffset());
         assertEquals(13, part.getEndOffset());
-
         doc.insertString(5, "^^^", null);
         assertEquals(9, part.getStartOffset());
         assertEquals(16, part.getEndOffset());
-
         DocumentEvent event = createEvent(5, 3, EventType.INSERT);
         part.insertUpdate(event, null, null);
         assertEquals(9, part.getStartOffset());
@@ -218,20 +197,15 @@
      * Shows the start and end offsets are not updated when text is inserted
      * in the middle of the part of the element this view represents.
      */
-    public void testBreakViewX_ElementChangeMiddle()
-        throws BadLocationException {
-
+    public void testBreakViewX_ElementChangeMiddle() throws BadLocationException {
         View part;
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 8));
         part = view.breakView(X_AXIS, startOffset + 1, 0.0f, width - 0.01f);
         assertEquals(6, part.getStartOffset());
         assertEquals(13, part.getEndOffset());
-
         doc.insertString(7, "^^^", null);
         assertEquals(6, part.getStartOffset());
         assertEquals(13, part.getEndOffset());
-
         DocumentEvent event = createEvent(5, 3, EventType.INSERT);
         part.insertUpdate(event, null, null);
         assertEquals(6, part.getStartOffset());
@@ -244,19 +218,15 @@
     public void testBreakViewY() {
         View part;
         final int offset = leaf.getStartOffset();
-
         width = metrics.getHeight();
         part = view.breakView(Y_AXIS, offset, 0.0f, width);
         assertSame(view, part);
         assertEquals(5, part.getStartOffset());
         assertEquals(28, part.getEndOffset());
-
         part = view.breakView(Y_AXIS, offset, 0.0f, width - 0.01f);
         assertSame(view, part);
-
         part = view.breakView(Y_AXIS, offset, 0.0f, width + 0.01f);
         assertSame(view, part);
-
         part = view.breakView(Y_AXIS, offset, 0.0f, width * 2);
         assertSame(view, part);
     }
@@ -267,18 +237,15 @@
      */
     public void testBreakViewCreate() throws Exception {
         view = new GlyphView(root) {
+            @Override
             public View createFragment(int startOffset, int endOffset) {
-                final Element part =
-                    ((AbstractDocument)doc).new LeafElement(null, null,
-                                                            startOffset,
-                                                            endOffset);
+                final Element part = ((AbstractDocument) doc).new LeafElement(null, null,
+                        startOffset, endOffset);
                 return new LabelView(part);
             };
         };
-
         final float width = metrics.stringWidth(FULL_TEXT.substring(0, 2));
         final View fragment = view.breakView(X_AXIS, 0, 0, width);
-
         assertTrue(fragment instanceof LabelView);
         assertFalse(view instanceof LabelView);
         assertEquals(view.getStartOffset(), fragment.getStartOffset());
@@ -289,32 +256,26 @@
 
     public void testCreateFragment() {
         View fragment;
-
         fragment = view.createFragment(1, 3);
         assertEquals(1, fragment.getStartOffset());
         assertEquals(3, fragment.getEndOffset());
         assertSame(view.getElement(), fragment.getElement());
         assertTrue(fragment instanceof GlyphView);
-
         fragment = view.createFragment(5, 7);
         assertEquals(5, fragment.getStartOffset());
         assertEquals(7, fragment.getEndOffset());
         assertSame(view.getElement(), fragment.getElement());
-
         fragment = view.createFragment(startOffset, endOffset);
         assertNotSame(view, fragment);
         assertEquals(view.getStartOffset(), fragment.getStartOffset());
         assertEquals(view.getEndOffset(), fragment.getEndOffset());
         assertSame(view.getElement(), fragment.getElement());
-
-        fragment = view.createFragment(startOffset + length / 4,
-                                       endOffset - length / 4);
+        fragment = view.createFragment(startOffset + length / 4, endOffset - length / 4);
         assertEquals(startOffset + length / 4, fragment.getStartOffset());
         assertEquals(endOffset - length / 4, fragment.getEndOffset());
         assertSame(view.getElement(), fragment.getElement());
-
-        fragment = fragment.createFragment(fragment.getStartOffset() + 2,
-                                           fragment.getEndOffset() - 1);
+        fragment = fragment.createFragment(fragment.getStartOffset() + 2, fragment
+                .getEndOffset() - 1);
         assertEquals(startOffset + length / 4 + 2, fragment.getStartOffset());
         assertEquals(endOffset - length / 4 - 1, fragment.getEndOffset());
         assertSame(view.getElement(), fragment.getElement());
@@ -324,55 +285,42 @@
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 1));
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, 0.0f, width));
         assertEquals(BAD, view.getBreakWeight(X_AXIS, 0.0f, width - 0.01f));
-
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, width, width));
         assertEquals(BAD, view.getBreakWeight(X_AXIS, width, width - 0.01f));
-
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, width * 2, width));
-        assertEquals(BAD, view.getBreakWeight(X_AXIS, width * 2, width
-                                                                 - 0.01f));
+        assertEquals(BAD, view.getBreakWeight(X_AXIS, width * 2, width - 0.01f));
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, width * 3, width));
-        assertEquals(BAD, view.getBreakWeight(X_AXIS, width * 3, width
-                                                                 - 0.01f));
-
+        assertEquals(BAD, view.getBreakWeight(X_AXIS, width * 3, width - 0.01f));
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 2));
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, 0.0f, width));
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, 0.0f, width - 0.01f));
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 5));
         assertEquals(EXCELLENT, view.getBreakWeight(X_AXIS, 0.0f, width));
         assertEquals(GOOD, view.getBreakWeight(X_AXIS, 0.0f, width - 0.01f));
-
         width = metrics.stringWidth(LEAF_TEXT.substring(0, 6));
         assertEquals(EXCELLENT, view.getBreakWeight(X_AXIS, 0.0f, width));
-        assertEquals(EXCELLENT, view.getBreakWeight(X_AXIS, 0.0f, width
-                                                                  - 0.01f));
+        assertEquals(EXCELLENT, view.getBreakWeight(X_AXIS, 0.0f, width - 0.01f));
     }
 
     public void testGetBreakWeightY() {
         width = metrics.getHeight();
         assertEquals(BAD, view.getBreakWeight(Y_AXIS, 0.0f, width));
         assertEquals(BAD, view.getBreakWeight(Y_AXIS, 0.0f, width - 0.01f));
-
         assertEquals(BAD, view.getBreakWeight(Y_AXIS, width, width));
         assertEquals(BAD, view.getBreakWeight(Y_AXIS, width, width - 0.01f));
-
         assertEquals(GOOD, view.getBreakWeight(Y_AXIS, 0.0f, width + 0.01f));
     }
 
     public void testClone() {
         view.setGlyphPainter(new EmptyPainter());
-        GlyphView clone = (GlyphView)view.clone();
+        GlyphView clone = (GlyphView) view.clone();
         assertEquals(view.getStartOffset(), clone.getStartOffset());
         assertEquals(view.getEndOffset(), clone.getEndOffset());
         assertSame(view.getElement(), clone.getElement());
         assertSame(view.getGlyphPainter(), clone.getGlyphPainter());
     }
 
-    private DocumentEvent createEvent(final int offset, final int length,
-                                      final EventType type) {
-        return ((AbstractDocument)doc).new DefaultDocumentEvent(offset, length,
-                                                                type);
+    private DocumentEvent createEvent(final int offset, final int length, final EventType type) {
+        return ((AbstractDocument) doc).new DefaultDocumentEvent(offset, length, type);
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_ChangesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_ChangesTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_ChangesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_ChangesTest.java Sun Nov 26 12:15:43 2006
@@ -21,33 +21,29 @@
 package javax.swing.text;
 
 import java.awt.Rectangle;
-
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
-
 import junit.framework.TestCase;
 
 /**
  * Tests GlyphView methods which react to changes in a document.
  *
  */
-public class GlyphView_ChangesTest extends TestCase
-    implements DocumentListener {
-
+public class GlyphView_ChangesTest extends TestCase implements DocumentListener {
     private static final class PreferenceChange {
         private View child;
+
         private boolean width;
+
         private boolean height;
 
-        void setData(final View child,
-                          final boolean width, final boolean height) {
+        void setData(final View child, final boolean width, final boolean height) {
             this.child = child;
             this.width = width;
             this.height = height;
         }
 
-        void check(final View child,
-                   final boolean width, final boolean height) {
+        void check(final View child, final boolean width, final boolean height) {
             assertSame("Child", child, this.child);
             assertEquals("Width", width, this.width);
             assertEquals("Height", height, this.height);
@@ -55,41 +51,46 @@
     }
 
     private GlyphView[] views;
+
     private StyledDocument doc;
+
     private Element root;
+
     private Element branch;
+
     private Element[] leaves;
+
     private BoxView boxView;
+
     private DocumentEvent event;
+
     private static final PreferenceChange change = new PreferenceChange();
 
     private static final String TEXT = "abcdef012345lalala";
-    //                                  012345678901234567
 
+    //                                  012345678901234567
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
         root = doc.getDefaultRootElement();
         doc.insertString(0, TEXT, null);
         doc.setCharacterAttributes(6, 12, SimpleAttributeSet.EMPTY, false);
-
         branch = root.getElement(0);
         leaves = new Element[branch.getElementCount()];
         boxView = new BoxView(branch, View.X_AXIS) {
-            public void preferenceChanged(final View child,
-                                          final boolean width,
-                                          final boolean height) {
+            @Override
+            public void preferenceChanged(final View child, final boolean width,
+                    final boolean height) {
                 change.setData(child, width, height);
                 super.preferenceChanged(child, width, height);
             }
         };
-
         views = new GlyphView[leaves.length];
         for (int i = 0; i < views.length; i++) {
             views[i] = new GlyphView(leaves[i]);
         }
         boxView.replace(0, 0, views);
-
         doc.addDocumentListener(this);
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_GlyphPainterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_GlyphPainterTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_GlyphPainterTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/GlyphView_GlyphPainterTest.java Sun Nov 26 12:15:43 2006
@@ -25,8 +25,8 @@
 import java.awt.Shape;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
-
 import javax.swing.BasicSwingTestCase;
+import javax.swing.SwingConstants;
 import javax.swing.text.Position.Bias;
 
 /**
@@ -35,141 +35,138 @@
  */
 public class GlyphView_GlyphPainterTest extends BasicSwingTestCase {
     private static final float ACCURACY = 0.00001f;
+
     private GlyphView view;
+
     private StyledDocument doc;
+
     private Element root;
+
     private Element leaf;
 
     private Rectangle shape;
 
     private static ByteArrayOutputStream stream;
+
     private static PrintStream out;
 
     private static final String TEXT = "012345";
 
     private static final float DESCENT = 6;
+
     private static final float ASCENT = -30;
+
     private static final float HEIGHT = 20;
 
     private static class Painter extends GlyphView.GlyphPainter {
-        public float getSpan(GlyphView v, int p0, int p1,
-                             TabExpander e, float x) {
-            out.println("getSpan(" + v + ", " + p0 + ", " + p1 + ", "
-                        + e + ", " + x + ")");
+        @Override
+        public float getSpan(GlyphView v, int p0, int p1, TabExpander e, float x) {
+            out.println("getSpan(" + v + ", " + p0 + ", " + p1 + ", " + e + ", " + x + ")");
             return 0.125f;
         }
 
+        @Override
         public float getHeight(GlyphView v) {
             out.println("getHeight(" + v + ")");
             return HEIGHT;
         }
 
+        @Override
         public float getAscent(GlyphView v) {
             out.println("getAscent(" + v + ")");
             return ASCENT;
         }
 
+        @Override
         public float getDescent(GlyphView v) {
             out.println("getDescent(" + v + ")");
             return DESCENT;
         }
 
+        @Override
         public void paint(GlyphView v, Graphics g, Shape a, int p0, int p1) {
-            out.println("paint(" + v + ", " + a + ", "
-                        + p0 + ", " + p1 +  ")");
+            out.println("paint(" + v + ", " + a + ", " + p0 + ", " + p1 + ")");
         }
 
+        @Override
         public Shape modelToView(GlyphView v, int pos, Bias bias, Shape a)
-            throws BadLocationException {
-
-            out.println("modelToView(" + v + ", " + pos + ", "
-                        + bias + ", " + a + ")");
+                throws BadLocationException {
+            out.println("modelToView(" + v + ", " + pos + ", " + bias + ", " + a + ")");
             return null;
         }
 
-        public int viewToModel(GlyphView v, float x, float y,
-                               Shape a, Bias[] biasRet) {
-            out.println("viewToModel(" + v + ", " + x + ", " + y + ", "
-                        + a + ")");
+        @Override
+        public int viewToModel(GlyphView v, float x, float y, Shape a, Bias[] biasRet) {
+            out.println("viewToModel(" + v + ", " + x + ", " + y + ", " + a + ")");
             return 0;
         }
 
-        public int getBoundedPosition(GlyphView v, int p0,
-                                      float x, float len) {
-            out.println("getBoundedPosition(" + v + ", " + p0 + ", "
-                        + x + ", " + len + ")");
+        @Override
+        public int getBoundedPosition(GlyphView v, int p0, float x, float len) {
+            out.println("getBoundedPosition(" + v + ", " + p0 + ", " + x + ", " + len + ")");
             return 0;
         }
 
-        public int getNextVisualPositionFrom(GlyphView v, int pos,
-                                             Bias b, Shape a,
-                                             int direction, Bias[] biasRet)
-            throws BadLocationException {
-
-            out.println("getNextVisualPositionFrom(" + v + ", "
-                               + pos + ", " + b + ", " + a + ", "
-                               + direction + ")");
-            int result = super.getNextVisualPositionFrom(v, pos, b, a,
-                                                         direction, biasRet);
+        @Override
+        public int getNextVisualPositionFrom(GlyphView v, int pos, Bias b, Shape a,
+                int direction, Bias[] biasRet) throws BadLocationException {
+            out.println("getNextVisualPositionFrom(" + v + ", " + pos + ", " + b + ", " + a
+                    + ", " + direction + ")");
+            int result = super.getNextVisualPositionFrom(v, pos, b, a, direction, biasRet);
             out.println("--> result " + result);
             return result;
         }
 
+        @Override
         public String toString() {
             return "GlyphView_GlyphPainterTest.Painter";
         }
-
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         stream = new ByteArrayOutputStream();
         out = new PrintStream(stream);
-
         doc = new DefaultStyledDocument();
         root = doc.getDefaultRootElement();
         doc.insertString(0, TEXT, null);
-        doc.setCharacterAttributes(0, TEXT.length() - 1,
-                                   SimpleAttributeSet.EMPTY, false);
+        doc.setCharacterAttributes(0, TEXT.length() - 1, SimpleAttributeSet.EMPTY, false);
         leaf = root.getElement(0).getElement(0);
         view = new GlyphView(leaf) {
+            @Override
             public String toString() {
                 return "thisTest.view";
             }
         };
         shape = new Rectangle(23, 41, 523, 671);
         view.setGlyphPainter(new Painter());
-
-//        System.out.println(">>> " + getName());
+        //        System.out.println(">>> " + getName());
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-//        System.out.print(stream.toString());
-//        System.out.println("<<< " + getName() + "\n\n");
+        //        System.out.print(stream.toString());
+        //        System.out.println("<<< " + getName() + "\n\n");
     }
 
     public void testGetPreferredSpan() {
         view.getPreferredSpan(View.X_AXIS);
-        assertEquals("getSpan(thisTest.view, 0, 5, null, 0.0)\n",
-                     getFilteredString());
-
+        assertEquals("getSpan(thisTest.view, 0, 5, null, 0.0)\n", getFilteredString());
         stream.reset();
         view.getPreferredSpan(View.Y_AXIS);
-        assertEquals("getHeight(thisTest.view)\n",
-                     getFilteredString());
+        assertEquals("getHeight(thisTest.view)\n", getFilteredString());
     }
 
     public void testGetPartialSpan() {
         view.getPartialSpan(2, 4);
-        assertEquals("getSpan(thisTest.view, 2, 4, null, 0.0)\n",
-                     getFilteredString());
+        assertEquals("getSpan(thisTest.view, 2, 4, null, 0.0)\n", getFilteredString());
     }
 
     public void testGetTabbedSpan() {
         view.getTabbedSpan(1.5f, null);
-        assertEquals("getSpan(thisTest.view, 0, 5, null, 1.5)\n",
-                     getFilteredString());
+        assertEquals("getSpan(thisTest.view, 0, 5, null, 1.5)\n", getFilteredString());
     }
 
     public void testGetTabExpander() {
@@ -180,54 +177,44 @@
     public void testModelToView() throws BadLocationException {
         view.modelToView(2, new Rectangle(13, 21, 500, 200), Bias.Forward);
         assertEquals("modelToView(thisTest.view, 2, Forward, "
-                     + "java.awt.Rectangle[x=13,y=21,width=500,height=200])\n",
-                     getFilteredString());
+                + "java.awt.Rectangle[x=13,y=21,width=500,height=200])\n", getFilteredString());
     }
 
     public void testViewToModel() {
         Bias[] bias = new Bias[1];
         view.viewToModel(17, 16, shape, bias);
         assertEquals("viewToModel(thisTest.view, 17.0, 16.0, "
-                     + "java.awt.Rectangle[x=23,y=41,width=523,height=671])\n",
-                     getFilteredString());
+                + "java.awt.Rectangle[x=23,y=41,width=523,height=671])\n", getFilteredString());
         assertNull(bias[0]);
     }
 
     public void testGetNextVisualPositionFrom() throws BadLocationException {
         Bias[] bias = new Bias[1];
-        view.getNextVisualPositionFrom(3, Bias.Forward, shape, View.EAST, bias);
+        view.getNextVisualPositionFrom(3, Bias.Forward, shape, SwingConstants.EAST, bias);
         assertEquals("getNextVisualPositionFrom(thisTest.view, 3, Forward, "
-                     + "java.awt.Rectangle[x=23,y=41,width=523,height=671],"
-                     + " 3)\n"
-                     + "--> result 4\n",
-                     getFilteredString());
+                + "java.awt.Rectangle[x=23,y=41,width=523,height=671]," + " 3)\n"
+                + "--> result 4\n", getFilteredString());
         assertSame(Bias.Forward, bias[0]);
     }
 
     public void testGetAlignment() {
         assertEquals(0.5f, view.getAlignment(View.X_AXIS), ACCURACY);
         assertEquals("", stream.toString());
-
-        assertEquals((HEIGHT - DESCENT) / HEIGHT,
-                     view.getAlignment(View.Y_AXIS), ACCURACY);
-        assertEquals("getHeight(thisTest.view)\n"
-                     + "getDescent(thisTest.view)\n"
-                     + (!isHarmony() ? "getAscent(thisTest.view)\n" : ""),
-                     getFilteredString());
+        assertEquals((HEIGHT - DESCENT) / HEIGHT, view.getAlignment(View.Y_AXIS), ACCURACY);
+        assertEquals("getHeight(thisTest.view)\n" + "getDescent(thisTest.view)\n"
+                + (!isHarmony() ? "getAscent(thisTest.view)\n" : ""), getFilteredString());
     }
 
     public void testGetBreakWeight() {
         view.getBreakWeight(View.X_AXIS, shape.x + 5.2f, 16);
-        assertEquals("getBoundedPosition(thisTest.view, 0, 28.2, 16.0)\n",
-                     getFilteredString());
+        assertEquals("getBoundedPosition(thisTest.view, 0, 28.2, 16.0)\n", getFilteredString());
     }
 
     public void testPaint() {
         view.paint(createTestGraphics(), shape);
         assertEquals("paint(thisTest.view, "
-                     + "java.awt.Rectangle[x=23,y=41,width=523,height=671], "
-                     + "0, 5)\n",
-                     getFilteredString());
+                + "java.awt.Rectangle[x=23,y=41,width=523,height=671], " + "0, 5)\n",
+                getFilteredString());
     }
 
     private String getFilteredString() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/IconViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/IconViewTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/IconViewTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/IconViewTest.java Sun Nov 26 12:15:43 2006
@@ -26,7 +26,6 @@
 import java.awt.Shape;
 import java.awt.geom.Ellipse2D;
 import java.awt.geom.Rectangle2D;
-
 import javax.swing.Icon;
 import javax.swing.JTextPane;
 import javax.swing.SwingTestCase;
@@ -43,41 +42,39 @@
 
     IconView view;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         textPane = new JTextPane();
         document = textPane.getStyledDocument();
         icon = MetalIconFactory.getCheckBoxMenuItemIcon();
         document.insertString(0, "Hello\n word!!!", new SimpleAttributeSet());
         textPane.setCaretPosition(3);
         textPane.insertIcon(icon);
-        iconElement = document.getDefaultRootElement().getElement(0)
-                        .getElement(1);
+        iconElement = document.getDefaultRootElement().getElement(0).getElement(1);
         view = new IconView(iconElement);
     }
 
     public void testIconView() {
         assertNotNull(StyleConstants.getIcon(iconElement.getAttributes()));
-
         iconElement = document.getDefaultRootElement();
         view = new IconView(iconElement);
         assertNull(StyleConstants.getIcon(iconElement.getAttributes()));
         assertNull(view.getParent());
-
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.getPreferredSpan(View.X_AXIS);
             }
         });
-
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.getPreferredSpan(View.Y_AXIS);
             }
         });
-
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.paint(createTestGraphics(), new Rectangle(10, 10));
             }
@@ -85,149 +82,131 @@
     }
 
     public void testGetPreferredSpan() {
-
         if (isHarmony()) {
-            assertEquals(icon.getIconWidth() + 2,
-                    view.getPreferredSpan(View.X_AXIS), 1);
+            assertEquals(icon.getIconWidth() + 2, view.getPreferredSpan(View.X_AXIS), 1);
         } else {
-            assertEquals(icon.getIconWidth(),
-                    view.getPreferredSpan(View.X_AXIS), 1);
+            assertEquals(icon.getIconWidth(), view.getPreferredSpan(View.X_AXIS), 1);
         }
-        assertEquals(icon.getIconHeight(),
-                     view.getPreferredSpan(View.Y_AXIS),
-                1);
-
+        assertEquals(icon.getIconHeight(), view.getPreferredSpan(View.Y_AXIS), 1);
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.getPreferredSpan(2);
             }
         });
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.getPreferredSpan(-1);
             }
         });
-
         MutableAttributeSet attrs = new SimpleAttributeSet();
         icon = MetalIconFactory.getRadioButtonIcon();
         StyleConstants.setIcon(attrs, icon);
         document.setCharacterAttributes(3, 1, attrs, true);
         view = new IconView(iconElement);
-
         if (isHarmony()) {
-            assertEquals(icon.getIconWidth() + 2,
-                         view.getPreferredSpan(View.X_AXIS),
-                         0.1);
+            assertEquals(icon.getIconWidth() + 2, view.getPreferredSpan(View.X_AXIS), 0.1);
         } else {
-            assertEquals(icon.getIconWidth(),
-                         view.getPreferredSpan(View.X_AXIS),
-                         0.1);
+            assertEquals(icon.getIconWidth(), view.getPreferredSpan(View.X_AXIS), 0.1);
         }
-        assertEquals(icon.getIconHeight(), view.getPreferredSpan(View.Y_AXIS),
-                0.1);
+        assertEquals(icon.getIconHeight(), view.getPreferredSpan(View.Y_AXIS), 0.1);
     }
 
     public void testGetAlignment() {
-
         assertEquals(View.ALIGN_CENTER, view.getAlignment(View.X_AXIS), 0.1);
         assertEquals(View.ALIGN_RIGHT, view.getAlignment(View.Y_AXIS), 0.1);
-
         assertEquals(View.ALIGN_CENTER, view.getAlignment(2), 0.1);
         assertEquals(View.ALIGN_CENTER, view.getAlignment(-1), 0.1);
     }
 
     public void testModelToView() throws BadLocationException {
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.modelToView(1, new Rectangle(), Position.Bias.Backward);
             }
         });
-
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.modelToView(5, new Rectangle(), Position.Bias.Forward);
             }
         });
-
         assertEquals(3, view.getStartOffset());
         view.modelToView(3, new Rectangle(), Position.Bias.Backward);
         view.modelToView(3, new Rectangle(), Position.Bias.Forward);
-
         assertEquals(4, view.getEndOffset());
         view.modelToView(4, new Rectangle(), Position.Bias.Backward);
         view.modelToView(4, new Rectangle(), Position.Bias.Forward);
-
         testExceptionalCase(new BadLocationCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.modelToView(500, new Rectangle(), Position.Bias.Forward);
             }
         });
-
         Shape box;
-
-        box = view.modelToView(3, new Rectangle(2, 5, 20, 30),
-                Position.Bias.Backward);
+        box = view.modelToView(3, new Rectangle(2, 5, 20, 30), Position.Bias.Backward);
         assertNotNull(box);
         checkBounds(2, 5, 30, box);
-
-        box = view.modelToView(3, new Rectangle(2, 3, icon.getIconWidth(), icon
-                .getIconHeight()), Position.Bias.Backward);
+        box = view.modelToView(3,
+                new Rectangle(2, 3, icon.getIconWidth(), icon.getIconHeight()),
+                Position.Bias.Backward);
         assertNotNull(box);
         checkBounds(2, 3, icon.getIconHeight(), box);
-
-        box = view.modelToView(4, new Rectangle(1, 1, 16, 7),
-                Position.Bias.Forward);
+        box = view.modelToView(4, new Rectangle(1, 1, 16, 7), Position.Bias.Forward);
         assertNotNull(box);
         checkBounds(17, 1, 7, box);
-
-        box = view.modelToView(4, new Rectangle(0, 0, 1, 1),
-                Position.Bias.Forward);
+        box = view.modelToView(4, new Rectangle(0, 0, 1, 1), Position.Bias.Forward);
         assertNotNull(box);
         checkBounds(1, 0, 1, box);
-
         Ellipse2D ellipse = new Ellipse2D.Float(25, 3, 30, 40);
         box = view.modelToView(4, ellipse, Position.Bias.Forward);
         checkBounds(55, 3, 40, box);
         box = view.modelToView(4, ellipse, Position.Bias.Backward);
         assertNotNull(box);
-
         checkBounds(55, 3, 40, box);
-
         Rectangle2D rect = new Rectangle2D() {
-
-            public void setRect(double x, double y,
-                                double width, double height) {
+            @Override
+            public void setRect(double x, double y, double width, double height) {
             }
 
+            @Override
             public int outcode(double x, double y) {
                 return 0;
             }
 
+            @Override
             public Rectangle2D createIntersection(Rectangle2D r) {
                 return null;
             }
 
+            @Override
             public Rectangle2D createUnion(Rectangle2D r) {
                 return null;
             }
 
+            @Override
             public double getX() {
                 return 1;
             }
 
+            @Override
             public double getY() {
                 return 2;
             }
 
+            @Override
             public double getWidth() {
                 return 50;
             }
 
+            @Override
             public double getHeight() {
                 return 60;
             }
 
+            @Override
             public boolean isEmpty() {
                 return false;
             }
@@ -238,38 +217,39 @@
     }
 
     public void testPaint() {
-
         Shape shape;
         Graphics g = createTestGraphics();
-
         shape = new Rectangle(4, 3, 2, 3);
         checkPaintIcon(g, shape, 10, 15);
-
         shape = new Rectangle(4, 3, 30, 40);
         checkPaintIcon(g, shape, 10, 15);
-
         shape = new Ellipse2D() {
-
+            @Override
             public double getX() {
                 return 12;
             }
 
+            @Override
             public double getY() {
                 return 4;
             }
 
+            @Override
             public double getWidth() {
                 return 30;
             }
 
+            @Override
             public double getHeight() {
                 return 5;
             }
 
+            @Override
             public boolean isEmpty() {
                 return false;
             }
 
+            @Override
             public void setFrame(double x, double y, double w, double h) {
                 return;
             }
@@ -277,16 +257,13 @@
             public Rectangle2D getBounds2D() {
                 return null;
             }
-
         };
         checkPaintIcon(g, shape, 2, 4);
     }
 
     public void testViewToModel() {
         Shape shape;
-
         shape = new Rectangle(4, 3, 20, 30);
-
         checkViewToModel(shape, 1, 1);
         checkViewToModel(shape, 1, 5);
         checkViewToModel(shape, 1, 15);
@@ -296,32 +273,35 @@
         checkViewToModel(shape, 16, 5);
         checkViewToModel(shape, 30, 5);
         checkViewToModel(shape, 46, 5);
-
         final Ellipse2D floatEllipse = new Ellipse2D.Float(25, 3, 3, 4);
         checkViewToModelWithEllipse(floatEllipse);
-
         Ellipse2D intEllipse = new Ellipse2D() {
-
+            @Override
             public double getX() {
                 return 25;
             }
 
+            @Override
             public double getY() {
                 return 3;
             }
 
+            @Override
             public double getWidth() {
                 return 3;
             }
 
+            @Override
             public double getHeight() {
                 return 4;
             }
 
+            @Override
             public boolean isEmpty() {
                 return false;
             }
 
+            @Override
             public void setFrame(double x, double y, double w, double h) {
                 return;
             }
@@ -329,23 +309,23 @@
             public Rectangle2D getBounds2D() {
                 return null;
             }
-
         };
         checkViewToModelWithEllipse(intEllipse);
     }
 
     private void checkViewToModelWithEllipse(final Ellipse2D ellipse) {
-
         if (isHarmony()) {
             checkViewToModel(ellipse, 25, 15);
             checkViewToModel(ellipse, 26, 5);
         } else {
             testExceptionalCase(new ClassCastCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     checkViewToModel(ellipse, 25, 15);
                 }
             });
             testExceptionalCase(new ClassCastCase() {
+                @Override
                 public void exceptionalAction() throws Exception {
                     checkViewToModel(ellipse, 26, 5);
                 }
@@ -362,10 +342,8 @@
     }
 
     private void checkViewToModel(Shape shape, int x, int y) {
-
         Position.Bias[] bias = new Position.Bias[1];
         int position = view.viewToModel(x, y, shape, bias);
-
         if (x > shape.getBounds().width / 2 + shape.getBounds().x - 1) {
             assertEquals(Position.Bias.Backward, bias[0]);
             assertEquals(position, iconElement.getEndOffset());
@@ -375,26 +353,19 @@
         }
     }
 
-    private void checkPaintIcon(Graphics g, Shape shape, int iconWidth,
-            int iconHeight) {
-
+    private void checkPaintIcon(Graphics g, Shape shape, int iconWidth, int iconHeight) {
         textPane.setCaretPosition(3);
         icon = createIcon(shape, iconWidth, iconHeight);
         textPane.insertIcon(icon);
-
-        iconElement = document.getDefaultRootElement().getElement(0)
-                .getElement(1);
-
+        iconElement = document.getDefaultRootElement().getElement(0).getElement(1);
         view = new IconView(iconElement);
-        assertEquals(StyleConstants.getIcon(view.getElement().getAttributes()),
-                icon);
+        assertEquals(StyleConstants.getIcon(view.getElement().getAttributes()), icon);
         view.paint(g, shape);
     }
 
     private Icon createIcon(Shape shape, final int width, final int height) {
         final Rectangle bounds = shape.getBounds();
         return new Icon() {
-
             public void paintIcon(Component c, Graphics g, int x, int y) {
                 if (isHarmony()) {
                     assertEquals(x, bounds.x + 1);
@@ -411,7 +382,6 @@
             public int getIconHeight() {
                 return height;
             }
-
         };
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterRTest.java Sun Nov 26 12:15:43 2006
@@ -25,20 +25,23 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-
+import javax.swing.BasicSwingTestCase;
 import javax.swing.JFormattedTextField;
 import javax.swing.SwingTestCase;
 
 public class InternationalFormatterRTest extends SwingTestCase {
     InternationalFormatter formatter;
+
     boolean bWasException;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         formatter = new InternationalFormatter(new DecimalFormat());
         bWasException = false;
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -49,16 +52,16 @@
             formatter.stringToValue("55");
         } catch (ParseException e) {
             bWasException = true;
-         }
-         assertFalse(bWasException);
+        }
+        assertFalse(bWasException);
     }
 
     public void testStringToValue_Value() {
         formatter.setValueClass(Integer.class);
         try {
-           assertTrue(formatter.stringToValue("55") instanceof Integer);
+            assertTrue(formatter.stringToValue("55") instanceof Integer);
         } catch (ParseException e) {
-           bWasException = true;
+            bWasException = true;
         }
         assertFalse(bWasException);
     }
@@ -76,27 +79,24 @@
     }
 
     public void testIncrementDecrement() {
-        if (!SwingTestCase.isHarmony()) {
+        if (!BasicSwingTestCase.isHarmony()) {
             return;
         }
         JFormattedTextField ftf = new JFormattedTextField();
-        ftf.setFormatterFactory(new DefaultFormatterFactory(new
-            DateFormatter(new SimpleDateFormat("dd.MM.yyyy"))));
+        ftf.setFormatterFactory(new DefaultFormatterFactory(new DateFormatter(
+                new SimpleDateFormat("dd.MM.yyyy"))));
         ftf.setValue(new Date());
         ftf.setText("31.01.2006");
         ftf.setCaretPosition(0);
-        TextAction action = new InternationalFormatter.IncrementAction("inc",
-                                                                       1);
+        TextAction action = new InternationalFormatter.IncrementAction("inc", 1);
         action.actionPerformed(new ActionEvent(ftf, 0, null));
         assertEquals("01.02.2006", ftf.getText());
         assertEquals(2, ftf.getCaretPosition());
         assertEquals("01", ftf.getSelectedText());
-        action = new InternationalFormatter.IncrementAction("inc",
-                                                            -1);
+        action = new InternationalFormatter.IncrementAction("inc", -1);
         action.actionPerformed(new ActionEvent(ftf, 0, null));
         assertEquals("31.01.2006", ftf.getText());
         assertEquals(2, ftf.getCaretPosition());
         assertEquals("31", ftf.getSelectedText());
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/InternationalFormatterTest.java Sun Nov 26 12:15:43 2006
@@ -20,7 +20,6 @@
  */
 package javax.swing.text;
 
-
 import java.text.AttributedCharacterIterator;
 import java.text.Format;
 import java.text.NumberFormat;
@@ -30,20 +29,25 @@
 
 public class InternationalFormatterTest extends SwingTestCase {
     InternationalFormatter formatter;
+
     JFormattedTextField ftf;
+
     boolean bWasException;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         formatter = new InternationalFormatter() {
-//            boolean getSupportsIncrement() {
-//                return super.getStrue;
-//            }
+            private static final long serialVersionUID = 1L;
+            //            boolean getSupportsIncrement() {
+            //                return super.getStrue;
+            //            }
         };
         ftf = new JFormattedTextField();
         bWasException = false;
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -84,19 +88,17 @@
         formatter.setOverwriteMode(true);
         Format format = NumberFormat.getCurrencyInstance();
         formatter.setFormat(format);
-        Comparable max = new Integer(23);
-        Comparable min = new Integer(24);
+        Comparable<?> max = new Integer(23);
+        Comparable<?> min = new Integer(24);
         formatter.setMaximum(max);
         formatter.setMinimum(min);
-
         try {
             clone = formatter.clone();
         } catch (CloneNotSupportedException e) {
             assertFalse("Unexpected exception: " + e.getMessage(), true);
         }
-
         assertTrue(clone instanceof InternationalFormatter);
-        InternationalFormatter form = (InternationalFormatter)clone;
+        InternationalFormatter form = (InternationalFormatter) clone;
         assertFalse(form.getAllowsInvalid());
         assertTrue(form.getCommitsOnValidEdit());
         assertTrue(form.getOverwriteMode());
@@ -108,16 +110,13 @@
     public void testGetActions() {
     }
 
-
     public void testStringToValue() {
-
         assertNull(formatter.getFormat());
         assertNull(formatter.getValueClass());
         try {
             assertNull(formatter.stringToValue(null));
             assertEquals("234", formatter.stringToValue("234"));
             formatter.setFormat(NumberFormat.getNumberInstance());
-
             assertEquals(new Long(723), formatter.stringToValue("723"));
             formatter.setMaximum(new Long(23)); //if Integer
             formatter.setMinimum(new Long(20));
@@ -125,28 +124,24 @@
         } catch (ParseException e) {
             assertTrue("Unexpected exception: ", false);
         }
-
         try {
             formatter.stringToValue("-27");
         } catch (ParseException e) {
             bWasException = true;
         }
         checkException();
-
         try {
             formatter.stringToValue("abc12");
         } catch (ParseException e) {
             bWasException = true;
         }
         checkException();
-
         try {
             formatter.stringToValue("true");
         } catch (ParseException e) {
             bWasException = true;
         }
         checkException();
-
         try {
             formatter.setFormat(null);
             formatter.setValueClass(Boolean.class);
@@ -164,15 +159,12 @@
             Object value;
             assertNull(formatter.getFormat());
             assertEquals("234", formatter.valueToString(new Integer(234)));
-
             value = new DefaultCaret();
             assertEquals(value.toString(), formatter.valueToString(value));
-
             Format format = NumberFormat.getPercentInstance();
             formatter.setFormat(format);
             value = new Integer(456);
             assertEquals(format.format(value), formatter.valueToString(value));
-
             format = NumberFormat.getCurrencyInstance();
             formatter.setFormat(format);
             value = new Integer(345);
@@ -184,14 +176,12 @@
 
     public void testGetFields() {
         ftf.setValue(new Integer(345));
-        formatter = (InternationalFormatter)ftf.getFormatter();
+        formatter = (InternationalFormatter) ftf.getFormatter();
         Format format = formatter.getFormat();
         Format.Field[] fields = formatter.getFields(0);
         assertEquals(1, fields.length);
-        AttributedCharacterIterator iter = format.formatToCharacterIterator
-            (new Integer(345));
+        AttributedCharacterIterator iter = format.formatToCharacterIterator(new Integer(345));
         assertTrue(iter.getAttributes().containsKey(fields[0]));
-
         assertEquals(0, formatter.getFields(-7).length);
         //TODO
         //formatter.setFormat(null);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/JTextComponentRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/JTextComponentRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/JTextComponentRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/JTextComponentRTest.java Sun Nov 26 12:15:43 2006
@@ -21,12 +21,13 @@
 package javax.swing.text;
 
 import java.awt.event.KeyEvent;
-
 import junit.framework.TestCase;
 
 public class JTextComponentRTest extends TestCase {
-    
     class JMyTextComponent extends JTextComponent {
+        private static final long serialVersionUID = 1L;
+
+        @Override
         public String getUIClassID() {
             return "TextFieldUI";
         }
@@ -36,10 +37,12 @@
         }
     };
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -50,7 +53,7 @@
         c.setKeymap(null);
         c.test(event);
     }
-    
+
     public void testUpdateUI() {
         // regression test for HARMONY-1475
         JMyTextComponent c = new JMyTextComponent();



Mime
View raw message