harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [33/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/ParagraphViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java Sun Nov 26 12:15:43 2006
@@ -24,7 +24,6 @@
 import java.awt.Graphics;
 import java.awt.Rectangle;
 import java.awt.Shape;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.JTextArea;
 import javax.swing.SwingConstants;
@@ -37,12 +36,18 @@
 
 public class ParagraphViewTest extends BasicSwingTestCase {
     private static final int HEIGHT = 30;
+
     private static final int WIDTH = PartView.CHAR_WIDTH * 10;
+
     private StyledDocument doc;
+
     private Element root;
+
     private Element paragraph;
+
     private ParagraphView view;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
@@ -54,7 +59,6 @@
         attrs = new SimpleAttributeSet();
         StyleConstants.setItalic(attrs, true);
         doc.setCharacterAttributes(9, 6, attrs, false);
-
         root = doc.getDefaultRootElement();
         paragraph = root.getElement(0);
         view = new ParagraphView(paragraph);
@@ -63,27 +67,24 @@
     public void testParagraphView() {
         final Marker propertiesSet = new Marker();
         view = new ParagraphView(paragraph) {
+            @Override
             protected void setPropertiesFromAttributes() {
                 propertiesSet.setOccurred();
                 super.setPropertiesFromAttributes();
             };
         };
         assertTrue(propertiesSet.isOccurred());
-
         assertEquals(0, view.getViewCount());
         assertEquals(View.Y_AXIS, view.getAxis());
         assertEquals(View.X_AXIS, view.getFlowAxis());
         assertNull(view.layoutPool);
-
         // Testing insets
         assertEquals(0, view.getTopInset());
         assertEquals(0, view.getLeftInset());
         assertEquals(0, view.getBottomInset());
         assertEquals(0, view.getRightInset());
-
         AttributeSet attrs = getInsetsAttributeSet();
         doc.setParagraphAttributes(0, 1, attrs, false);
-
         view.setPropertiesFromAttributes();
         assertEquals(9, view.getTopInset());
         assertEquals(4, view.getLeftInset());
@@ -93,25 +94,21 @@
 
     public void testGetAlignment() {
         loadChilrenAndLayout();
-
         final int height = view.getSpan(View.Y_AXIS, 0);
-
         assertEquals(0, view.firstLineIndent);
         assertEquals(0.5f, view.getAlignment(View.X_AXIS), 1e-5f);
-        assertEquals((height / 2) / view.getPreferredSpan(View.Y_AXIS),
-                     view.getAlignment(View.Y_AXIS), 1e-5f);
+        assertEquals((height / 2) / view.getPreferredSpan(View.Y_AXIS), view
+                .getAlignment(View.Y_AXIS), 1e-5f);
         // But if height is of type float the assertion fails
-//        assertEquals((height / 2.0) / view.getPreferredSpan(View.Y_AXIS),
-//                     view.getAlignment(View.Y_AXIS), 1e-5f);
-
+        //        assertEquals((height / 2.0) / view.getPreferredSpan(View.Y_AXIS),
+        //                     view.getAlignment(View.Y_AXIS), 1e-5f);
         view.layoutChanged(View.X_AXIS);
         view.layout(WIDTH, HEIGHT);
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
-        assertEquals(view.firstLineIndent,
-                     ((CompositeView)view.getView(0)).getLeftInset());
+        assertEquals(view.firstLineIndent, ((CompositeView) view.getView(0)).getLeftInset());
         assertEquals(0.5f, view.getAlignment(View.X_AXIS), 1e-5f);
-        assertEquals((height / 2) / view.getPreferredSpan(View.Y_AXIS),
-                     view.getAlignment(View.Y_AXIS), 1e-5f);
+        assertEquals((height / 2) / view.getPreferredSpan(View.Y_AXIS), view
+                .getAlignment(View.Y_AXIS), 1e-5f);
     }
 
     public void testGetAlignmentNoChildren() {
@@ -124,31 +121,22 @@
         assertEquals(0, view.firstLineIndent);
         view.setFirstLineIndent(3.21f);
         assertEquals(3, view.firstLineIndent);
-
         MutableAttributeSet attrs = new SimpleAttributeSet();
         StyleConstants.setFirstLineIndent(attrs, 5.61f);
         doc.setParagraphAttributes(0, 1, attrs, false);
-        assertTrue(view.getAttributes().isDefined(
-                           StyleConstants.FirstLineIndent));
-
+        assertTrue(view.getAttributes().isDefined(StyleConstants.FirstLineIndent));
         view.loadChildren(null);
         assertNotNull(view.layoutPool);
-
-        view.changedUpdate(((AbstractDocument)doc).new DefaultDocumentEvent(
-                               0, paragraph.getEndOffset(), EventType.CHANGE),
-                           null, null);
+        view.changedUpdate(((AbstractDocument) doc).new DefaultDocumentEvent(0, paragraph
+                .getEndOffset(), EventType.CHANGE), null, null);
         assertEquals(5, view.firstLineIndent);
     }
 
     public void testChangedUpdateInvalidate() {
         loadChilrenAndLayout();
-
         assertTrue(view.isAllocationValid());
-
-        view.changedUpdate(((AbstractDocument)doc).new DefaultDocumentEvent(
-                               0, paragraph.getEndOffset(), EventType.CHANGE),
-                           null, null);
-
+        view.changedUpdate(((AbstractDocument) doc).new DefaultDocumentEvent(0, paragraph
+                .getEndOffset(), EventType.CHANGE), null, null);
         assertFalse(view.isAllocationValid());
     }
 
@@ -156,21 +144,17 @@
         View row = view.createRow();
         assertEquals(0, row.getViewCount());
         assertTrue(row instanceof BoxView);
-        assertEquals("javax.swing.text.ParagraphView$Row",
-                     row.getClass().getName());
-        assertEquals(View.X_AXIS, ((BoxView)row).getAxis());
-
-        CompositeView rowView = (CompositeView)row;
+        assertEquals("javax.swing.text.ParagraphView$Row", row.getClass().getName());
+        assertEquals(View.X_AXIS, ((BoxView) row).getAxis());
+        CompositeView rowView = (CompositeView) row;
         assertEquals(0, rowView.getTopInset());
         assertEquals(0, rowView.getLeftInset());
         assertEquals(0, rowView.getBottomInset());
         assertEquals(0, rowView.getRightInset());
-
         AttributeSet attrs = getInsetsAttributeSet();
         doc.setParagraphAttributes(0, 1, attrs, false);
-
         view.setPropertiesFromAttributes();
-        rowView = (CompositeView)view.createRow();
+        rowView = (CompositeView) view.createRow();
         assertEquals(0, rowView.getTopInset());
         assertEquals(0, rowView.getLeftInset());
         assertEquals(0, rowView.getBottomInset());
@@ -179,15 +163,13 @@
 
     public void testCreateRowFirstLineIndent() {
         view.setFirstLineIndent(PartView.CHAR_WIDTH * 3);
-
-        CompositeView row = (CompositeView)view.createRow();
+        CompositeView row = (CompositeView) view.createRow();
         assertEquals(0, row.getTopInset());
         assertEquals(0, row.getLeftInset());
         assertEquals(0, row.getBottomInset());
         assertEquals(0, row.getRightInset());
-
         loadChilrenAndLayout();
-        row = (CompositeView)view.getView(0);
+        row = (CompositeView) view.getView(0);
         assertEquals(view.firstLineIndent, row.getLeftInset());
         assertEquals(0, row.getTopInset());
         assertEquals(0, row.getBottomInset());
@@ -195,109 +177,92 @@
     }
 
     /*public void testGetFlowStartEmpty() {
-        assertEquals(0, view.getFlowStart(0));
-
-        try {
-            view.getFlowStart(1);
+     assertEquals(0, view.getFlowStart(0));
 
-            fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+     try {
+     view.getFlowStart(1);
 
-        try {
-            view.getFlowStart(-1);
+     fail("ArrayIndexOutOfBoundsException is expected");
+     } catch (ArrayIndexOutOfBoundsException e) { }
 
-            fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
-    }*/
+     try {
+     view.getFlowStart(-1);
 
+     fail("ArrayIndexOutOfBoundsException is expected");
+     } catch (ArrayIndexOutOfBoundsException e) { }
+     }*/
     /*public void testGetFlowSpanEmpty() {
-        final boolean[] callSuper = new boolean[] {true};
+     final boolean[] callSuper = new boolean[] {true};
 
-        view = new ParagraphView(paragraph) {
-            public View getView(int index) {
-                return callSuper[0] ? super.getView(index) : null;
-            }
-        };
-        assertEquals(view.layoutSpan, view.getFlowSpan(0));
-
-        try {
-            view.getFlowSpan(1);
+     view = new ParagraphView(paragraph) {
+     public View getView(int index) {
+     return callSuper[0] ? super.getView(index) : null;
+     }
+     };
+     assertEquals(view.layoutSpan, view.getFlowSpan(0));
 
-            fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+     try {
+     view.getFlowSpan(1);
 
-        try {
-            view.getFlowSpan(-1);
+     fail("ArrayIndexOutOfBoundsException is expected");
+     } catch (ArrayIndexOutOfBoundsException e) { }
 
-            fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+     try {
+     view.getFlowSpan(-1);
 
-        callSuper[0] = false;
+     fail("ArrayIndexOutOfBoundsException is expected");
+     } catch (ArrayIndexOutOfBoundsException e) { }
 
-        assertEquals(view.layoutSpan, view.getFlowSpan(0));
-        assertEquals(view.layoutSpan, view.getFlowSpan(1));
-        assertEquals(view.layoutSpan, view.getFlowSpan(-1));
-    }*/
+     callSuper[0] = false;
 
+     assertEquals(view.layoutSpan, view.getFlowSpan(0));
+     assertEquals(view.layoutSpan, view.getFlowSpan(1));
+     assertEquals(view.layoutSpan, view.getFlowSpan(-1));
+     }*/
     public void testGetFlowStart() {
-        view.replace(0, view.getViewCount(),
-                     new View[] {view.createRow(), view.createRow()});
-
+        view.replace(0, view.getViewCount(), new View[] { view.createRow(), view.createRow() });
         assertEquals(0, view.firstLineIndent);
         assertEquals(0, view.getFlowStart(0));
         assertEquals(0, view.getFlowStart(1));
-
         view.firstLineIndent = 31;
         assertEquals(31, view.getFlowStart(0));
         assertEquals(0, view.getFlowStart(1));
-
-        ((CompositeView)view.getView(0)).setInsets((short)7, (short)9 /*left*/,
-                                                   (short)21, (short)11);
+        ((CompositeView) view.getView(0)).setInsets((short) 7, (short) 9 /*left*/, (short) 21,
+                (short) 11);
         assertEquals(31 + 9, view.getFlowStart(0));
     }
 
     public void testGetFlowSpan() {
-        view.replace(0, view.getViewCount(),
-                     new View[] {view.createRow(), view.createRow()});
-
+        view.replace(0, view.getViewCount(), new View[] { view.createRow(), view.createRow() });
         assertEquals(0, view.firstLineIndent);
         assertEquals(Short.MAX_VALUE, view.layoutSpan);
         assertEquals(Short.MAX_VALUE, view.getFlowSpan(0));
         assertEquals(Short.MAX_VALUE, view.getFlowSpan(1));
-
         view.firstLineIndent = 31;
         assertEquals(Short.MAX_VALUE - 31, view.getFlowSpan(0));
         assertEquals(Short.MAX_VALUE, view.getFlowSpan(1));
-
         view.layoutSpan = 531;
         assertEquals(500, view.getFlowSpan(0));
         assertEquals(531, view.getFlowSpan(1));
-
-        ((CompositeView)view.getView(0)).setInsets((short)7, (short)9,
-                                                   (short)21, (short)11);
+        ((CompositeView) view.getView(0)).setInsets((short) 7, (short) 9, (short) 21,
+                (short) 11);
         assertEquals(500 - 9 - 11, view.getFlowSpan(0));
     }
 
     public void testNextTabStop() {
         assertNull(view.getTabSet());
-
         assertEquals(72f, view.nextTabStop(0, 0), 1e-5f);
         assertEquals(72f, view.nextTabStop(71.9f, 0), 1e-5f);
         assertEquals(72f * 2, view.nextTabStop(72f, 0), 1e-5f);
     }
 
     public void testNextTabStopTabSet() {
-        final TabSet tabSet = new TabSet(new TabStop[] {
-            new TabStop(10f),
-            new TabStop(12f),
-            new TabStop(15f)
-        });
+        final TabSet tabSet = new TabSet(new TabStop[] { new TabStop(10f), new TabStop(12f),
+                new TabStop(15f) });
         MutableAttributeSet attrs = new SimpleAttributeSet();
         StyleConstants.setTabSet(attrs, tabSet);
         doc.setParagraphAttributes(0, 1, attrs, false);
-
         assertSame(tabSet, view.getTabSet());
-
         assertEquals(10f, view.nextTabStop(0, 0), 1e-5f);
         assertEquals(10f, view.nextTabStop(9.99f, 0), 1e-5f);
         assertEquals(12f, view.nextTabStop(10f, 0), 1e-5f);
@@ -312,7 +277,6 @@
             assertEquals(20f, view.nextTabStop(15f, 0), 1e-5f);
             assertEquals(25f, view.nextTabStop(20f, 0), 1e-5f);
         }
-
         assertEquals(10f, view.nextTabStop(0, 4), 1e-5f);
         assertEquals(10f, view.nextTabStop(0, 5), 1e-5f);
         assertEquals(10f, view.nextTabStop(0, 15), 1e-5f);
@@ -321,20 +285,14 @@
     }
 
     public void testNextTabStopTabSetTabBase() {
-        final TabSet tabSet = new TabSet(new TabStop[] {
-            new TabStop(10f),
-            new TabStop(12f),
-            new TabStop(15f)
-        });
+        final TabSet tabSet = new TabSet(new TabStop[] { new TabStop(10f), new TabStop(12f),
+                new TabStop(15f) });
         MutableAttributeSet attrs = new SimpleAttributeSet();
         StyleConstants.setTabSet(attrs, tabSet);
         doc.setParagraphAttributes(0, 1, attrs, false);
-
         view.paint(createTestGraphics(), new Rectangle(11, 21, 431, 527));
         assertEquals(11, view.getTabBase(), 1e-5f);
-
         assertSame(tabSet, view.getTabSet());
-
         assertEquals(11 + 10f, view.nextTabStop(0, 0), 1e-5f);
         assertEquals(11 + 10f, view.nextTabStop(10f, 0), 1e-5f);
         assertEquals(11 + 10f, view.nextTabStop(20.99f, 0), 1e-5f);
@@ -345,37 +303,31 @@
     public void testNextTabStopTabSetAlign() throws BadLocationException {
         doc.remove(0, doc.getLength());
         doc.insertString(0, "1\tleft\tcenter\tright\tdecimal 10.124\t"
-                         //  01 23456 7890123 456789 012345678901234
-                         //  0           1           2         3
-                            + "bar\tleft\tnext tab\tnext", null);
-                         //    5678 90123 456789012 3456
-                         //          4          5
+        //  01 23456 7890123 456789 012345678901234
+                //  0           1           2         3
+                + "bar\tleft\tnext tab\tnext", null);
+        //    5678 90123 456789012 3456
+        //          4          5
         paragraph = root.getElement(0);
-
         final TabSet tabSet = new TabSet(new TabStop[] {
-            new TabStop(5f, TabStop.ALIGN_LEFT, TabStop.LEAD_NONE),
-            new TabStop(20f, TabStop.ALIGN_CENTER, TabStop.LEAD_DOTS),
-            new TabStop(39f, TabStop.ALIGN_RIGHT, TabStop.LEAD_EQUALS),
-            new TabStop(61f, TabStop.ALIGN_DECIMAL, TabStop.LEAD_HYPHENS),
-            new TabStop(71.9f, TabStop.ALIGN_BAR, TabStop.LEAD_NONE),
-            new TabStop(79.213f, TabStop.ALIGN_LEFT, TabStop.LEAD_UNDERLINE),
-        });
+                new TabStop(5f, TabStop.ALIGN_LEFT, TabStop.LEAD_NONE),
+                new TabStop(20f, TabStop.ALIGN_CENTER, TabStop.LEAD_DOTS),
+                new TabStop(39f, TabStop.ALIGN_RIGHT, TabStop.LEAD_EQUALS),
+                new TabStop(61f, TabStop.ALIGN_DECIMAL, TabStop.LEAD_HYPHENS),
+                new TabStop(71.9f, TabStop.ALIGN_BAR, TabStop.LEAD_NONE),
+                new TabStop(79.213f, TabStop.ALIGN_LEFT, TabStop.LEAD_UNDERLINE), });
         MutableAttributeSet attrs = new SimpleAttributeSet();
         StyleConstants.setTabSet(attrs, tabSet);
         doc.setParagraphAttributes(0, 1, attrs, false);
