harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479418 [18/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/AbstractWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractWriterTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractWriterTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AbstractWriterTest.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 Vadim L. Bogdanov
  * @version $Revision$
@@ -24,7 +23,6 @@
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
-
 import javax.swing.SwingTestCase;
 
 public class AbstractWriterTest extends SwingTestCase {
@@ -33,8 +31,8 @@
             super(w, doc);
         }
 
-        protected TestAbstractWriter(final Writer w, final Document doc,
-                                     final int pos, final int len) {
+        protected TestAbstractWriter(final Writer w, final Document doc, final int pos,
+                final int len) {
             super(w, doc, pos, len);
         }
 
@@ -42,31 +40,35 @@
             super(w, root);
         }
 
-        protected TestAbstractWriter(final Writer w, final Element root,
-                                     final int pos, final int len) {
+        protected TestAbstractWriter(final Writer w, final Element root, final int pos,
+                final int len) {
             super(w, root, pos, len);
         }
 
+        @Override
         protected void write() throws IOException, BadLocationException {
         }
     }
 
     private StringWriter out;
+
     private Document doc;
+
     private AbstractWriter writer;
 
     public AbstractWriterTest(final String name) {
         super(name);
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         out = new StringWriter();
         doc = createDocument();
         writer = new TestAbstractWriter(out, doc);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         super.tearDown();
     }
@@ -87,7 +89,6 @@
         assertEquals(3 + 4, writer.getEndOffset());
         assertSame(writer.getElementIterator().current(), doc.getDefaultRootElement());
         assertSame(out, writer.getWriter());
-
         writer = new TestAbstractWriter(out, doc, 300, 400);
         assertSame(doc, writer.getDocument());
         assertEquals(300, writer.getStartOffset());
@@ -115,7 +116,6 @@
         assertEquals(3 + 4, writer.getEndOffset());
         assertSame(writer.getElementIterator().current(), root);
         assertSame(out, writer.getWriter());
-
         writer = new TestAbstractWriter(out, root, 300, 400);
         assertSame(doc, writer.getDocument());
         assertEquals(300, writer.getStartOffset());
@@ -133,10 +133,9 @@
     }
 
     public void testSetLineSeparator() {
-        doc.putProperty(StyledEditorKit.EndOfLineStringProperty, "~");
+        doc.putProperty(DefaultEditorKit.EndOfLineStringProperty, "~");
         writer = new TestAbstractWriter(out, doc);
         assertEquals("~", writer.getLineSeparator());
-
         String separator = ">>";
         writer.setLineSeparator(separator);
         assertSame(separator, writer.getLineSeparator());
@@ -144,17 +143,12 @@
 
     public void testGetLineSeparator() {
         final String lineSeparator = System.getProperty("line.separator");
-
-        assertEquals(System.getProperty("line.separator"),
-                     writer.getLineSeparator());
-
+        assertEquals(System.getProperty("line.separator"), writer.getLineSeparator());
         try {
             System.setProperty("line.separator", "<SYS>");
-            assertFalse(System.getProperty("line.separator")
-                        .equals(writer.getLineSeparator()));
+            assertFalse(System.getProperty("line.separator").equals(writer.getLineSeparator()));
             writer = new TestAbstractWriter(out, doc);
             assertEquals("<SYS>", writer.getLineSeparator());
-
             doc.putProperty(DefaultEditorKit.EndOfLineStringProperty, "<DOC>");
             writer = new TestAbstractWriter(out, doc);
             assertEquals("<DOC>", writer.getLineSeparator());
@@ -179,16 +173,15 @@
 
     public void testGetText() throws BadLocationException {
         Element elem = doc.getDefaultRootElement().getElement(1);
-        assertEquals(doc.getText(elem.getStartOffset(),
-                                 elem.getEndOffset() - elem.getStartOffset()),
-                     writer.getText(elem));
+        assertEquals(doc.getText(elem.getStartOffset(), elem.getEndOffset()
+                - elem.getStartOffset()), writer.getText(elem));
     }
 
     public void testInRange() {
         Element root = doc.getDefaultRootElement();
         Element elem = root.getElement(1);
-        writer = new TestAbstractWriter(out, doc, elem.getStartOffset(),
-                                        elem.getEndOffset() - elem.getStartOffset());
+        writer = new TestAbstractWriter(out, doc, elem.getStartOffset(), elem.getEndOffset()
+                - elem.getStartOffset());
         assertTrue(writer.inRange(root));
         assertTrue(writer.inRange(elem));
         assertFalse(writer.inRange(root.getElement(0)));
@@ -205,20 +198,17 @@
             writer.writeLineSeparator();
         }
         assertTrue(writer.isLineEmpty());
-
         writer.indent();
         assertTrue(writer.isLineEmpty());
-
-        final char content[] = {'a'};
+        final char content[] = { 'a' };
         writer.output(content, 0, content.length);
         assertFalse(writer.isLineEmpty());
-
         writer.writeLineSeparator();
         assertTrue(writer.isLineEmpty());
     }
 
     public void testSetGetCurrentLineLength() throws IOException {
-        char content[] = {'a', 'b'};
+        char content[] = { 'a', 'b' };
         writer.output(content, 0, content.length);
         assertEquals(2, writer.getCurrentLineLength());
         writer.setCurrentLineLength(0);
@@ -240,8 +230,7 @@
         assertEquals(1, writer.getIndentLevel());
         writer.incrIndent();
         assertEquals(2, writer.getIndentLevel());
-
-        writer.setLineLength(writer.getIndentLevel()*writer.getIndentSpace() + 1);
+        writer.setLineLength(writer.getIndentLevel() * writer.getIndentSpace() + 1);
         writer.incrIndent();
         assertEquals(2, writer.getIndentLevel());
     }
@@ -278,13 +267,12 @@
 
     public void testSetGetIndentSpace() {
         assertEquals(2, writer.getIndentSpace());
-
         writer.setIndentSpace(5);
         assertEquals(5, writer.getIndentSpace());
     }
 
     public void testOutput() throws IOException {
-        final char content[] = {'h', 'e', 'l', 'l', 'o'};
+        final char content[] = { 'h', 'e', 'l', 'l', 'o' };
         writer.output(content, 1, 3);
         assertEquals("ell", out.toString());
         assertEquals(3, writer.getCurrentLineLength());
@@ -293,22 +281,17 @@
 
     public void testText() throws BadLocationException, IOException {
         Element root = doc.getDefaultRootElement();
-        writer = new TestAbstractWriter(out, doc, 3,
-                                        root.getElement(0).getEndOffset());
+        writer = new TestAbstractWriter(out, doc, 3, root.getElement(0).getEndOffset());
         writer.setLineSeparator(">>");
         writer.text(root.getElement(0));
         assertEquals("st line>>", out.toString());
-
         out = new StringWriter();
-        writer = new TestAbstractWriter(out, doc, 3,
-                                        root.getElement(0).getEndOffset());
+        writer = new TestAbstractWriter(out, doc, 3, root.getElement(0).getEndOffset());
         writer.setLineSeparator(">>");
         writer.text(root.getElement(1));
         assertEquals("sec", out.toString());
-
         out = new StringWriter();
-        writer = new TestAbstractWriter(out, doc, 3,
-                                        root.getElement(0).getEndOffset());
+        writer = new TestAbstractWriter(out, doc, 3, root.getElement(0).getEndOffset());
         writer.text(root.getElement(2));
         assertEquals("", out.toString());
     }
@@ -323,14 +306,12 @@
 
     public void testWriteCharArrayIntInt() throws IOException {
         final char content[] = " first line\nsecond line\n".toCharArray();
-
         // no wrap tests
         writer.incrIndent();
         writer.setLineSeparator(">>");
         writer.setCanWrapLines(false);
         writer.write(content, 1, content.length - 2);
         assertEquals("first line>>second line", out.toString());
-
         out = new StringWriter();
         writer = new TestAbstractWriter(out, doc);
         writer.incrIndent();
@@ -340,7 +321,6 @@
         writer.write(content, 0, content.length);
         assertEquals(" first line>>second line>>", out.toString());
         assertTrue(writer.isLineEmpty());
-
         // tests with wrap
         out = new StringWriter();
         writer = new TestAbstractWriter(out, doc);
@@ -348,7 +328,6 @@
         writer.setLineSeparator(">>");
         writer.write(content, 1, content.length - 1);
         assertEquals("first line>>  second line>>", out.toString());
-
         out = new StringWriter();
         writer = new TestAbstractWriter(out, doc);
         writer.incrIndent();
@@ -377,10 +356,9 @@
     }
 
     public void testWriteLineSeparator() throws IOException {
-        final char chars[] = {'a'};
+        final char chars[] = { 'a' };
         writer.output(chars, 0, 1);
         assertFalse(writer.isLineEmpty());
-
         writer.setLineSeparator("b");
         writer.writeLineSeparator();
         assertTrue(writer.isLineEmpty());

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AttributeSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AttributeSetTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AttributeSetTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/AttributeSetTest.java
Sun Nov 26 12:15:43 2006
@@ -21,17 +21,14 @@
 package javax.swing.text;
 
 import java.util.Enumeration;
-import javax.swing.text.MutableAttributeSet;
-
 import junit.framework.TestCase;
-import javax.swing.text.StyleConstants;
 
 public class AttributeSetTest extends TestCase {
-
     /**
      * The interface AttributeSet for test cases.
      */
     protected AttributeSet as;
+
     /**
      * The flag indicates that setUp method should include resolveParent
      * while initializing test object.
@@ -45,52 +42,51 @@
     /**
      * This is array containing keys for test attribute set.
      */
-    protected static final String[] keys =
-        new String[] {"key1", "key2", "key3"};
+    protected static final String[] keys = new String[] { "key1", "key2", "key3" };
 
     /**
      * This is array containing values for test attribute set.
      */
-    protected static final String[] values =
-        new String[] {"value1", "value2", "value3"};
+    protected static final String[] values = new String[] { "value1", "value2", "value3"
};
 
     /**
      * The attribute key to place in resolver set.
      */
     protected static final String keyInResolver = "keyInResolver";
+
     /**
      * The attribute value to place in resolver set.
      */
     protected static final String valueInResolver = "valueInResolver";
+
     /**
      * The attribute set used as a resolve parent.
      */
-    protected static AttributeSet resolverSet =
-        new SimpleAttributeSet();
-
+    protected static AttributeSet resolverSet = new SimpleAttributeSet();
     static {
         // Add the attribute into the set
-        ((SimpleAttributeSet)resolverSet).addAttribute(keyInResolver,
-                valueInResolver);
+        ((SimpleAttributeSet) resolverSet).addAttribute(keyInResolver, valueInResolver);
     }
 
     /**
      * AttributeSet must contain keys&values.
      */
+    @Override
     protected void setUp() throws Exception {
-        MutableAttributeSet mas = new SimpleAttributeSet();;
+        MutableAttributeSet mas = new SimpleAttributeSet();
+        ;
         for (int i = 0; i < keys.length; i++) {
             mas.addAttribute(keys[i], values[i]);
         }
         as = mas;
-
         asWithResolver = mas.copyAttributes();
-        ((MutableAttributeSet)asWithResolver).setResolveParent(resolverSet);
+        ((MutableAttributeSet) asWithResolver).setResolveParent(resolverSet);
     }
 
     public AttributeSetTest() {
         super();
     }
+
     public AttributeSetTest(final String name) {
         super(name);
     }
@@ -98,11 +94,8 @@
     public void testContainsAttribute() {
         assertTrue(as.containsAttribute(keys[1], values[1]));
         assertFalse(as.containsAttribute(values[1], keys[1]));
-
         assertFalse(as.containsAttribute(keyInResolver, valueInResolver));
-
-        assertTrue(asWithResolver.containsAttribute(keyInResolver,
-                                                     valueInResolver));
+        assertTrue(asWithResolver.containsAttribute(keyInResolver, valueInResolver));
     }
 
     public void testContainsAttributes() {
@@ -110,23 +103,19 @@
         attrs.addAttribute(keys[0], values[0]);
         attrs.addAttribute(keys[2], values[2]);
         assertTrue(as.containsAttributes(attrs));
-
         attrs.addAttribute(values[1], keys[1]);
         assertFalse(as.containsAttributes(attrs));
-
         assertFalse(as.containsAttributes(resolverSet));
         assertTrue(asWithResolver.containsAttributes(resolverSet));
     }
 
     public void testCopyAttributes() {
         AttributeSet copy = as.copyAttributes();
-
         //copyAttributes returns an attribute set
         //that is guaranteed not to change over time
         if (as instanceof MutableAttributeSet) {
             assertNotSame(copy, as);
         }
-
         assertEquals(as.getAttributeCount(), copy.getAttributeCount());
         assertTrue(as.isEqual(copy));
     }
@@ -134,36 +123,28 @@
     public void testGetAttribute() {
         assertNull(as.getAttribute("key"));
         assertEquals(values[1], as.getAttribute(keys[1]));
-
         MutableAttributeSet parent = new SimpleAttributeSet();
         String key = "key", value = "value";
         parent.addAttribute(key, value);
-
         assertNull(as.getAttribute(value));
-
         assertNull(valueInResolver, as.getAttribute(keyInResolver));
-        assertEquals(valueInResolver,
-                     asWithResolver.getAttribute(keyInResolver));
+        assertEquals(valueInResolver, asWithResolver.getAttribute(keyInResolver));
     }
 
     public void testGetAttributeCount() {
         assertEquals(keys.length, as.getAttributeCount());
-
         assertEquals(keys.length + 1, asWithResolver.getAttributeCount());
     }
 
     public void testGetAttributeNames() {
         int count = 0;
-        for (Enumeration e = as.getAttributeNames(); e.hasMoreElements();) {
+        for (Enumeration<?> e = as.getAttributeNames(); e.hasMoreElements();) {
             count++;
             assertTrue(as.isDefined(e.nextElement()));
         }
         assertEquals(as.getAttributeCount(), count);
-
         count = 0;
-        for (Enumeration e = asWithResolver.getAttributeNames();
-             e.hasMoreElements();) {
-
+        for (Enumeration<?> e = asWithResolver.getAttributeNames(); e.hasMoreElements();)
{
             count++;
             assertTrue(asWithResolver.isDefined(e.nextElement()));
         }
@@ -172,14 +153,12 @@
 
     public void testGetResolveParent() {
         assertNull(as.getResolveParent());
-
         assertNotNull(asWithResolver.getResolveParent());
     }
 
     public void testIsDefined() {
         assertTrue(as.isDefined(keys[1]));
         assertFalse(as.isDefined(values[1]));
-
         assertFalse(asWithResolver.isDefined(keyInResolver));
     }
 
@@ -187,32 +166,27 @@
         AttributeSet copy = as.copyAttributes();
         assertTrue(as.isEqual(copy));
         assertFalse(as.isEqual(SimpleAttributeSet.EMPTY));
-
         if (copy instanceof MutableAttributeSet) {
             MutableAttributeSet parent = new SimpleAttributeSet();
-            ((MutableAttributeSet)copy).setResolveParent(parent);
+            ((MutableAttributeSet) copy).setResolveParent(parent);
             assertFalse(as.isEqual(copy));
-
             String key = "key", value = "value";
             parent.addAttribute(key, value);
-            ((MutableAttributeSet)copy).setResolveParent(parent);
+            ((MutableAttributeSet) copy).setResolveParent(parent);
             assertFalse(as.isEqual(copy));
-
             if (as instanceof MutableAttributeSet) {
-                ((MutableAttributeSet)as).setResolveParent(parent);
+                ((MutableAttributeSet) as).setResolveParent(parent);
                 assertTrue(as.isEqual(copy));
-
                 MutableAttributeSet parent2 = new SimpleAttributeSet();
                 parent2.addAttribute(key, value);
-                ((MutableAttributeSet)as).setResolveParent(parent2);
+                ((MutableAttributeSet) as).setResolveParent(parent2);
                 assertTrue(as.isEqual(copy));
             }
         }
     }
 
     public void testResolveAttribute() {
-        assertSame(AttributeSet.ResolveAttribute,
-                   StyleConstants.ResolveAttribute);
+        assertSame(AttributeSet.ResolveAttribute, StyleConstants.ResolveAttribute);
     }
 
     public void testNameAttribute() {

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewRTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewRTest.java
Sun Nov 26 12:15:43 2006
@@ -21,7 +21,6 @@
 package javax.swing.text;
 
 import java.awt.Rectangle;
-
 import javax.swing.BasicSwingTestCase;
 import javax.swing.SizeRequirements;
 import javax.swing.text.ViewTestHelpers.ChildView;
@@ -29,22 +28,28 @@
 
 public class BoxViewRTest extends BasicSwingTestCase {
     private Document doc;
+
     private Element root;
+
     private BoxView view;
 
     private static final int width = 150;
+
     private static final int height = 325;
 
     private static class Child extends ChildView {
         private int width = -1;
+
         private int height = -1;
 
         public Child(final Element element, final int id) {
             super(element, id);
         }
+
+        @Override
         public void setSize(float width, float height) {
-            this.width = (int)width;
-            this.height = (int)height;
+            this.width = (int) width;
+            this.height = (int) height;
             super.setSize(width, height);
         }
 
@@ -57,6 +62,7 @@
         }
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         doc = new DefaultStyledDocument();
@@ -68,18 +74,14 @@
      * Checks that children have their sizes set after setSize.
      */
     public void testSetSizeChildren() throws Exception {
-        View[] children = new View[] {
-            new Child(root.getElement(0), 0),
-            new Child(root.getElement(1), 1),
-        };
+        View[] children = new View[] { new Child(root.getElement(0), 0),
+                new Child(root.getElement(1), 1), };
         view.replace(0, view.getViewCount(), children);
         view.setSize(width, height);
-
-        Child child = (Child)view.getView(0);
+        Child child = (Child) view.getView(0);
         assertEquals(view.getSpan(View.X_AXIS, 0), child.getWidth());
         assertEquals(view.getSpan(View.Y_AXIS, 0), child.getHeight());
-
-        child = (Child)view.getView(1);
+        child = (Child) view.getView(1);
         assertEquals(view.getSpan(View.X_AXIS, 1), child.getWidth());
         assertEquals(view.getSpan(View.Y_AXIS, 1), child.getHeight());
     }
@@ -88,22 +90,18 @@
      * Checks that children have their sizes set after layout.
      */
     public void testLayoutChildren() throws Exception {
-        View[] children = new View[] {
-            new Child(root.getElement(0), 0),
-            new Child(root.getElement(1), 1),
-        };
+        View[] children = new View[] { new Child(root.getElement(0), 0),
+                new Child(root.getElement(1), 1), };
         view.replace(0, view.getViewCount(), children);
         view.layout(width, height);
-
-        Child child = (Child)view.getView(0);
+        Child child = (Child) view.getView(0);
         final int childWidth = child.getWidth();
         final int childHeight = child.getHeight();
         assertEquals(view.getSpan(View.X_AXIS, 0), childWidth);
         assertEquals(view.getSpan(View.Y_AXIS, 0), childHeight);
         assertTrue(childWidth != -1);
         assertTrue(childHeight != -1);
-
-        child = (Child)view.getView(1);
+        child = (Child) view.getView(1);
         assertEquals(view.getSpan(View.X_AXIS, 1), child.getWidth());
         assertEquals(view.getSpan(View.Y_AXIS, 1), child.getHeight());
     }
@@ -115,45 +113,39 @@
      * cause stack overflow if a child always changes its preferences.
      */
     public void testLayout() throws Exception {
-        View[] children = new View[] {
-            new Child(root.getElement(0), 0),
-            new Child(root.getElement(1), 1) {
-                private int iteration = 0;
-                private int[] heights = {20, 40, 15, 11, 23};
-
-                public float getPreferredSpan(int axis) {
-                    if (axis == X_AXIS) {
-                        return super.getPreferredSpan(axis);
-                    } else {
-                        return heights[iteration < heights.length
-                                       ? iteration
-                                       : heights.length];
+        View[] children = new View[] { new Child(root.getElement(0), 0),
+                new Child(root.getElement(1), 1) {
+                    private int iteration = 0;
+
+                    private int[] heights = { 20, 40, 15, 11, 23 };
+
+                    @Override
+                    public float getPreferredSpan(int axis) {
+                        if (axis == X_AXIS) {
+                            return super.getPreferredSpan(axis);
+                        }
+                        return heights[iteration < heights.length ? iteration
+                                : heights.length];
                     }
-                }
 
-                public void setSize(float width, float height) {
-                    super.setSize(width, height);
-                    if (++iteration < heights.length) {
-                        preferenceChanged(view, false, true);
+                    @Override
+                    public void setSize(float width, float height) {
+                        super.setSize(width, height);
+                        if (++iteration < heights.length) {
+                            preferenceChanged(view, false, true);
+                        }
                     }
-                }
-            }
-        };
+                } };
         view.replace(0, view.getViewCount(), children);
         view.layout(300, 500);
-
         Rectangle shape = new Rectangle(300, 500);
-        Rectangle[] allocs = {
-            new Rectangle(0, 0, 25, 32),
-            new Rectangle(56, 32, 75, isHarmony() ? 23 : 40)
-        };
+        Rectangle[] allocs = { new Rectangle(0, 0, 25, 32),
+                new Rectangle(56, 32, 75, isHarmony() ? 23 : 40) };
         for (int i = 0; i < view.getViewCount(); i++) {
-            assertEquals("@ " + i,
-                         allocs[i], view.getChildAllocation(i, shape));
+            assertEquals("@ " + i, allocs[i], view.getChildAllocation(i, shape));
         }
-        assertEquals(75, (int)view.getPreferredSpan(View.X_AXIS));
-        assertEquals(isHarmony() ? 55 : 47,
-                     (int)view.getPreferredSpan(View.Y_AXIS));
+        assertEquals(75, (int) view.getPreferredSpan(View.X_AXIS));
+        assertEquals(isHarmony() ? 55 : 47, (int) view.getPreferredSpan(View.Y_AXIS));
     }
 
     /**
@@ -162,7 +154,6 @@
     public void testSetAxisLayout() {
         assertEquals(View.Y_AXIS, view.getAxis());
         view.layout(width, height);
-
         assertTrue(view.isAllocationValid());
         assertTrue(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
@@ -174,53 +165,45 @@
 
     public void testBaselineLayout() throws BadLocationException {
         doc.insertString(0, "uno\ndos\t2\ntres\ncuatro", null);
-
         final Marker major = new Marker(true);
         final Marker minor = new Marker(true);
         final Marker baseline = new Marker(true);
         view = new BoxView(root, View.Y_AXIS) {
-            protected SizeRequirements
-                baselineRequirements(int axis, SizeRequirements r) {
-
+            @Override
+            protected SizeRequirements baselineRequirements(int axis, SizeRequirements r)
{
                 baseline.setOccurred();
                 return super.baselineRequirements(axis, r);
             }
 
-            protected SizeRequirements
-                calculateMajorAxisRequirements(int axis, SizeRequirements r) {
-
+            @Override
+            protected SizeRequirements calculateMajorAxisRequirements(int axis,
+                    SizeRequirements r) {
                 major.setOccurred();
                 return super.calculateMajorAxisRequirements(axis, r);
             }
 
-            protected SizeRequirements
-                calculateMinorAxisRequirements(int axis, SizeRequirements r) {
-
+            @Override
+            protected SizeRequirements calculateMinorAxisRequirements(int axis,
+                    SizeRequirements r) {
                 minor.setOccurred();
                 return super.calculateMinorAxisRequirements(axis, r);
             }
         };
         view.loadChildren(new ChildrenFactory());
-
         final int[] offsets = new int[view.getViewCount()];
-        final int[] spans   = new int[view.getViewCount()];
-
+        final int[] spans = new int[view.getViewCount()];
         view.baselineLayout(width, View.X_AXIS, offsets, spans);
         assertFalse(baseline.isOccurred());
         assertFalse(major.isOccurred());
         assertTrue(minor.isOccurred());
-
         view.baselineLayout(height, View.Y_AXIS, offsets, spans);
         assertFalse(baseline.isOccurred());
         assertTrue(major.isOccurred());
         assertFalse(minor.isOccurred());
-
-
         view.baselineLayout(width, View.X_AXIS, offsets, spans);
         assertFalse(baseline.isOccurred());
         assertFalse(major.isOccurred());
         assertFalse(minor.isOccurred());
-
         view.baselineLayout(height, View.Y_AXIS, offsets, spans);
         assertFalse(baseline.isOccurred());
         assertFalse(major.isOccurred());
@@ -233,12 +216,10 @@
      */
     public void testGetResizeWeight() {
         view = new BoxView(root, View.Y_AXIS) {
-            protected SizeRequirements
-                calculateMinorAxisRequirements(final int axis,
-                                               final SizeRequirements r) {
-
-                SizeRequirements result = r != null ? r
-                                                    : new SizeRequirements();
+            @Override
+            protected SizeRequirements calculateMinorAxisRequirements(final int axis,
+                    final SizeRequirements r) {
+                SizeRequirements result = r != null ? r : new SizeRequirements();
                 result.minimum = result.preferred = result.maximum = 121;
                 return result;
             }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/BoxViewTest.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$
@@ -22,21 +21,22 @@
 package javax.swing.text;
 
 import java.awt.Rectangle;
-
 import javax.swing.BasicSwingTestCase;
 
 public class BoxViewTest extends BasicSwingTestCase {
-
     private Document doc;
-    private Element  root;
-    private BoxView  view;
+
+    private Element root;
+
+    private BoxView view;
 
     /*
      * @see TestCase#setUp()
      */
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-        doc  = new PlainDocument();
+        doc = new PlainDocument();
         doc.insertString(0, "line1\nline\t2", null);
         root = doc.getDefaultRootElement();
         view = new BoxView(root, View.X_AXIS);
@@ -45,23 +45,20 @@
     public void testGetAlignment() {
         assertEquals(0.5f, view.getAlignment(View.X_AXIS), 0.00001f);
         assertEquals(0.5f, view.getAlignment(View.Y_AXIS), 0.00001f);
-
         try {
             view.getAlignment(3);
-
             fail("IllegalArgumentException must be thrown");
-        } catch (IllegalArgumentException e) { }
+        } catch (IllegalArgumentException e) {
+        }
     }
 
     public void testPreferenceChanged() {
         view.layout(width, height);
         assertTrue(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
-
         view.preferenceChanged(null, true, false);
         assertFalse(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
-
         view.layout(width, height);
         view.preferenceChanged(null, false, true);
         assertTrue(view.isLayoutValid(View.X_AXIS));
@@ -73,99 +70,82 @@
         assertEquals(0, view.getViewCount());
         try {
             view.getOffset(view.getAxis(), 0);
-
             fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+        } catch (ArrayIndexOutOfBoundsException e) {
+        }
         try {
             view.getSpan(view.getAxis(), 0);
-
             fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
-
+        } catch (ArrayIndexOutOfBoundsException e) {
+        }
         // Do layout and check it became valid
         view.layout(width, height);
         assertTrue(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
-
         // Add two children into the view
-        view.replace(0, 0,
-                     new View[] {new PlainView(root), new PlainView(root)});
-
+        view.replace(0, 0, new View[] { new PlainView(root), new PlainView(root) });
         // Check the side effects
         assertFalse(view.isLayoutValid(View.X_AXIS));
         assertFalse(view.isLayoutValid(View.Y_AXIS));
-
         // Now we can get offset and span of child at index 1
         view.getOffset(view.getAxis(), 1);
         view.getSpan(view.getAxis(), 1);
-
         // ...but can't get ones of child at index 2 as it doesn't exist
         try {
             view.getOffset(view.getAxis(), 2);
-
             fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+        } catch (ArrayIndexOutOfBoundsException e) {
+        }
         try {
             view.getSpan(view.getAxis(), 2);
-
             fail("ArrayIndexOutOfBoundsException is expected");
-        } catch (ArrayIndexOutOfBoundsException e) { }
+        } catch (ArrayIndexOutOfBoundsException e) {
+        }
     }
 
-    private static void assertCalled(final boolean[] called,
-                                     final boolean layout,
-                                     final boolean major,
-                                     final boolean minor) {
+    private static void assertCalled(final boolean[] called, final boolean layout,
+            final boolean major, final boolean minor) {
         assertEquals(layout, called[0]);
-        assertEquals(major,  called[1]);
-        assertEquals(minor,  called[2]);
-
+        assertEquals(major, called[1]);
+        assertEquals(minor, called[2]);
         // Reset flags
         called[0] = called[1] = called[2] = false;
     }
 
     public void testSetSize() {
-        final boolean[] called = new boolean[] {false, false, false};
-
+        final boolean[] called = new boolean[] { false, false, false };
         view = new BoxView(root, View.X_AXIS) {
+            @Override
             public void layout(final int w, final int h) {
                 assertEquals(width - getLeftInset() - getRightInset(), w);
-                assertEquals(height - getTopInset() -  getBottomInset(), h);
-
+                assertEquals(height - getTopInset() - getBottomInset(), h);
                 called[0] = true;
-
                 super.layout(w, h);
             }
 
-            protected void layoutMajorAxis(final int targetSpan,
-                                           final int axis,
-                                           final int[] offsets,
-                                           final int[] spans) {
+            @Override
+            protected void layoutMajorAxis(final int targetSpan, final int axis,
+                    final int[] offsets, final int[] spans) {
                 called[1] = true;
                 super.layoutMajorAxis(targetSpan, axis, offsets, spans);
             }
 
-            protected void layoutMinorAxis(final int targetSpan,
-                                           final int axis,
-                                           final int[] offsets,
-                                           final int[] spans) {
+            @Override
+            protected void layoutMinorAxis(final int targetSpan, final int axis,
+                    final int[] offsets, final int[] spans) {
                 called[2] = true;
                 super.layoutMinorAxis(targetSpan, axis, offsets, spans);
             }
         };
-
         view.setSize(width, height);
         assertCalled(called, true, true, true);
-
         // Call with same sizes doesn't do the layout itself
         view.setSize(width, height);
         assertCalled(called, true, false, false);
-
         // Set only left inset, layout of the major axis (X) must be updated
-        view.setInsets((short)0, (short)1, (short)0, (short)0);
+        view.setInsets((short) 0, (short) 1, (short) 0, (short) 0);
         view.setSize(width, height);
         assertCalled(called, true, true, false);
-
         // Set new insets and try again
         view.setParagraphInsets(CompositeViewTest.getAttributeSet());
         view.setSize(width, height);
@@ -184,7 +164,6 @@
      */
     public void testIsAfter01() {
         assertEquals(View.X_AXIS, view.getAxis());
-
         assertFalse(view.isAfter(0, 0, rect));
         assertFalse(view.isAfter(9, 0, rect));
         assertFalse(view.isAfter(0, 14, rect));
@@ -193,19 +172,15 @@
         assertFalse(view.isAfter(9, 35, rect));
         assertFalse(view.isAfter(10, 14, rect));
         assertFalse(view.isAfter(10, 15, rect));
-
         assertFalse(view.isAfter(20, 15, rect));
         assertFalse(view.isAfter(20, 14, rect));
-
         assertFalse(view.isAfter(20, 45, rect));
-        assertFalse(view.isAfter(20, 46, rect));                        // *
-        assertFalse(view.isAfter(20, 50, rect));                        // *
-
+        assertFalse(view.isAfter(20, 46, rect)); // *
+        assertFalse(view.isAfter(20, 50, rect)); // *
         assertFalse(view.isAfter(30, 20, rect));
-
-        assertTrue(view.isAfter(31, 20, rect));                         // *
-        assertTrue(view.isAfter(31, 15, rect));                         // *
-        assertTrue(view.isAfter(31, 0, rect));                          // *
+        assertTrue(view.isAfter(31, 20, rect)); // *
+        assertTrue(view.isAfter(31, 15, rect)); // *
+        assertTrue(view.isAfter(31, 0, rect)); // *
     }
 
     /**
@@ -215,7 +190,6 @@
      */
     public void testIsAfter02() {
         view.setAxis(View.Y_AXIS);
-
         assertFalse(view.isAfter(0, 0, rect));
         assertFalse(view.isAfter(9, 0, rect));
         assertFalse(view.isAfter(0, 14, rect));
@@ -224,19 +198,15 @@
         assertFalse(view.isAfter(9, 35, rect));
         assertFalse(view.isAfter(10, 14, rect));
         assertFalse(view.isAfter(10, 15, rect));
-
         assertFalse(view.isAfter(20, 15, rect));
         assertFalse(view.isAfter(20, 14, rect));
-
         assertFalse(view.isAfter(20, 45, rect));
-        assertTrue(view.isAfter(20, 46, rect));                         // *
-        assertTrue(view.isAfter(20, 50, rect));                         // *
-
+        assertTrue(view.isAfter(20, 46, rect)); // *
+        assertTrue(view.isAfter(20, 50, rect)); // *
         assertFalse(view.isAfter(30, 20, rect));
-
-        assertFalse(view.isAfter(31, 20, rect));                        // *
-        assertFalse(view.isAfter(31, 15, rect));                        // *
-        assertFalse(view.isAfter(31, 0, rect));                         // *
+        assertFalse(view.isAfter(31, 20, rect)); // *
+        assertFalse(view.isAfter(31, 15, rect)); // *
+        assertFalse(view.isAfter(31, 0, rect)); // *
     }
 
     /**
@@ -249,13 +219,12 @@
         assertTrue(view.isBefore(9, 0, rect));
         assertTrue(view.isBefore(0, 14, rect));
         assertTrue(view.isBefore(9, 14, rect));
-        assertTrue(view.isBefore(9, 15, rect));                         // *
-        assertTrue(view.isBefore(9, 35, rect));                         // *
-
-        assertFalse(view.isBefore(10, 14, rect));                       // *
+        assertTrue(view.isBefore(9, 15, rect)); // *
+        assertTrue(view.isBefore(9, 35, rect)); // *
+        assertFalse(view.isBefore(10, 14, rect)); // *
         assertFalse(view.isBefore(10, 15, rect));
         assertFalse(view.isBefore(20, 15, rect));
-        assertFalse(view.isBefore(20, 14, rect));                       // *
+        assertFalse(view.isBefore(20, 14, rect)); // *
     }
 
     /**
@@ -265,31 +234,28 @@
      */
     public void testIsBefore02() {
         view.setAxis(View.Y_AXIS);
-
         assertTrue(view.isBefore(0, 0, rect));
         assertTrue(view.isBefore(9, 0, rect));
         assertTrue(view.isBefore(0, 14, rect));
         assertTrue(view.isBefore(9, 14, rect));
-        assertFalse(view.isBefore(9, 15, rect));                        // *
-        assertFalse(view.isBefore(9, 35, rect));                        // *
-
-        assertTrue(view.isBefore(10, 14, rect));                        // *
+        assertFalse(view.isBefore(9, 15, rect)); // *
+        assertFalse(view.isBefore(9, 35, rect)); // *
+        assertTrue(view.isBefore(10, 14, rect)); // *
         assertFalse(view.isBefore(10, 15, rect));
         assertFalse(view.isBefore(20, 15, rect));
-        assertTrue(view.isBefore(20, 14, rect));                        // *
+        assertTrue(view.isBefore(20, 14, rect)); // *
     }
 
     public void testBoxView() {
         view = new BoxView(root, View.X_AXIS);
         assertSame(root, view.getElement());
         assertEquals(View.X_AXIS, view.getAxis());
-
         view = new BoxView(root, View.Y_AXIS);
         assertSame(root, view.getElement());
         assertEquals(View.Y_AXIS, view.getAxis());
-
         final boolean[] setAxisCalled = new boolean[1];
         view = new BoxView(root, -1251) {
+            @Override
             public void setAxis(int axis) {
                 setAxisCalled[0] = true;
                 super.setAxis(axis);
@@ -309,16 +275,13 @@
         assertFalse(view.isLayoutValid(View.X_AXIS));
         view.layout(width, height);
         assertEquals(height, view.getHeight());
-
         view.setSize(width, height);
         assertEquals(height, view.getHeight());
-
         // Layout invalidation doesn't change the height
         view.layoutChanged(View.Y_AXIS);
         assertEquals(height, view.getHeight());
-
         // Put some insets
-        view.setInsets((short)10, (short)0, (short)0, (short)0);
+        view.setInsets((short) 10, (short) 0, (short) 0, (short) 0);
         view.setSize(width, height);
         if (isHarmony()) {
             assertEquals(height - view.getTopInset(), view.getHeight());
@@ -326,8 +289,7 @@
             // The width isn't changed
             assertEquals(height, view.getHeight());
         }
-
-        view.setInsets((short)0, (short)0, (short)10, (short)0);
+        view.setInsets((short) 0, (short) 0, (short) 10, (short) 0);
         view.setSize(width, height);
         if (isHarmony()) {
             assertEquals(height - view.getBottomInset(), view.getHeight());
@@ -335,15 +297,14 @@
             // The width is reduced by right inset twice
             assertEquals(height - 2 * view.getBottomInset(), view.getHeight());
         }
-
         // No matter if insets are set, layout width isn't changed
-        view.setInsets((short)7, (short)0, (short)4, (short)0);
+        view.setInsets((short) 7, (short) 0, (short) 4, (short) 0);
         view.layout(width, height);
         if (isHarmony()) {
             assertEquals(height, view.getHeight());
         } else {
-            assertEquals(height + (view.getTopInset() - view.getBottomInset()),
-                         view.getHeight());
+            assertEquals(height + (view.getTopInset() - view.getBottomInset()), view
+                    .getHeight());
         }
     }
 
@@ -352,16 +313,13 @@
         assertFalse(view.isLayoutValid(View.X_AXIS));
         view.layout(width, height);
         assertEquals(width, view.getWidth());
-
         view.setSize(width, height);
         assertEquals(width, view.getWidth());
-
         // Layout invalidation doesn't change the width
         view.layoutChanged(View.X_AXIS);
         assertEquals(width, view.getWidth());
-
         // Put some insets
-        view.setInsets((short)0, (short)10, (short)0, (short)0);
+        view.setInsets((short) 0, (short) 10, (short) 0, (short) 0);
         view.setSize(width, height);
         if (isHarmony()) {
             assertEquals(width - view.getLeftInset(), view.getWidth());
@@ -369,8 +327,7 @@
             // The width isn't changed
             assertEquals(width, view.getWidth());
         }
-
-        view.setInsets((short)0, (short)0, (short)0, (short)10);
+        view.setInsets((short) 0, (short) 0, (short) 0, (short) 10);
         view.setSize(width, height);
         if (isHarmony()) {
             assertEquals(width - view.getRightInset(), view.getWidth());
@@ -378,24 +335,20 @@
             // The width is reduced by right inset twice
             assertEquals(width - 2 * view.getRightInset(), view.getWidth());
         }
-
         // No matter if insets are set, layout width isn't changed
-        view.setInsets((short)0, (short)7, (short)0, (short)4);
+        view.setInsets((short) 0, (short) 7, (short) 0, (short) 4);
         view.layout(width, height);
         if (isHarmony()) {
             assertEquals(width, view.getWidth());
         } else {
-            assertEquals(width + (view.getLeftInset() - view.getRightInset()),
-                         view.getWidth());
+            assertEquals(width + (view.getLeftInset() - view.getRightInset()), view.getWidth());
         }
     }
 
     public void testIsAllocationValid() {
         assertFalse(view.isAllocationValid());
-
         view.layout(width, height);
         assertTrue(view.isAllocationValid());
-
         view.preferenceChanged(null, true, false);
         assertFalse(view.isAllocationValid());
     }
@@ -403,56 +356,53 @@
     public void testIsLayoutValid() {
         assertFalse(view.isLayoutValid(View.X_AXIS));
         assertFalse(view.isLayoutValid(View.Y_AXIS));
-
         view.layout(width, height);
-
         assertTrue(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
     }
 
-    private final int width  = 150;
+    private final int width = 150;
+
     private final int height = 325;
 
     public void testLayout() {
-        final boolean[] called = new boolean[] {false, false};
-
+        final boolean[] called = new boolean[] { false, false };
         view = new BoxView(root, View.X_AXIS) {
-            protected void layoutMajorAxis(final int targetSpan,
-                                           final int axis,
-                                           final int[] offsets,
-                                           final int[] spans) {
+            @Override
+            protected void layoutMajorAxis(final int targetSpan, final int axis,
+                    final int[] offsets, final int[] spans) {
                 called[0] = true;
                 assertEquals(width, targetSpan);
                 assertEquals(X_AXIS, axis);
                 super.layoutMajorAxis(targetSpan, axis, offsets, spans);
             }
 
-            protected void layoutMinorAxis(final int targetSpan,
-                                           final int axis,
-                                           final int[] offsets,
-                                           final int[] spans) {
+            @Override
+            protected void layoutMinorAxis(final int targetSpan, final int axis,
+                    final int[] offsets, final int[] spans) {
                 called[1] = true;
                 assertEquals(height, targetSpan);
                 assertEquals(Y_AXIS, axis);
                 super.layoutMinorAxis(targetSpan, axis, offsets, spans);
             }
-
         };
-
         assertFalse(view.isLayoutValid(View.X_AXIS));
         assertFalse(view.isLayoutValid(View.Y_AXIS));
         view.layout(width, height);
         assertTrue(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
-        assertTrue(called[0]);          called[0] = false;
-        assertTrue(called[1]);          called[1] = false;
-
+        assertTrue(called[0]);
+        called[0] = false;
+        assertTrue(called[1]);
+        called[1] = false;
         view.preferenceChanged(null, true, false);
         assertFalse(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
         view.layout(width, height);
-        assertTrue(called[0]);          called[0] = false;
-        assertFalse(called[1]);         called[1] = false;
+        assertTrue(called[0]);
+        called[0] = false;
+        assertFalse(called[1]);
+        called[1] = false;
     }
 
     /**
@@ -461,28 +411,24 @@
      * <code>layout</code> is changed.
      */
     public void testLayout02() {
-        final boolean[] called = new boolean[] {false};
-
+        final boolean[] called = new boolean[] { false };
         view = new BoxView(root, View.X_AXIS) {
+            @Override
             public void layoutChanged(int axis) {
                 called[0] = false;
                 super.layoutChanged(axis);
             }
         };
-
         assertFalse(view.isLayoutValid(View.X_AXIS));
         assertFalse(view.isLayoutValid(View.Y_AXIS));
         view.layout(width, height);
         assertTrue(view.isLayoutValid(View.X_AXIS));
         assertTrue(view.isLayoutValid(View.Y_AXIS));
         assertFalse(called[0]);
-
         view.layout(width, height);
         assertFalse(called[0]);
-
         view.layout(width - 10, height);
         assertFalse(called[0]);
-
         view.layout(width - 10, height - 20);
         assertFalse(called[0]);
     }
@@ -499,20 +445,16 @@
     public void testSetAxis() {
         view.setAxis(View.Y_AXIS);
         assertEquals(View.Y_AXIS, view.getAxis());
-
         view.setAxis(View.X_AXIS);
         assertEquals(View.X_AXIS, view.getAxis());
-
         view.setAxis(-1251);
         assertEquals(-1251, view.getAxis());
     }
-
     /*
-    public void testPaint() {
-    }
-
-    public void testPaintChild() {
-    }
-    */
+     public void testPaint() {
+     }
 
+     public void testPaintChild() {
+     }
+     */
 }



Mime
View raw message