-
         view = new ParagraphView(paragraph);
         loadChildren();
-
         assertSame(tabSet, view.getTabSet());
-
         assertEquals(5f, view.nextTabStop(0, 0), 1e-5f);
         assertEquals(20f, view.nextTabStop(5f, 0), 1e-5f);
         assertEquals(39f, view.nextTabStop(20f, 0), 1e-5f);
         assertEquals(61f, view.nextTabStop(39f, 0), 1e-5f);
         assertEquals(71.9f, view.nextTabStop(61f, 0), 1e-5f);
         assertEquals(79.213f, view.nextTabStop(71.9f, 0), 1e-5f);
-
         assertEquals(5f, view.nextTabStop(0, 0), 1e-5f);
         assertEquals(5f, view.nextTabStop(0, 1), 1e-5f);
         assertEquals(14f, view.nextTabStop(5f, 2), 1e-5f);
@@ -386,35 +338,28 @@
 
     public void testBreakView() {
         loadChilrenAndLayout();
-
         assertEquals(2, view.getViewCount());
-
-        int width = (int)view.getPreferredSpan(View.X_AXIS);
-        int height = (int)view.getPreferredSpan(View.Y_AXIS);
-//        for (int i = 0; i < view.getViewCount(); i++) {
-//            System.out.println("[" + i + "]: ("
-//                               +  view.getOffset(View.X_AXIS, i) + ", "
-//                               + view.getOffset(View.Y_AXIS, i) + ") x ("
-//                               +  view.getSpan(View.X_AXIS, i) + ", "
-//                               + view.getSpan(View.Y_AXIS, i) + ") <-- "
-//                               + view.getView(i).getPreferredSpan(View.X_AXIS)
-//                               + " x "
-//                               + view.getView(i).getPreferredSpan(View.Y_AXIS));
-//        }
+        int width = (int) view.getPreferredSpan(View.X_AXIS);
+        int height = (int) view.getPreferredSpan(View.Y_AXIS);
+        //        for (int i = 0; i < view.getViewCount(); i++) {
+        //            System.out.println("[" + i + "]: ("
+        //                               +  view.getOffset(View.X_AXIS, i) + ", "
+        //                               + view.getOffset(View.Y_AXIS, i) + ") x ("
+        //                               +  view.getSpan(View.X_AXIS, i) + ", "
+        //                               + view.getSpan(View.Y_AXIS, i) + ") <-- "
+        //                               + view.getView(i).getPreferredSpan(View.X_AXIS)
+        //                               + " x "
+        //                               + view.getView(i).getPreferredSpan(View.Y_AXIS));
+        //        }
         assertEquals(64 /*WIDTH*/, width);
         assertEquals(PartView.CHAR_HEIGHT * 2, height);
-
         Shape alloc = new Rectangle(WIDTH, HEIGHT * 2);
         assertSame(view, view.breakView(View.X_AXIS, width / 2, alloc));
         assertSame(view, view.breakView(View.X_AXIS, width, alloc));
         assertSame(view, view.breakView(View.X_AXIS, width + 10, alloc));
-
-        assertSame(view, view.breakView(View.Y_AXIS,
-                                        PartView.CHAR_HEIGHT / 2, alloc));
-        assertSame(view, view.breakView(View.Y_AXIS,
-                                        PartView.CHAR_HEIGHT, alloc));
-        assertSame(view, view.breakView(View.Y_AXIS,
-                                        PartView.CHAR_HEIGHT + 10, alloc));
+        assertSame(view, view.breakView(View.Y_AXIS, PartView.CHAR_HEIGHT / 2, alloc));
+        assertSame(view, view.breakView(View.Y_AXIS, PartView.CHAR_HEIGHT, alloc));
+        assertSame(view, view.breakView(View.Y_AXIS, PartView.CHAR_HEIGHT + 10, alloc));
         assertSame(view, view.breakView(View.Y_AXIS, height, alloc));
         assertSame(view, view.breakView(View.Y_AXIS, height + 10, alloc));
     }
@@ -424,163 +369,120 @@
         assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 1));
         assertEquals(View.BadBreakWeight, view.getBreakWeight(View.X_AXIS, 0));
         assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0));
-
         View row = view.createRow();
         view.append(row);
         row.append(new PartView(paragraph.getElement(0)));
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getPreferredSpan(View.Y_AXIS));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 0.01f));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 1f));
-
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(View.BadBreakWeight, view
+                .getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 0.01f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 1f));
         view.append(row);
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 0.01f));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT * 2));
-
+        assertEquals(View.BadBreakWeight, view
+                .getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 0.01f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT * 2));
         assertFalse(view.isAllocationValid());
         loadChildren();
         view.layout(WIDTH, 30);
         assertTrue(view.isAllocationValid());
         assertEquals(2, view.getViewCount());
-
         row = view.getView(0);
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getPreferredSpan(View.Y_AXIS));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 0.01f));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 1f));
-
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT * 2));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT * 2 + 0.01f));
-
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(View.BadBreakWeight, view
+                .getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 0.01f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 1f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT * 2));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT * 2 + 0.01f));
         Graphics g = createTestGraphics();
         Rectangle area = new Rectangle(21, 13, WIDTH, HEIGHT);
         g.setClip(area);
         view.paint(g, area);
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getPreferredSpan(View.Y_AXIS));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 0.01f));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT + 1f));
-
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT * 2));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT * 2 + 0.01f));
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(View.BadBreakWeight, view
+                .getBreakWeight(View.Y_AXIS, PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 0.01f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT + 1f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT * 2));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT * 2 + 0.01f));
     }
 
     public void testGetBreakWeightSuper() throws Exception {
         View row = view.createRow();
         view.append(row);
         row.append(new PartView(paragraph.getElement(0)));
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getPreferredSpan(View.Y_AXIS));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0, PartView.CHAR_HEIGHT));
-        assertEquals(View.GoodBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT + 0.01f));
-        assertEquals(View.GoodBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT + 1f));
-
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT));
+        assertEquals(View.GoodBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT + 0.01f));
+        assertEquals(View.GoodBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT + 1f));
         view.append(row);
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0, PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS,
-                                         PartView.CHAR_HEIGHT,
-                                         PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT * 2));
-        assertEquals(View.GoodBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT * 2 + 0.01f));
-
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS,
+                PartView.CHAR_HEIGHT, PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT * 2));
+        assertEquals(View.GoodBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT * 2 + 0.01f));
         assertFalse(view.isAllocationValid());
         loadChilrenAndLayout();
         assertTrue(view.isAllocationValid());
         assertEquals(2, view.getViewCount());
-
         row = view.getView(0);
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getPreferredSpan(View.Y_AXIS));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0, PartView.CHAR_HEIGHT));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT + 0.01f));
-        assertEquals(View.BadBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT * 2));
-        assertEquals(View.GoodBreakWeight,
-                     view.getBreakWeight(View.Y_AXIS, 0,
-                                         PartView.CHAR_HEIGHT * 2 + 0.01f));
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT + 0.01f));
+        assertEquals(View.BadBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT * 2));
+        assertEquals(View.GoodBreakWeight, view.getBreakWeight(View.Y_AXIS, 0,
+                PartView.CHAR_HEIGHT * 2 + 0.01f));
     }
 
     public void testSetJustification() {
         view.setJustification(-10);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 0));
-
         final View row = view.getView(1);
         assertEquals(0.5f, row.getAlignment(View.X_AXIS), 1e-5);
         assertEquals(0f, row.getAlignment(View.Y_AXIS), 1e-5);
-
         final int len = row.getEndOffset() - row.getStartOffset();
         assertEquals(PartView.CHAR_HEIGHT, view.getOffset(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_WIDTH * len, view.getSpan(View.X_AXIS, 1));
-        assertEquals((WIDTH - view.getSpan(View.X_AXIS, 1)) / 2,
-                     view.getOffset(View.X_AXIS, 1));
+        assertEquals((WIDTH - view.getSpan(View.X_AXIS, 1)) / 2, view.getOffset(View.X_AXIS, 1));
     }
 
     public void testSetJustificationLeft() {
         view.setJustification(StyleConstants.ALIGN_LEFT);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 0));
-
         final View row = view.getView(1);
         assertEquals(0f, row.getAlignment(View.X_AXIS), 1e-5);
         assertEquals(0f, row.getAlignment(View.Y_AXIS), 1e-5);
-
         final int len = row.getEndOffset() - row.getStartOffset();
         assertEquals(0, view.getOffset(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT, view.getOffset(View.Y_AXIS, 1));
@@ -591,19 +493,15 @@
     public void testSetJustificationCenter() {
         view.setJustification(StyleConstants.ALIGN_CENTER);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 0));
-
         final View row = view.getView(1);
         assertEquals(0.5f, row.getAlignment(View.X_AXIS), 1e-5);
         assertEquals(0f, row.getAlignment(View.Y_AXIS), 1e-5);
-
         final int len = row.getEndOffset() - row.getStartOffset();
-        assertEquals((WIDTH - view.getSpan(View.X_AXIS, 1)) / 2,
-                     view.getOffset(View.X_AXIS, 1));
+        assertEquals((WIDTH - view.getSpan(View.X_AXIS, 1)) / 2, view.getOffset(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT, view.getOffset(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_WIDTH * len, view.getSpan(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 1));
@@ -612,19 +510,15 @@
     public void testSetJustificationRight() {
         view.setJustification(StyleConstants.ALIGN_RIGHT);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 0));
-
         final View row = view.getView(1);
         assertEquals(1.0f, row.getAlignment(View.X_AXIS), 1e-5);
         assertEquals(0f, row.getAlignment(View.Y_AXIS), 1e-5);
-
         final int len = row.getEndOffset() - row.getStartOffset();
-        assertEquals(WIDTH - view.getSpan(View.X_AXIS, 1),
-                     view.getOffset(View.X_AXIS, 1));
+        assertEquals(WIDTH - view.getSpan(View.X_AXIS, 1), view.getOffset(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT, view.getOffset(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_WIDTH * len, view.getSpan(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT, view.getSpan(View.Y_AXIS, 1));
@@ -633,155 +527,129 @@
     public void testSetLineSpacing() {
         view.setLineSpacing(2);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
         assertEquals(PartView.CHAR_HEIGHT * 3, view.getSpan(View.Y_AXIS, 0));
-
         final View row = view.getView(1);
         final int len = row.getEndOffset() - row.getStartOffset();
         assertEquals(0, view.getOffset(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT * 3, view.getOffset(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_WIDTH * len, view.getSpan(View.X_AXIS, 1));
         assertEquals(PartView.CHAR_HEIGHT * 3, view.getSpan(View.Y_AXIS, 1));
-
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getView(0).getPreferredSpan(View.Y_AXIS));
-        assertEquals(PartView.CHAR_HEIGHT * 3,
-                     (int)row.getPreferredSpan(View.Y_AXIS));
-        assertEquals(0, ((CompositeView)row).getTopInset());
-        assertEquals(PartView.CHAR_HEIGHT * 2,
-                     ((CompositeView)row).getBottomInset());
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getView(0).getPreferredSpan(View.Y_AXIS));
+        assertEquals(PartView.CHAR_HEIGHT * 3, (int) row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(0, ((CompositeView) row).getTopInset());
+        assertEquals(PartView.CHAR_HEIGHT * 2, ((CompositeView) row).getBottomInset());
     }
 
     public void testSetLineSpacingFraction() {
         view.setLineSpacing(1.25f);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
-        assertEquals((int)(PartView.CHAR_HEIGHT * 2.25f),
-                     view.getSpan(View.Y_AXIS, 0));
-
+        assertEquals((int) (PartView.CHAR_HEIGHT * 2.25f), view.getSpan(View.Y_AXIS, 0));
         final View row = view.getView(1);
         final int len = row.getEndOffset() - row.getStartOffset();
         assertEquals(0, view.getOffset(View.X_AXIS, 1));
-        assertEquals((int)(PartView.CHAR_HEIGHT * 2.25f),
-                     view.getOffset(View.Y_AXIS, 1));
+        assertEquals((int) (PartView.CHAR_HEIGHT * 2.25f), view.getOffset(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_WIDTH * len, view.getSpan(View.X_AXIS, 1));
-        assertEquals((int)(PartView.CHAR_HEIGHT * 2.25f),
-                     view.getSpan(View.Y_AXIS, 1));
-
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getView(0).getPreferredSpan(View.Y_AXIS));
-        assertEquals((int)(PartView.CHAR_HEIGHT * 2.25f),
-                     (int)row.getPreferredSpan(View.Y_AXIS));
+        assertEquals((int) (PartView.CHAR_HEIGHT * 2.25f), view.getSpan(View.Y_AXIS, 1));
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getView(0).getPreferredSpan(View.Y_AXIS));
+        assertEquals((int) (PartView.CHAR_HEIGHT * 2.25f), (int) row
+                .getPreferredSpan(View.Y_AXIS));
     }
 
     public void testSetLineSpacingNegative() {
         view.setLineSpacing(-1f);
         loadChilrenAndLayout();
-
         assertEquals(0, view.getOffset(View.X_AXIS, 0));
         assertEquals(0, view.getOffset(View.Y_AXIS, 0));
         assertEquals(WIDTH, view.getSpan(View.X_AXIS, 0));
         assertEquals(0, view.getSpan(View.Y_AXIS, 0));
-
         final View row = view.getView(1);
         final int len = row.getEndOffset() - row.getStartOffset();
         assertEquals(0, view.getOffset(View.X_AXIS, 1));
         assertEquals(0, view.getOffset(View.Y_AXIS, 1));
         assertEquals(PartView.CHAR_WIDTH * len, view.getSpan(View.X_AXIS, 1));
         assertEquals(0, view.getSpan(View.Y_AXIS, 1));
-
-        assertEquals(PartView.CHAR_HEIGHT,
-                     (int)row.getView(0).getPreferredSpan(View.Y_AXIS));
-        assertEquals(0, (int)row.getPreferredSpan(View.Y_AXIS));
+        assertEquals(PartView.CHAR_HEIGHT, (int) row.getView(0).getPreferredSpan(View.Y_AXIS));
+        assertEquals(0, (int) row.getPreferredSpan(View.Y_AXIS));
     }
 
     public void testSetFirstLineIndent() {
         assertEquals(0, view.firstLineIndent);
-
         view.setFirstLineIndent(1.2f);
         assertEquals(1, view.firstLineIndent);
-
         view.setFirstLineIndent(1.9f);
         assertEquals(1, view.firstLineIndent);
-
         view.setFirstLineIndent(2f);
         assertEquals(2, view.firstLineIndent);
     }
 
     public void testSetFirstLineIndentRow() {
         loadChilrenAndLayout();
-
         assertTrue(view.isAllocationValid());
-        assertEquals(0, ((CompositeView)view.getView(0)).getLeftInset());
-        assertEquals(WIDTH / PartView.CHAR_WIDTH,
-                     view.getView(0).getEndOffset());
-
+        assertEquals(0, ((CompositeView) view.getView(0)).getLeftInset());
+        assertEquals(WIDTH / PartView.CHAR_WIDTH, view.getView(0).getEndOffset());
         view.setFirstLineIndent(PartView.CHAR_WIDTH * 3);
         assertTrue(view.isAllocationValid());
-        assertEquals(view.firstLineIndent,
-                     ((CompositeView)view.getView(0)).getLeftInset());
-
+        assertEquals(view.firstLineIndent, ((CompositeView) view.getView(0)).getLeftInset());
         view.layout(WIDTH, HEIGHT);
-        assertEquals(WIDTH / PartView.CHAR_WIDTH,
-                     view.getView(0).getEndOffset());
-
+        assertEquals(WIDTH / PartView.CHAR_WIDTH, view.getView(0).getEndOffset());
         view.layoutChanged(View.X_AXIS);
         view.layout(WIDTH, HEIGHT);
-        assertEquals(WIDTH / PartView.CHAR_WIDTH - 3,
-                     view.getView(0).getEndOffset());
+        assertEquals(WIDTH / PartView.CHAR_WIDTH - 3, view.getView(0).getEndOffset());
     }
 
     public void testSetPropertiesFromAttributes() {
         final Marker jm = new Marker();
         final Marker flim = new Marker();
         final Marker lsm = new Marker();
-
         MutableAttributeSet attrs = new SimpleAttributeSet();
         StyleConstants.setAlignment(attrs, -2);
         StyleConstants.setFirstLineIndent(attrs, 1.167f);
         StyleConstants.setLineSpacing(attrs, 1.324f);
-
         doc.setParagraphAttributes(0, 1, attrs, false);
         view = new ParagraphView(paragraph) {
+            @Override
             protected void setJustification(int j) {
                 jm.setOccurred();
                 jm.setAuxiliary(new Integer(j));
             };
+
+            @Override
             protected void setFirstLineIndent(float fi) {
                 flim.setOccurred();
                 flim.setAuxiliary(new Float(fi));
             };
+
+            @Override
             protected void setLineSpacing(float ls) {
                 lsm.setOccurred();
                 lsm.setAuxiliary(new Float(ls));
             };
         };
-
         view.setPropertiesFromAttributes();
         assertTrue(jm.isOccurred());
-        assertEquals(-2, ((Integer)jm.getAuxiliary()).intValue());
+        assertEquals(-2, ((Integer) jm.getAuxiliary()).intValue());
         assertTrue(flim.isOccurred());
-        assertEquals(1.167f, ((Float)flim.getAuxiliary()).floatValue(), 1e-5);
+        assertEquals(1.167f, ((Float) flim.getAuxiliary()).floatValue(), 1e-5);
         assertTrue(lsm.isOccurred());
-        assertEquals(1.324f, ((Float)lsm.getAuxiliary()).floatValue(), 1e-5);
+        assertEquals(1.324f, ((Float) lsm.getAuxiliary()).floatValue(), 1e-5);
     }
 
     public void testGetLayoutViewCount() {
         assertNull(view.layoutPool);
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.getLayoutViewCount();
             }
         });
-
         view.layoutPool = new BoxView(paragraph, View.Y_AXIS);
-        ((CompositeView)view.layoutPool).loadChildren(new ChildrenFactory());
+        ((CompositeView) view.layoutPool).loadChildren(new ChildrenFactory());
         assertTrue(paragraph.getElementCount() > 0);
         assertEquals(paragraph.getElementCount(), view.getLayoutViewCount());
     }
@@ -789,13 +657,13 @@
     public void testGetLayoutView() {
         assertNull(view.layoutPool);
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 view.getLayoutView(0);
             }
         });
-
         view.layoutPool = new BoxView(paragraph, View.Y_AXIS);
-        ((CompositeView)view.layoutPool).loadChildren(new ChildrenFactory());
+        ((CompositeView) view.layoutPool).loadChildren(new ChildrenFactory());
         assertTrue(paragraph.getElementCount() > 0);
         assertSame(view.layoutPool.getView(0), view.getLayoutView(0));
         assertSame(view.layoutPool.getView(1), view.getLayoutView(1));
@@ -803,169 +671,123 @@
 
     public void testGetPartialSize() {
         loadChildren();
-
         View child = view.layoutPool.getView(0);
         assertTrue(child instanceof GlyphView);
         if (isHarmony()) {
-            assertSame(view, ((GlyphView)child).getTabExpander());
+            assertSame(view, ((GlyphView) child).getTabExpander());
         } else {
-            assertNull(((GlyphView)child).getTabExpander());
+            assertNull(((GlyphView) child).getTabExpander());
         }
-
         assertTrue(view.layoutPool.getView(0) instanceof TabableView);
         assertTrue(view.layoutPool.getView(1) instanceof TabableView);
-
-        GlyphView gv = (GlyphView)child;
+        GlyphView gv = (GlyphView) child;
         int start = gv.getStartOffset() + 1;
         int end = gv.getEndOffset() - 1;
-        assertEquals(gv.getPartialSpan(start, end),
-                     view.getPartialSize(start, end), 1e-5f);
-
+        assertEquals(gv.getPartialSpan(start, end), view.getPartialSize(start, end), 1e-5f);
         float size = gv.getPartialSpan(start, end + 1);
-
-        gv = (GlyphView)view.layoutPool.getView(1);
+        gv = (GlyphView) view.layoutPool.getView(1);
         size += gv.getPartialSpan(gv.getStartOffset(), gv.getEndOffset() - 1);
-
-        assertEquals(size,
-                     view.getPartialSize(start, gv.getEndOffset() - 1), 1e-5f);
-
-        view.layoutPool.replace(0, 2, new View[] {
-            new ChildView(paragraph.getElement(0), 0),
-            new ChildView(paragraph.getElement(1), 1)
-        });
+        assertEquals(size, view.getPartialSize(start, gv.getEndOffset() - 1), 1e-5f);
+        view.layoutPool.replace(0, 2, new View[] { new ChildView(paragraph.getElement(0), 0),
+                new ChildView(paragraph.getElement(1), 1) });
         assertFalse(view.layoutPool.getView(0) instanceof TabableView);
         assertFalse(view.layoutPool.getView(1) instanceof TabableView);
-
         size = view.layoutPool.getView(0).getPreferredSpan(View.X_AXIS)
-               + view.layoutPool.getView(1).getPreferredSpan(View.X_AXIS);
-        assertEquals(0,
-                     view.getPartialSize(start, gv.getEndOffset() - 1), 1e-5f);
+                + view.layoutPool.getView(1).getPreferredSpan(View.X_AXIS);
+        assertEquals(0, view.getPartialSize(start, gv.getEndOffset() - 1), 1e-5f);
         child = view.layoutPool.getView(0);
-        assertEquals(child.getPreferredSpan(View.X_AXIS),
-                     view.getPartialSize(child.getStartOffset(),
-                                         child.getEndOffset()),
-                     1e-5f);
-        assertEquals(0,
-                     view.getPartialSize(child.getStartOffset(),
-                                         gv.getEndOffset() - 1),
-                     1e-5f);
-
-        assertEquals(0,
-                     view.getPartialSize(child.getStartOffset() + 1,
-                                         child.getEndOffset()),
-                     1e-5f);
+        assertEquals(child.getPreferredSpan(View.X_AXIS), view.getPartialSize(child
+                .getStartOffset(), child.getEndOffset()), 1e-5f);
+        assertEquals(0, view.getPartialSize(child.getStartOffset(), gv.getEndOffset() - 1),
+                1e-5f);
+        assertEquals(0, view.getPartialSize(child.getStartOffset() + 1, child.getEndOffset()),
+                1e-5f);
         child = view.layoutPool.getView(1);
-        assertEquals(child.getPreferredSpan(View.X_AXIS),
-                     view.getPartialSize(child.getStartOffset(),
-                                         child.getEndOffset()),
-                     1e-5f);
-        assertEquals(0,
-                     view.getPartialSize(child.getStartOffset(),
-                                         child.getEndOffset() - 1),
-                     1e-5f);
-
-        assertEquals(size,
-                     view.getPartialSize(
-                             view.layoutPool.getView(0).getStartOffset(),
-                             view.layoutPool.getView(1).getEndOffset()),
-                     1e-5);
-    }
-
-    public void testFindOffsetToCharactersInString()
-        throws BadLocationException {
-                   // 0123456789012345
-        assertEquals("plainbolditalic\n",
-                     doc.getText(view.getStartOffset(), view.getEndOffset()));
+        assertEquals(child.getPreferredSpan(View.X_AXIS), view.getPartialSize(child
+                .getStartOffset(), child.getEndOffset()), 1e-5f);
+        assertEquals(0, view.getPartialSize(child.getStartOffset(), child.getEndOffset() - 1),
+                1e-5f);
+        assertEquals(size, view.getPartialSize(view.layoutPool.getView(0).getStartOffset(),
+                view.layoutPool.getView(1).getEndOffset()), 1e-5);
+    }
+
+    public void testFindOffsetToCharactersInString() throws BadLocationException {
+        // 0123456789012345
+        assertEquals("plainbolditalic\n", doc.getText(view.getStartOffset(), view
+                .getEndOffset()));
         char[] chars = "abcd".toCharArray();
         int[] offset = new int[] {
         //  0  1  2  3  4
-            2, 2, 2, 5, 5,
-        //  5  6  7  8  9
-            5, 8, 8, 8, 11,
-        //  10  11  12  13  14
-            11, 11, 14, 14, 14,
-            -1, -1
-        };
+                2, 2, 2, 5, 5,
+                //  5  6  7  8  9
+                5, 8, 8, 8, 11,
+                //  10  11  12  13  14
+                11, 11, 14, 14, 14, -1, -1 };
         for (int i = 0; i < offset.length; i++) {
-            assertEquals("@ " + i, offset[i],
-                         view.findOffsetToCharactersInString(chars, i));
+            assertEquals("@ " + i, offset[i], view.findOffsetToCharactersInString(chars, i));
         }
-
-        assertEquals(-1,
-                     view.findOffsetToCharactersInString("e\t.,".toCharArray(),
-                                                         0));
+        assertEquals(-1, view.findOffsetToCharactersInString("e\t.,".toCharArray(), 0));
     }
 
     public void testGetTabSet() {
         assertFalse(view.getAttributes().isDefined(StyleConstants.TabSet));
         assertNull(view.getTabSet());
-
-        final TabSet tabSet = new TabSet(new TabStop[] {
-            new TabStop(10f),
-            new TabStop(12f),
-            new TabStop(15f)
-        });
+        final TabSet tabSet = new TabSet(new TabStop[] { new TabStop(10f), new TabStop(12f),
+                new TabStop(15f) });
         MutableAttributeSet attrs = new SimpleAttributeSet();
         StyleConstants.setTabSet(attrs, tabSet);
         doc.setParagraphAttributes(0, 1, attrs, false);
-
         assertTrue(view.getAttributes().isDefined(StyleConstants.TabSet));
         assertSame(tabSet, view.getTabSet());
     }
 
     public void testGetTabBase() {
         assertEquals(0, view.getLeftInset());
-        assertEquals(0, (int)view.getTabBase());
-
+        assertEquals(0, (int) view.getTabBase());
         AttributeSet attrs = getInsetsAttributeSet();
         doc.setParagraphAttributes(0, 1, attrs, false);
         view.setPropertiesFromAttributes();
-
         assertEquals(4, view.getLeftInset());
         assertEquals(0, view.getTabBase(), 1e-5f);
-
         view.paint(createTestGraphics(), new Rectangle(7, 10, WIDTH, HEIGHT));
-        assertEquals(7 + 4, (int)view.getTabBase());
+        assertEquals(7 + 4, (int) view.getTabBase());
     }
 
-//    public void testGetClosestPositionTo() {
-//
-//    }
-
-    public void testGetNextNorthSouthVisualPositionFrom()
-        throws BadLocationException {
-
+    //    public void testGetClosestPositionTo() {
+    //
+    //    }
+    public void testGetNextNorthSouthVisualPositionFrom() throws BadLocationException {
         final class Params {
             boolean valid;
+
             int pos;
+
             Bias b;
+
             int dir;
+
             int row;
+
             int x;
 
             public void check(int pos, Bias b, int dir, int row, int x) {
                 assertTrue("valid", valid);
-
                 assertEquals("offset", pos, this.pos);
                 assertSame("bias", b, this.b);
                 assertEquals("direction", dir, this.dir);
                 assertEquals("row", row, this.row);
                 assertEquals("x", x, this.x);
-
                 valid = false;
             }
         }
-
         final Rectangle alloc = new Rectangle(11, 7, WIDTH, HEIGHT);
         final JTextArea textArea = new JTextArea();
         final Params params = new Params();
         view = new ParagraphView(paragraph) {
-            protected int getClosestPositionTo(int pos, Bias b, Shape a,
-                                               int dir, Bias[] biasRet,
-                                               int rowIndex, int x)
-            throws BadLocationException {
+            @Override
+            protected int getClosestPositionTo(int pos, Bias b, Shape a, int dir,
+                    Bias[] biasRet, int rowIndex, int x) throws BadLocationException {
                 params.valid = true;
-
                 params.pos = pos;
                 params.b = b;
                 assertSame(alloc, a);
@@ -975,40 +797,37 @@
                 return 0;
             }
 
+            @Override
             public Container getContainer() {
                 return textArea;
             }
         };
         loadChilrenAndLayout();
         Bias[] bias = new Bias[1];
-        view.getNextNorthSouthVisualPositionFrom(0, Bias.Forward, alloc,
-                                                 SwingConstants.SOUTH, bias);
+        view.getNextNorthSouthVisualPositionFrom(0, Bias.Forward, alloc, SwingConstants.SOUTH,
+                bias);
         params.check(0, Bias.Forward, SwingConstants.SOUTH, 1, 0);
-        view.getNextNorthSouthVisualPositionFrom(1, Bias.Forward, alloc,
-                                                 SwingConstants.SOUTH, bias);
+        view.getNextNorthSouthVisualPositionFrom(1, Bias.Forward, alloc, SwingConstants.SOUTH,
+                bias);
         params.check(1, Bias.Forward, SwingConstants.SOUTH, 1, 0);
-
-        view.getNextNorthSouthVisualPositionFrom(1, Bias.Forward, alloc,
-                                                 SwingConstants.NORTH, bias);
+        view.getNextNorthSouthVisualPositionFrom(1, Bias.Forward, alloc, SwingConstants.NORTH,
+                bias);
         assertFalse(params.valid);
-        view.getNextNorthSouthVisualPositionFrom(0, Bias.Forward, alloc,
-                                                 SwingConstants.NORTH, bias);
+        view.getNextNorthSouthVisualPositionFrom(0, Bias.Forward, alloc, SwingConstants.NORTH,
+                bias);
         assertFalse(params.valid);
-
-
         final int end = view.getEndOffset() - 3;
         view.getNextNorthSouthVisualPositionFrom(end, Bias.Forward, alloc,
-                                                 SwingConstants.SOUTH, bias);
+                SwingConstants.SOUTH, bias);
         assertFalse(params.valid);
         view.getNextNorthSouthVisualPositionFrom(end - 1, Bias.Forward, alloc,
-                                                 SwingConstants.SOUTH, bias);
+                SwingConstants.SOUTH, bias);
         assertFalse(params.valid);
-
         view.getNextNorthSouthVisualPositionFrom(end - 1, Bias.Forward, alloc,
-                                                 SwingConstants.NORTH, bias);
+                SwingConstants.NORTH, bias);
         params.check(end - 1, Bias.Forward, SwingConstants.NORTH, 0, 0);
         view.getNextNorthSouthVisualPositionFrom(end, Bias.Forward, alloc,
-                                                 SwingConstants.NORTH, bias);
+                SwingConstants.NORTH, bias);
         params.check(end, Bias.Forward, SwingConstants.NORTH, 0, 0);
     }
 
@@ -1030,7 +849,7 @@
 
     private void loadChildren() {
         view.loadChildren(null);
-        ((CompositeView)view.layoutPool).loadChildren(new PartFactory());
+        ((CompositeView) view.layoutPool).loadChildren(new PartFactory());
     }
 
     private void loadChilrenAndLayout() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PasswordViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PasswordViewTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PasswordViewTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PasswordViewTest.java Sun Nov 26 12:15:43 2006
@@ -25,49 +25,58 @@
 import java.awt.Graphics;
 import java.awt.Rectangle;
 import java.awt.Shape;
-
 import javax.swing.JFrame;
 import javax.swing.JPasswordField;
 import javax.swing.SwingTestCase;
 import javax.swing.plaf.basic.BasicTextUI;
 
-
 public class PasswordViewTest extends SwingTestCase {
     PasswordView view;
+
     JPasswordField pf;
+
     String content = "abcd\tefg";
+
     JFrame jf;
+
     int x = 123;
+
     int y = 234;
+
     Segment text;
+
     FontMetrics fm;
+
     Segment echoChars;
+
     int textWidth;
+
     int echoCharsWidth;
+
     int height;
+
     char zero = '\0';
+
     int length;
+
     boolean bWasException;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         bWasException = false;
         length = content.length();
         jf = new JFrame();
         pf = new JPasswordField(content);
-        view = (PasswordView)((BasicTextUI)pf.getUI())
-            .getRootView(pf).getView(0);
+        view = (PasswordView) ((BasicTextUI) pf.getUI()).getRootView(pf).getView(0);
         fm = pf.getFontMetrics(pf.getFont());
         assertNotNull(fm);
         text = new Segment();
         pf.getDocument().getText(0, length, text);
-        echoChars = new Segment(new char[] {'*', '*', '*', '*',
-                                            '*', '*', '*', '*'},
-                                0 , length);
-
+        echoChars = new Segment(new char[] { '*', '*', '*', '*', '*', '*', '*', '*' }, 0,
+                length);
         textWidth = Utilities.getTabbedTextWidth(text, fm, 0, view, 0);
-        echoCharsWidth = Utilities.getTabbedTextWidth(echoChars, fm, 0,
-                                                      view, 0);
+        echoCharsWidth = Utilities.getTabbedTextWidth(echoChars, fm, 0, view, 0);
         height = fm.getHeight();
         assertNotNull(text);
         jf.getContentPane().add(pf);
@@ -77,23 +86,23 @@
         jf.pack();
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
         jf.dispose();
     }
 
     public void testGetPreferredSpan() {
-        assertEquals(echoCharsWidth, (int)view.getPreferredSpan(View.X_AXIS));
-        assertEquals(height, (int)view.getPreferredSpan(View.Y_AXIS));
+        assertEquals(echoCharsWidth, (int) view.getPreferredSpan(View.X_AXIS));
+        assertEquals(height, (int) view.getPreferredSpan(View.Y_AXIS));
         pf.setColumns(3);
-        assertEquals(echoCharsWidth, (int)view.getPreferredSpan(View.X_AXIS));
-
+        assertEquals(echoCharsWidth, (int) view.getPreferredSpan(View.X_AXIS));
         pf.setColumns(0);
         pf.setEchoChar(zero);
-        assertEquals(textWidth, (int)view.getPreferredSpan(View.X_AXIS));
-        assertEquals(height, (int)view.getPreferredSpan(View.Y_AXIS));
+        assertEquals(textWidth, (int) view.getPreferredSpan(View.X_AXIS));
+        assertEquals(height, (int) view.getPreferredSpan(View.Y_AXIS));
         pf.setColumns(3);
-        assertEquals(textWidth, (int)view.getPreferredSpan(View.X_AXIS));
+        assertEquals(textWidth, (int) view.getPreferredSpan(View.X_AXIS));
     }
 
     public void testDrawEchoCharacter() {
@@ -109,11 +118,9 @@
         Graphics g = pf.getGraphics();
         Color color = g.getColor();
         try {
-           assertEquals(echoCharsWidth + x,
-                              view.drawSelectedText(g, x, y, 0, length));
-           pf.setEchoChar(zero);
-           assertEquals(textWidth,
-                        view.drawSelectedText(g, 0, y, 0, length));
+            assertEquals(echoCharsWidth + x, view.drawSelectedText(g, x, y, 0, length));
+            pf.setEchoChar(zero);
+            assertEquals(textWidth, view.drawSelectedText(g, 0, y, 0, length));
         } catch (BadLocationException e) {
             assertTrue("Unexpected exception: ", false);
         }
@@ -126,12 +133,10 @@
         Graphics g = pf.getGraphics();
         Color old = g.getColor();
         try {
-           assertEquals(echoCharsWidth + x,
-                              view.drawUnselectedText(g, x, y, 0, length));
-           pf.setEchoChar(zero);
-           assertEquals(textWidth,
-                        view.drawSelectedText(g, 0, y, 0, length));
-                   } catch (BadLocationException e) {
+            assertEquals(echoCharsWidth + x, view.drawUnselectedText(g, x, y, 0, length));
+            pf.setEchoChar(zero);
+            assertEquals(textWidth, view.drawSelectedText(g, 0, y, 0, length));
+        } catch (BadLocationException e) {
             assertTrue("Unexpected exception: ", false);
         }
         if (isHarmony()) {
@@ -142,18 +147,16 @@
     public void testModelToView() throws Exception {
         Shape shape = new Rectangle(2, 20, 30, 40);
         Rectangle adjustRect = view.adjustAllocation(shape).getBounds();
-        Rectangle rect = (Rectangle)view.modelToView(1, shape, Position.Bias.Forward);
+        Rectangle rect = (Rectangle) view.modelToView(1, shape, Position.Bias.Forward);
         assertEquals(adjustRect.x + fm.stringWidth("*"), rect.x);
         assertEquals(adjustRect.y, rect.y);
         assertEquals(1, rect.width);
         assertEquals(height, rect.height);
-
-        rect = (Rectangle)view.modelToView(5, shape, Position.Bias.Forward);
+        rect = (Rectangle) view.modelToView(5, shape, Position.Bias.Forward);
         assertEquals(adjustRect.x + fm.stringWidth("*****"), rect.x);
         assertEquals(adjustRect.y, rect.y);
         assertEquals(1, rect.width);
         assertEquals(height, rect.height);
-
         try {
             view.modelToView(-1000, shape, Position.Bias.Forward);
             if (isHarmony()) {
@@ -165,12 +168,10 @@
 
     public void testViewToModel() {
         Shape shape = new Rectangle(10, 20, 30, 40);
-
         int px = 10 + fm.stringWidth("***");
         int py = 20 + fm.getAscent() - 1;
         Position.Bias[] biasRet = new Position.Bias[1];
         assertEquals(3, view.viewToModel(px, py, shape, biasRet));
-
         px = 10 + fm.stringWidth("****");
         py = 20 + fm.getAscent() - 1;
         biasRet = new Position.Bias[1];

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentRTest.java Sun Nov 26 12:15:43 2006
@@ -25,16 +25,16 @@
 import javax.swing.event.DocumentListener;
 import javax.swing.event.DocumentEvent.ElementChange;
 
-public class PlainDocumentRTest extends BasicSwingTestCase
-    implements DocumentListener {
-
+public class PlainDocumentRTest extends BasicSwingTestCase implements DocumentListener {
     private static final String filterNewLinesProperty = "filterNewlines";
 
     private PlainDocument doc;
+
     private Element root;
+
     private DocumentEvent insertEvent;
-    private ElementChange change;
 
+    private ElementChange change;
 
     /**
      * Tests handling of <code>filterNewLine</code> property
@@ -45,13 +45,11 @@
         doc.replace(0, 0, content, null);
         assertNull(getNewLineProperty());
         assertEquals(content, getText());
-
         setNewLineProperty(true);
         doc.replace(0, doc.getLength(), content, null);
         assertSame(Boolean.TRUE, getNewLineProperty());
         assertEquals(content.replace('\n', ' '), getText());
         doc.remove(0, doc.getLength());
-
         setNewLineProperty(false);
         doc.replace(0, doc.getLength(), content, null);
         assertSame(Boolean.FALSE, getNewLineProperty());
@@ -65,44 +63,32 @@
      */
     public void testReplaceDF() throws BadLocationException {
         DocumentFilter filter = new DocumentFilter() {
-            public void insertString(final FilterBypass fb,
-                                     final int offset, final String text,
-                                     final AttributeSet attrs)
-                throws BadLocationException {
-
+            @Override
+            public void insertString(final FilterBypass fb, final int offset,
+                    final String text, final AttributeSet attrs) throws BadLocationException {
                 super.insertString(fb, offset, "###\n^^^", attrs);
             }
 
-            public void remove(final FilterBypass fb,
-                               final int offset, final int length)
-                throws BadLocationException {
-
+            @Override
+            public void remove(final FilterBypass fb, final int offset, final int length)
+                    throws BadLocationException {
                 super.remove(fb, offset, length);
             }
 
-            public void replace(final FilterBypass fb,
-                                final int offset, final int length,
-                                final String text, final AttributeSet attrs)
-                throws BadLocationException {
-
+            @Override
+            public void replace(final FilterBypass fb, final int offset, final int length,
+                    final String text, final AttributeSet attrs) throws BadLocationException {
                 super.replace(fb, offset, length, "!" + text + "!", attrs);
             }
-
         };
         doc.insertString(0, "plain text", null);
-
         doc.setDocumentFilter(filter);
         setNewLineProperty(true);
         doc.replace(2, 6, "++\n--", null);
-        assertEquals(isHarmony()
-                     ? "pl!++ --!xt"
-                     : "pl!++\n--!xt", getText());
-
+        assertEquals(isHarmony() ? "pl!++ --!xt" : "pl!++\n--!xt", getText());
         doc.remove(0, doc.getLength());
         doc.insertString(0, "^^^\n###", null);
-        assertEquals(isHarmony()
-                     ? "### ^^^"
-                     : "###\n^^^", getText());
+        assertEquals(isHarmony() ? "### ^^^" : "###\n^^^", getText());
     }
 
     public void testInsertUpdate09() throws BadLocationException {
@@ -110,11 +96,9 @@
         //                   012345 6 7 8
         doc.addDocumentListener(this);
         doc.insertString(7, "\n", null);
-
         change = insertEvent.getChange(root);
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(2, change.getChildrenAdded().length);
-
         checkOffsets(change.getChildrenRemoved()[0], 6, 8);
         checkOffsets(change.getChildrenAdded()[0], 6, 7);
         checkOffsets(change.getChildrenAdded()[1], 7, 8);
@@ -125,11 +109,9 @@
         //                   012345 6 78 9
         doc.addDocumentListener(this);
         doc.insertString(7, "\n", null);
-
         change = insertEvent.getChange(root);
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(2, change.getChildrenAdded().length);
-
         checkOffsets(change.getChildrenRemoved()[0], 6, 8);
         checkOffsets(change.getChildrenAdded()[0], 6, 7);
         checkOffsets(change.getChildrenAdded()[1], 7, 8);
@@ -140,11 +122,9 @@
         //                   012345 6 78 9
         doc.addDocumentListener(this);
         doc.insertString(8, "\n", null);
-
         change = insertEvent.getChange(root);
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(2, change.getChildrenAdded().length);
-
         checkOffsets(change.getChildrenRemoved()[0], 7, 10);
         checkOffsets(change.getChildrenAdded()[0], 7, 9);
         checkOffsets(change.getChildrenAdded()[1], 9, 10);
@@ -160,16 +140,16 @@
     public void changedUpdate(DocumentEvent e) {
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new PlainDocument();
         root = doc.getDefaultRootElement();
     }
 
-    private static void checkOffsets(final Element line,
-                                     final int start, final int end) {
+    private static void checkOffsets(final Element line, final int start, final int end) {
         assertEquals(start, line.getStartOffset());
-        assertEquals(end,   line.getEndOffset());
+        assertEquals(end, line.getEndOffset());
     }
 
     private void setNewLineProperty(final boolean state) {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/PlainDocumentTest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 /**
  * @author Alexey A. Ivanov
  * @version $Revision$
@@ -28,7 +27,6 @@
 import javax.swing.text.AbstractDocument.Content;
 import javax.swing.text.AbstractDocument.DefaultDocumentEvent;
 import javax.swing.text.AbstractDocument.LeafElement;
-
 import junit.framework.TestCase;
 
 /**
@@ -39,24 +37,28 @@
     private static final String filterNewLinesProperty = "filterNewlines";
 
     private static final String paragraphs = "first\nsecond\nthird\n";
-    //                                        01234 5678901 234567 8
 
+    //                                        01234 5678901 234567 8
     /**
      * Shared document used in tests.
      */
     private PlainDocument doc;
+
     /**
      * Event for text insert.
      */
     private DefaultDocumentEvent insert;
+
     /**
      * Event for text remove.
      */
     private DefaultDocumentEvent remove;
+
     /**
      * Root element where changes are tracked.
      */
     private Element root;
+
     /**
      * Changes of the root element
      */
@@ -65,14 +67,20 @@
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new PlainDocument() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             protected void insertUpdate(final DefaultDocumentEvent event,
-                                        final AttributeSet attrs) {
+                    final AttributeSet attrs) {
                 insert = event;
                 super.insertUpdate(event, attrs);
             }
+
+            @Override
             protected void removeUpdate(final DefaultDocumentEvent event) {
                 remove = event;
                 super.removeUpdate(event);
@@ -88,8 +96,7 @@
     public void testInsertString01() throws BadLocationException {
         doc.putProperty(PlainDocument.lineLimitAttribute, new Integer(10));
         StyleContext context = StyleContext.getDefaultStyleContext();
-        AttributeSet attrs = context.addAttribute(context.getEmptySet(),
-                                                  "key", "value");
+        AttributeSet attrs = context.addAttribute(context.getEmptySet(), "key", "value");
         final String text = "0123456789abcdefghij";
         doc.insertString(0, text, attrs);
         assertEquals(text, doc.getText(0, doc.getLength()));
@@ -97,7 +104,6 @@
         attrs = doc.getDefaultRootElement().getAttributes();
         assertEquals(0, root.getAttributes().getAttributeCount());
         assertEquals(1, root.getElementCount());
-
         Element line1 = root.getElement(0);
         assertTrue(line1.isLeaf());
         assertEquals(0, line1.getElementCount());
@@ -113,13 +119,11 @@
         assertNull(getNewLineProperty());
         assertEquals(content, getText());
         doc.remove(0, doc.getLength());
-
         doc.putProperty(filterNewLinesProperty, Boolean.TRUE);
         doc.insertString(0, content, null);
         assertSame(Boolean.TRUE, getNewLineProperty());
         assertEquals(content.replace('\n', ' '), getText());
         doc.remove(0, doc.getLength());
-
         doc.putProperty(filterNewLinesProperty, Boolean.FALSE);
         doc.insertString(0, content, null);
         assertSame(Boolean.FALSE, getNewLineProperty());
@@ -131,18 +135,15 @@
      */
     public void testInsertUpdate01() throws BadLocationException {
         doc.insertString(0, "text", null);
-
         assertNull(insert.getChange(root));
-
         doc.insertString(0, paragraphs, null);
         change = insert.getChange(root);
         assertEquals(4, change.getChildrenAdded().length);
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(4, root.getElementCount());
-
         Element[] children = change.getChildrenAdded();
-        checkOffsets(children[0],  0,  6);
-        checkOffsets(children[1],  6, 13);
+        checkOffsets(children[0], 0, 6);
+        checkOffsets(children[1], 6, 13);
         checkOffsets(children[2], 13, 19);
         checkOffsets(children[3], 19, 24);
     }
@@ -152,21 +153,17 @@
      */
     public void testInsertUpdate02() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         doc.insertString(13, "123", null);
         change = insert.getChange(root);
-
         assertEquals(2, change.getChildrenAdded().length);
         assertEquals(2, change.getChildrenRemoved().length);
         assertEquals(1, change.getIndex());
         assertEquals(4, root.getElementCount());
-
         Element[] children = change.getChildrenAdded();
-        checkOffsets(children[0],  6, 13);
+        checkOffsets(children[0], 6, 13);
         checkOffsets(children[1], 13, 22);
-
         children = change.getChildrenRemoved();
-        checkOffsets(children[0],  6, 16);
+        checkOffsets(children[0], 6, 16);
         checkOffsets(children[1], 16, 22);
     }
 
@@ -176,10 +173,8 @@
      */
     public void testInsertUpdate03() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         doc.insertString(12, "123", null);
         assertNull(insert.getChange(root));
-
         doc.insertString(10, "middle", null);
         assertNull(insert.getChange(root));
     }
@@ -190,7 +185,6 @@
      */
     public void testInsertUpdate04() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         // Insert more text
         doc.insertString(15, "two and a half\n", null);
         change = insert.getChange(root);
@@ -198,11 +192,9 @@
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(2, change.getIndex());
         assertEquals(5, root.getElementCount());
-
         Element[] children = change.getChildrenAdded();
         checkOffsets(children[0], 13, 30);
         checkOffsets(children[1], 30, 34);
-
         children = change.getChildrenRemoved();
         checkOffsets(children[0], 13, 34);
     }
@@ -214,7 +206,6 @@
     public void testInsertUpdate05() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
         doc.insertString(13, "123", null);
-
         // Insert more text
         doc.insertString(16, "two and a half\n321", null);
         change = insert.getChange(root);
@@ -222,11 +213,9 @@
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(2, change.getIndex());
         assertEquals(5, root.getElementCount());
-
         Element[] children = change.getChildrenAdded();
         checkOffsets(children[0], 13, 31);
         checkOffsets(children[1], 31, 40);
-
         children = change.getChildrenRemoved();
         checkOffsets(children[0], 13, 40);
     }
@@ -237,7 +226,6 @@
      */
     public void testInsertUpdate06() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         // Insert more text
         doc.insertString(15, "\n321", null);
         change = insert.getChange(root);
@@ -245,11 +233,9 @@
         assertEquals(1, change.getChildrenRemoved().length);
         assertEquals(2, change.getIndex());
         assertEquals(5, root.getElementCount());
-
         Element[] children = change.getChildrenAdded();
         checkOffsets(children[0], 13, 16);
         checkOffsets(children[1], 16, 23);
-
         children = change.getChildrenRemoved();
         checkOffsets(children[0], 13, 23);
     }
@@ -260,56 +246,52 @@
      */
     public void testInsertUpdate07() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         doc.insertString(13, "\n321", null);
         change = insert.getChange(root);
         assertEquals(3, change.getChildrenAdded().length);
         assertEquals(2, change.getChildrenRemoved().length);
         assertEquals(1, change.getIndex());
         assertEquals(5, root.getElementCount());
-
         Element[] children = change.getChildrenAdded();
-        checkOffsets(children[0],  6, 13);
+        checkOffsets(children[0], 6, 13);
         checkOffsets(children[1], 13, 14);
         checkOffsets(children[2], 14, 23);
-
         children = change.getChildrenRemoved();
-        checkOffsets(children[0],  6, 17);
+        checkOffsets(children[0], 6, 17);
         checkOffsets(children[1], 17, 23);
     }
 
     public void testInsertUpdate08() throws BadLocationException {
         final int[] createCalled = new int[2];
         doc = new PlainDocument() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             protected void insertUpdate(final DefaultDocumentEvent event,
-                                        final AttributeSet attrs) {
+                    final AttributeSet attrs) {
                 insert = event;
                 super.insertUpdate(event, attrs);
             }
 
-            protected Element createBranchElement(final Element parent,
-                                                  final AttributeSet attrs) {
+            @Override
+            protected Element createBranchElement(final Element parent, final AttributeSet attrs) {
                 ++createCalled[0];
                 return super.createBranchElement(parent, attrs);
             }
 
-            protected Element createLeafElement(final Element parent,
-                                                final AttributeSet as,
-                                                final int start,
-                                                final int end) {
+            @Override
+            protected Element createLeafElement(final Element parent, final AttributeSet as,
+                    final int start, final int end) {
                 ++createCalled[1];
                 return super.createLeafElement(parent, as, start, end);
             }
         };
         root = doc.getDefaultRootElement();
-
         createCalled[0] = createCalled[1] = 0;
-
         doc.insertString(0, "test", null);
         assertNull(insert.getChange(root));
         assertEquals("createBranchElement", 0, createCalled[0]);
         assertEquals("createLeafElement", 0, createCalled[1]);
-
         doc.insertString(0, "\n", null);
         assertNotNull(insert.getChange(root));
         assertEquals("createBranchElement", 0, createCalled[0]);
@@ -322,18 +304,14 @@
      */
     public void testRemoveUpdate01() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         // Remove "second\nthird\n" portion
         doc.remove(6, 13);
-
         change = remove.getChange(root);
         assertEquals(1, change.getChildrenAdded().length);
         assertEquals(3, change.getChildrenRemoved().length);
         assertEquals(2, root.getElementCount());
-
         checkOffsets(root.getElement(0), 0, 6);
         checkOffsets(root.getElement(1), 6, 7);
-
         // Remove "irs" from "first"
         doc.remove(1, 3);
         assertNull(remove.getChange(root));
@@ -345,7 +323,6 @@
      */
     public void testRemoveUpdate02() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         // Remove "se" from "second"
         doc.remove(6, 2);
         assertNull(remove.getChange(root));
@@ -356,7 +333,6 @@
      */
     public void testRemoveUpdate03() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         // Remove "st" from "first\n"
         doc.remove(3, 2);
         assertNull(remove.getChange(root));
@@ -368,27 +344,23 @@
     public void testRemoveUpdate04() {
         try {
             doc.remove(3, 5);
-
             fail("BadLocationException should be thrown");
-        } catch (BadLocationException e) { }
+        } catch (BadLocationException e) {
+        }
         assertNull(remove);
     }
 
     public void testRemoveUpdate05() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
         // Remove the first line break
         doc.remove(5, 1);
-
         change = remove.getChange(root);
         assertEquals(1, change.getChildrenAdded().length);
         assertEquals(2, change.getChildrenRemoved().length);
         assertEquals(3, root.getElementCount());
-
         assertEquals("firstsecond\nthird\n", doc.getText(0, doc.getLength()));
         //            01234567890 123456 7
-
-        checkOffsets(root.getElement(0),  0, 12);
+        checkOffsets(root.getElement(0), 0, 12);
         checkOffsets(root.getElement(1), 12, 18);
         checkOffsets(root.getElement(2), 18, 19);
     }
@@ -398,10 +370,10 @@
      */
     public void testGetParagraphElement01() {
         checkOffsets(doc.getParagraphElement(-1), 0, 1);
-        checkOffsets(doc.getParagraphElement(0),  0, 1);
-        checkOffsets(doc.getParagraphElement(1),  0, 1);
-        checkOffsets(doc.getParagraphElement(2),  0, 1);
-        checkOffsets(doc.getParagraphElement(9),  0, 1);
+        checkOffsets(doc.getParagraphElement(0), 0, 1);
+        checkOffsets(doc.getParagraphElement(1), 0, 1);
+        checkOffsets(doc.getParagraphElement(2), 0, 1);
+        checkOffsets(doc.getParagraphElement(9), 0, 1);
     }
 
     /**
@@ -409,11 +381,10 @@
      */
     public void testGetParagraphElement02() throws BadLocationException {
         doc.insertString(0, paragraphs, null);
-
-        checkOffsets(doc.getParagraphElement(-1),  0,  6);
-        checkOffsets(doc.getParagraphElement(0),   0,  6);
-        checkOffsets(doc.getParagraphElement(2),   0,  6);
-        checkOffsets(doc.getParagraphElement(8),   6, 13);
+        checkOffsets(doc.getParagraphElement(-1), 0, 6);
+        checkOffsets(doc.getParagraphElement(0), 0, 6);
+        checkOffsets(doc.getParagraphElement(2), 0, 6);
+        checkOffsets(doc.getParagraphElement(8), 6, 13);
         checkOffsets(doc.getParagraphElement(15), 13, 19);
         checkOffsets(doc.getParagraphElement(18), 13, 19);
         checkOffsets(doc.getParagraphElement(19), 19, 20);
@@ -434,10 +405,10 @@
         doc = new PlainDocument(new GapContent(30));
         Content content = doc.getContent();
         assertTrue(content instanceof GapContent);
-        GapContent gapContent  = (GapContent)content;
+        GapContent gapContent = (GapContent) content;
         assertEquals(29, gapContent.getGapEnd() - gapContent.getGapStart());
         Object tabSize = doc.getProperty(PlainDocument.tabSizeAttribute);
-        assertEquals(8, ((Integer)tabSize).intValue());
+        assertEquals(8, ((Integer) tabSize).intValue());
         assertNull(doc.getProperty(PlainDocument.lineLimitAttribute));
         assertNotNull(doc.getDefaultRootElement());
     }
@@ -449,10 +420,10 @@
         doc = new PlainDocument();
         Content content = doc.getContent();
         assertTrue(content instanceof GapContent);
-        GapContent gapContent  = (GapContent)content;
+        GapContent gapContent = (GapContent) content;
         assertEquals(9, gapContent.getGapEnd() - gapContent.getGapStart());
         Object tabSize = doc.getProperty(PlainDocument.tabSizeAttribute);
-        assertEquals(8, ((Integer)tabSize).intValue());
+        assertEquals(8, ((Integer) tabSize).intValue());
         assertNull(doc.getProperty(PlainDocument.lineLimitAttribute));
         assertNotNull(doc.getDefaultRootElement());
     }
@@ -466,14 +437,12 @@
         assertEquals(AbstractDocument.ParagraphElementName, root.getName());
         assertEquals(1, root.getElementCount());
         checkOffsets(root.getElement(0), 0, 1);
-
         doc.insertString(0, paragraphs, null);
         root = doc.createDefaultRoot();
         assertEquals(1, root.getElementCount());
         if (BasicSwingTestCase.isHarmony()) {
-            checkOffsets(root.getElement(0),
-                         doc.getStartPosition().getOffset(),
-                         doc.getEndPosition().getOffset());
+            checkOffsets(root.getElement(0), doc.getStartPosition().getOffset(), doc
+                    .getEndPosition().getOffset());
         } else {
             checkOffsets(root.getElement(0), 0, 1);
         }
@@ -488,57 +457,55 @@
         PlainDocument testDoc = null;
         try {
             testDoc = new PlainDocument() {
+                private static final long serialVersionUID = 1L;
+
+                @Override
                 protected AbstractElement createDefaultRoot() {
                     AbstractElement root = new LeafElement(null, null, 0, 1);
                     return root;
                 }
             };
-
             if (BasicSwingTestCase.isHarmony()) {
                 fail("ClassCastException must be thrown");
             }
-        } catch (ClassCastException e) { }
-
+        } catch (ClassCastException e) {
+        }
         if (BasicSwingTestCase.isHarmony()) {
             assertNull(testDoc);
-
             return;
         }
-
-        AbstractElement root = (AbstractElement)testDoc.getDefaultRootElement();
+        AbstractElement root = (AbstractElement) testDoc.getDefaultRootElement();
         assertTrue(root instanceof LeafElement);
         assertEquals(AbstractDocument.ContentElementName, root.getName());
         assertEquals(0, root.getElementCount());
         assertFalse(root.getAllowsChildren());
-
         // Try to insert some text
         try {
             testDoc.insertString(0, "text", null);
-
             fail("ClassCastException must be thrown");
-        } catch (ClassCastException e) { }
+        } catch (ClassCastException e) {
+        }
     }
 
     public void testCreateDefaultRoot03() {
         final boolean[] createCalled = new boolean[2];
         doc = new PlainDocument() {
-            protected Element createBranchElement(final Element parent,
-                                                  final AttributeSet attrs) {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            protected Element createBranchElement(final Element parent, final AttributeSet attrs) {
                 createCalled[0] = true;
                 return super.createBranchElement(parent, attrs);
             }
 
-            protected Element createLeafElement(final Element parent,
-                                                final AttributeSet as,
-                                                final int start,
-                                                final int end) {
+            @Override
+            protected Element createLeafElement(final Element parent, final AttributeSet as,
+                    final int start, final int end) {
                 createCalled[1] = true;
                 return super.createLeafElement(parent, as, start, end);
             }
         };
-
         createCalled[0] = createCalled[1] = false;
-
         doc.createDefaultRoot();
         assertTrue("createBranchElement is NOT called", createCalled[0]);
         assertTrue("createLeafElement is NOT called", createCalled[1]);
@@ -552,9 +519,8 @@
         return doc.getText(0, doc.getLength());
     }
 
-    private static void checkOffsets(final Element par,
-                                     final int start, final int end) {
+    private static void checkOffsets(final Element par, final int start, final int end) {
         assertEquals(start, par.getStartOffset());
-        assertEquals(end,   par.getEndOffset());
+        assertEquals(end, par.getEndOffset());
     }
 }



Mime
View raw message