harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r479240 [20/28] - /harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/
Date Sun, 26 Nov 2006 00:04:16 GMT
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextArea_MultithreadedTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextArea_MultithreadedTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextArea_MultithreadedTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextArea_MultithreadedTest.java Sat Nov 25 16:04:10 2006
@@ -20,7 +20,6 @@
  */
 package javax.swing;
 
-
 import java.awt.Container;
 import java.awt.GridLayout;
 import junit.framework.TestCase;
@@ -44,13 +43,11 @@
             + " Edison cap, \tEdison effect\n"
             + "Edison screw, Edison screw cap, Edison screw \n"
             + "holder, Edison screw lampholder, Edison screw " + "plug\n"
-            + "Edison screw terminal, Edison storage battery"
-            + "Edison storage \t\tcell";
+            + "Edison screw terminal, Edison storage battery" + "Edison storage \t\tcell";
 
-    String bidiContent = sLTR + sRTL + sRTL + " \t" + sLTR + sRTL + sLTR + "\n"
-            + sRTL + "." + sLTR + sRTL + "\t" + sRTL + "\n" + sLTR + sLTR
-            + sRTL + sRTL + sRTL + sLTR + sLTR + sLTR + sRTL + sLTR + sRTL
-            + sLTR;
+    String bidiContent = sLTR + sRTL + sRTL + " \t" + sLTR + sRTL + sLTR + "\n" + sRTL + "."
+            + sLTR + sRTL + "\t" + sRTL + "\n" + sLTR + sLTR + sRTL + sRTL + sRTL + sLTR + sLTR
+            + sLTR + sRTL + sLTR + sRTL + sLTR;
 
     String str1 = "jazz band";
 
@@ -60,6 +57,7 @@
 
     String message;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         bWasException = false;
@@ -77,13 +75,12 @@
         jf.pack();
     }
 
+    @Override
     protected void tearDown() throws Exception {
         jf.dispose();
         super.tearDown();
     }
 
-
-
     String replaceRange(final String s1, final String s2, final int start, final int end) {
         String tmp = s2 == null ? "" : s2;
         return s1.substring(0, start) + tmp + s1.substring(end, s1.length());
@@ -99,19 +96,16 @@
         jta.replaceRange("", 5, 10);
         tmp = replaceRange(tmp, "", 5, 10);
         assertEquals(tmp, jta.getText());
-
         try {
             jta.replaceRange(str2, -1, 5);
         } catch (IllegalArgumentException e) {
             bWasException = true;
             message = e.getMessage();
         }
-
         assertTrue(bWasException);
         assertEquals("Invalid remove", message);
         bWasException = false;
         message = null;
-
         try {
             jta.replaceRange(str2, 1, tmp.length() + 1);
         } catch (IllegalArgumentException e) {
@@ -122,7 +116,6 @@
         assertEquals("Invalid remove", message);
         bWasException = false;
         message = null;
-
         try {
             jta.replaceRange(str2, 10, 5);
         } catch (IllegalArgumentException e) {
@@ -173,7 +166,6 @@
         }
         assertFalse(bWasException);
         assertNull(message);
-
     }
 
     public void testAppend() throws Exception {
@@ -185,6 +177,4 @@
         jta.append("");
         assertEquals(tmp, jta.getText());
     }
-
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextFieldTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextFieldTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextFieldTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextFieldTest.java Sat Nov 25 16:04:10 2006
@@ -31,12 +31,11 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 /*
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-*/
-
+ import java.io.FileInputStream;
+ import java.io.FileOutputStream;
+ import java.io.ObjectInputStream;
+ import java.io.ObjectOutputStream;
+ */
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleState;
 import javax.accessibility.AccessibleStateSet;
@@ -49,81 +48,100 @@
 
 public class JTextFieldTest extends SwingTestCase {
     String sLTR = "abcd";
+
     String sRTL = "\u05dc" + "\u05dc" + "\u05dc" + "\u05dc";
+
     String bidiContent = sLTR + sRTL + sLTR + sRTL + sLTR + sRTL;
+
     boolean bWasException;
 
-    String content = "British Air Line Pilots Association " +
-                     "British Academy " +
-                     "British Airways ";
+    String content = "British Air Line Pilots Association " + "British Academy "
+            + "British Airways ";
+
     String fireOrder;
+
     JFrame jf;
+
     ExtJTextField jtf;
+
     JTextField jtfBidi;
+
     JTextField jtfScroll;
+
     SimplePropertyChangeListener listener;
+
     String message;
 
-    class ExtJTextField extends JTextField{
+    class ExtJTextField extends JTextField {
+        private static final long serialVersionUID = 1L;
+
         Action configureFrom = null;
+
         Action createFrom = null;
+
         boolean wasCallInvalidate = false;
+
         boolean wasCallRevalidate = false;
+
         boolean wasConfigureProperties = false;
+
         boolean wasCreateListeners = false;
 
-        public ExtJTextField(final String s){
+        public ExtJTextField(final String s) {
             super(s);
         }
 
+        @Override
         protected void configurePropertiesFromAction(final Action a) {
             wasConfigureProperties = true;
             configureFrom = a;
             super.configurePropertiesFromAction(a);
         }
 
-        protected PropertyChangeListener createActionPropertyChangeListener(
-                final Action a) {
+        @Override
+        protected PropertyChangeListener createActionPropertyChangeListener(final Action a) {
             wasCreateListeners = true;
             createFrom = a;
             return super.createActionPropertyChangeListener(a);
         }
+
+        @Override
         public void invalidate() {
             wasCallInvalidate = true;
             super.invalidate();
         }
 
-        void resetTestedFields(){
+        void resetTestedFields() {
             wasConfigureProperties = false;
             wasCreateListeners = false;
             createFrom = null;
             configureFrom = null;
         }
 
+        @Override
         public void revalidate() {
             wasCallRevalidate = true;
             super.revalidate();
         }
-
     }
 
-    class SimpleActionListener implements ActionListener{
+    class SimpleActionListener implements ActionListener {
         ActionEvent actionEvent = null;
+
         String name;
-        SimpleActionListener(final String s){
+
+        SimpleActionListener(final String s) {
             name = s;
         }
+
         public void actionPerformed(final ActionEvent ae) {
             actionEvent = ae;
             fireOrder += name;
         }
-
     }
 
-    class SimpleChangeListener implements ChangeListener{
-
+    class SimpleChangeListener implements ChangeListener {
         public void stateChanged(final ChangeEvent arg0) {
-
         }
     }
 
@@ -135,36 +153,30 @@
             event = null;
             return e;
         }
+
         public void propertyChange(final PropertyChangeEvent e) {
-            if  (e.getPropertyName() != "ancestor"){
+            if (e.getPropertyName() != "ancestor") {
                 event = e;
             }
         }
     }
 
-
-    private String changeString(final String s){
-        return s.replaceFirst("layout[^,]*,", "").
-            replaceFirst("flag[^,]*,","");
-    }
-
-    private Dimension getPrefferedSize(final JTextField c){
+    private Dimension getPrefferedSize(final JTextField c) {
         int widthColumn = c.getColumns() * c.getColumnWidth();
         Dimension dim = c.getPreferredScrollableViewportSize();
         int width = Math.max(dim.width, widthColumn);
         return new Dimension(width, dim.height);
     }
 
-
-
-
-    void resetBRM(final BoundedRangeModel brm, final int min,final int value,final int ext,final int max){
+    void resetBRM(final BoundedRangeModel brm, final int min, final int value, final int ext,
+            final int max) {
         brm.setMinimum(min);
         brm.setValue(value);
         brm.setExtent(ext);
         brm.setMaximum(max);
     }
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         fireOrder = "";
@@ -173,7 +185,7 @@
         listener = new SimplePropertyChangeListener();
         jf = new JFrame();
         Container container = jf.getContentPane();
-        container.setLayout(new GridLayout(3,1,3,4));
+        container.setLayout(new GridLayout(3, 1, 3, 4));
         jtf = new ExtJTextField(content);
         jtf.addPropertyChangeListener(listener);
         jtfBidi = new JTextField(bidiContent);
@@ -181,139 +193,121 @@
         container.add(jtf);
         container.add(jtfBidi);
         container.add(new JScrollPane(jtfScroll));
-        ((JViewport)jtfScroll.getParent()).setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
+        ((JViewport) jtfScroll.getParent()).setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
         jf.pack();
     }
 
-
+    @Override
     protected void tearDown() throws Exception {
         jf.dispose();
         super.tearDown();
     }
 
-    public void testAccessibleJTextField(){
+    public void testAccessibleJTextField() {
         AccessibleContext accessible = jtf.getAccessibleContext();
         assertTrue(accessible instanceof JTextField.AccessibleJTextField);
         assertEquals(jtf.getAccessibleContext(), accessible);
-        JTextField.AccessibleJTextField access =
-            (JTextField.AccessibleJTextField) accessible;
+        JTextField.AccessibleJTextField access = (JTextField.AccessibleJTextField) accessible;
         AccessibleStateSet ass = access.getAccessibleStateSet();
         assertNotSame(ass, access.getAccessibleStateSet());
         assertTrue(ass.contains(AccessibleState.SINGLE_LINE));
         assertFalse(ass.contains(AccessibleState.MULTI_LINE));
     }
 
-    public void testAddRemoveGetActionListener(){
+    public void testAddRemoveGetActionListener() {
         SimpleActionListener listener1 = new SimpleActionListener("first");
         SimpleActionListener listener2 = new SimpleActionListener("second");
         SimpleActionListener listener3 = new SimpleActionListener("third");
         ActionListener[] listeners = jtf.getActionListeners();
         assertEquals(0, listeners.length);
-
         jtf.addActionListener(listener1);
         listeners = jtf.getActionListeners();
-        assertEquals(1,listeners.length);
+        assertEquals(1, listeners.length);
         assertEquals(listener1, listeners[0]);
-
         jtf.addActionListener(listener2);
         listeners = jtf.getActionListeners();
-        assertEquals(2,listeners.length);
+        assertEquals(2, listeners.length);
         assertEquals(listener2, listeners[0]);
         assertEquals(listener1, listeners[1]);
-
         jtf.addActionListener(listener3);
         listeners = jtf.getActionListeners();
-        assertEquals(3,listeners.length);
+        assertEquals(3, listeners.length);
         assertEquals(listener3, listeners[0]);
         assertEquals(listener2, listeners[1]);
         assertEquals(listener1, listeners[2]);
-
-        ActionListener listeners1[] = (ActionListener[])jtf.listenerList.
-            getListeners(ActionListener.class);
-
+        ActionListener listeners1[] = jtf.listenerList.getListeners(ActionListener.class);
         assertEquals(listener3, listeners1[0]);
         assertEquals(listener2, listeners1[1]);
         assertEquals(listener1, listeners1[2]);
-
-
         jtf.addActionListener(listener3);
         listeners = jtf.getActionListeners();
-        assertEquals(4,listeners.length);
+        assertEquals(4, listeners.length);
         assertEquals(listener3, listeners[0]);
         assertEquals(listener3, listeners[1]);
         assertEquals(listener2, listeners[2]);
         assertEquals(listener1, listeners[3]);
-
         jtf.removeActionListener(listener2);
         listeners = jtf.getActionListeners();
-        assertEquals(3,listeners.length);
+        assertEquals(3, listeners.length);
         assertEquals(listener3, listeners[0]);
         assertEquals(listener3, listeners[1]);
         assertEquals(listener1, listeners[2]);
-
         jtf.removeActionListener(listener1);
         listeners = jtf.getActionListeners();
-        assertEquals(2,listeners.length);
+        assertEquals(2, listeners.length);
         assertEquals(listener3, listeners[0]);
         assertEquals(listener3, listeners[1]);
-
         jtf.removeActionListener(listener2);
         listeners = jtf.getActionListeners();
-        assertEquals(2,listeners.length);
+        assertEquals(2, listeners.length);
         assertEquals(listener3, listeners[0]);
         assertEquals(listener3, listeners[1]);
-
         jtf.removeActionListener(listener3);
         listeners = jtf.getActionListeners();
         assertEquals(1, listeners.length);
         assertEquals(listener3, listeners[0]);
-
         jtf.removeActionListener(listener3);
         listeners = jtf.getActionListeners();
         assertEquals(0, listeners.length);
-
     }
 
-    public void testConfigurePropertiesFromAction(){
+    public void testConfigurePropertiesFromAction() {
         Action action = new DefaultEditorKit.CutAction();
-
         jtf.configurePropertiesFromAction(action);
         assertTrue(jtf.isEnabled());
         assertEquals(action.getValue(Action.SHORT_DESCRIPTION), jtf.getToolTipText());
         action.setEnabled(false);
-        action.putValue(Action.SHORT_DESCRIPTION,"THIS IS TOOLTIPTEXT");
+        action.putValue(Action.SHORT_DESCRIPTION, "THIS IS TOOLTIPTEXT");
         jtf.configurePropertiesFromAction(action);
         assertFalse(jtf.isEnabled());
         assertEquals(action.getValue(Action.SHORT_DESCRIPTION), jtf.getToolTipText());
     }
 
-    public void  testCreateActionPropertyChangeListener(){
+    public void testCreateActionPropertyChangeListener() {
         Action action = new DefaultEditorKit.CutAction();
         PropertyChangeListener listener = jtf.createActionPropertyChangeListener(action);
+        assertNotNull(listener);
         jtf.setAction(action);
         action.setEnabled(false);
-        action.putValue(Action.SHORT_DESCRIPTION,"THIS IS TOOLTIPTEXT");
+        action.putValue(Action.SHORT_DESCRIPTION, "THIS IS TOOLTIPTEXT");
         assertFalse(jtf.isEnabled());
-        assertEquals("THIS IS TOOLTIPTEXT",jtf.getToolTipText());
+        assertEquals("THIS IS TOOLTIPTEXT", jtf.getToolTipText());
         jtf.setAction(null);
-
         action.setEnabled(true);
-        action.putValue(Action.SHORT_DESCRIPTION,"THIS IS CHANGED TOOLTIPTEXT");
-
+        action.putValue(Action.SHORT_DESCRIPTION, "THIS IS CHANGED TOOLTIPTEXT");
         assertTrue(jtf.isEnabled());
         assertNull(jtf.getToolTipText());
-
     }
 
-    public void  testCreateDefaultModel(){
+    public void testCreateDefaultModel() {
         Document doc = jtf.createDefaultModel();
-        Document doc1 =jtf.createDefaultModel();
+        Document doc1 = jtf.createDefaultModel();
         assertTrue(doc instanceof PlainDocument);
         assertNotSame(jtf.getDocument(), doc);
         assertNotSame(doc1, doc);
     }
 
-    public void  testFireActionPerformed() {
+    public void testFireActionPerformed() {
         SimpleActionListener listener1 = new SimpleActionListener("first");
         SimpleActionListener listener2 = new SimpleActionListener("second");
         SimpleActionListener listener3 = new SimpleActionListener("third");
@@ -322,59 +316,57 @@
         jtf.addActionListener(listener3);
         fireOrder = "";
         jtf.setAction(new DefaultEditorKit.BeepAction() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
             public void actionPerformed(final ActionEvent arg0) {
                 fireOrder += "Action";
                 super.actionPerformed(arg0);
             }
-            });
+        });
         jtf.fireActionPerformed();
-        assertEquals("Actionthirdsecondfirst",fireOrder);
+        assertEquals("Actionthirdsecondfirst", fireOrder);
     }
 
-
-    public void  testGetActions() {
+    public void testGetActions() {
         Action editorKitActions[] = jtf.getUI().getEditorKit(jtf).getActions();
         Action jtfActions[] = jtf.getActions();
         assertEquals(editorKitActions.length + 1, jtfActions.length);
-        for(int i = 0; i < jtfActions.length; i ++){
+        for (int i = 0; i < jtfActions.length; i++) {
             boolean wasEqual = false;
-            for(int j = 0; j < editorKitActions.length; j++){
+            for (int j = 0; j < editorKitActions.length; j++) {
                 if (jtfActions[i] == editorKitActions[j]) {
                     wasEqual = true;
                     break;
                 }
             }
-            if (jtfActions[i].getValue(Action.NAME) == "notify-field-accept")
+            if (jtfActions[i].getValue(Action.NAME) == "notify-field-accept") {
                 wasEqual = true;
+            }
             assertTrue(wasEqual);
         }
     }
-    public void  testGetHorizontalVisibility() {
+
+    public void testGetHorizontalVisibility() {
         BoundedRangeModel brm = jtf.getHorizontalVisibility();
         assertTrue(brm instanceof DefaultBoundedRangeModel);
         assertEquals(0, brm.getMinimum());
         int prefWidth = jtf.getPreferredSize().width;
-        int width = jtf.getWidth();
         Insets insets = jtf.getInsets();
         int hrzInsets = insets.left + insets.right;
         int maxValue = prefWidth - hrzInsets;
-        int extValue = width - (hrzInsets + 1);
-
         assertEquals(0, brm.getValue());
         assertEquals(maxValue, brm.getExtent());
         assertEquals(maxValue, brm.getMaximum());
-
-
         assertFalse(brm.getValueIsAdjusting());
-        DefaultBoundedRangeModel dbrm = (DefaultBoundedRangeModel)brm;
+        DefaultBoundedRangeModel dbrm = (DefaultBoundedRangeModel) brm;
         assertEquals(1, dbrm.listenerList.getListenerCount());
         dbrm.fireStateChanged();
         assertEquals(dbrm, dbrm.changeEvent.getSource());
         assertEquals(1, dbrm.getChangeListeners().length);
-
     }
 
-    public void  testGetPreferredSize() {
+    public void testGetPreferredSize() {
         assertEquals(jtf.getPreferredSize(), jtf.getPreferredScrollableViewportSize());
         jtf.setColumns(10);
         assertEquals(getPrefferedSize(jtf), jtf.getPreferredSize());
@@ -382,54 +374,51 @@
         assertEquals(getPrefferedSize(jtf), jtf.getPreferredSize());
     }
 
-    public void  testGetUIClassID(){
+    public void testGetUIClassID() {
         assertEquals("TextFieldUI", jtf.getUIClassID());
         assertEquals("TextFieldUI", jtfBidi.getUIClassID());
-        assertEquals("TextFieldUI",jtfScroll.getUIClassID());
+        assertEquals("TextFieldUI", jtfScroll.getUIClassID());
     }
 
-    public void  testIsValidateRoot() {
+    public void testIsValidateRoot() {
         assertTrue(jtf.isValidateRoot());
         assertTrue(jtfBidi.isValidateRoot());
         assertFalse(jtfScroll.isValidateRoot());
     }
 
-    public void testJTextField(){
+    public void testJTextField() {
         JTextField tf = new JTextField();
-        assertEquals("",tf.getText());
+        assertEquals("", tf.getText());
         assertTrue(tf.getDocument() instanceof PlainDocument);
-        assertEquals(0,tf.getColumns());
+        assertEquals(0, tf.getColumns());
     }
 
-    public void testJTextFieldDocumentStringInt(){
+    public void testJTextFieldDocumentStringInt() {
         String str1 = "AAA";
         String str2 = "testJTextFieldDocumentStringInt()";
         Document doc = new PlainDocument();
         try {
-           doc.insertString(0,str2,null);
-        } catch(BadLocationException e){
-            assertTrue("Unexpected exception: " + e.getMessage(),false);
+            doc.insertString(0, str2, null);
+        } catch (BadLocationException e) {
+            assertTrue("Unexpected exception: " + e.getMessage(), false);
         }
-        JTextField tf = new JTextField(doc,str2,8);
-        assertEquals(str2,tf.getText());
+        JTextField tf = new JTextField(doc, str2, 8);
+        assertEquals(str2, tf.getText());
         assertEquals(doc, tf.getDocument());
-        assertEquals(8,tf.getColumns());
-
+        assertEquals(8, tf.getColumns());
         doc = new PlainDocument();
         try {
-           doc.insertString(0,str2,null);
-        } catch(BadLocationException e){
-            assertTrue("Unexpected exception: " + e.getMessage(),false);
+            doc.insertString(0, str2, null);
+        } catch (BadLocationException e) {
+            assertTrue("Unexpected exception: " + e.getMessage(), false);
         }
-        tf = new JTextField(doc,null,6);
+        tf = new JTextField(doc, null, 6);
         assertEquals(str2, tf.getText());
-
-        tf = new JTextField(doc,"",6);
-
+        tf = new JTextField(doc, "", 6);
         assertEquals("", tf.getText());
         try {
-            tf = new JTextField(doc,str1,-1);
-        } catch(IllegalArgumentException e){
+            tf = new JTextField(doc, str1, -1);
+        } catch (IllegalArgumentException e) {
             bWasException = true;
             message = e.getMessage();
         }
@@ -437,85 +426,80 @@
         assertEquals("columns less than zero.", message);
     }
 
-    public void testJTextFieldInt(){
+    public void testJTextFieldInt() {
         JTextField tf = new JTextField(5);
-
-        assertEquals("",tf.getText());
+        assertEquals("", tf.getText());
         assertTrue(tf.getDocument() instanceof PlainDocument);
-        assertEquals(5,tf.getColumns());
-
+        assertEquals(5, tf.getColumns());
         try {
             tf = new JTextField(-1);
-         } catch(IllegalArgumentException e){
+        } catch (IllegalArgumentException e) {
             bWasException = true;
             message = e.getMessage();
-         }
-         assertTrue(bWasException);
-         assertEquals("columns less than zero.", message);
-   }
+        }
+        assertTrue(bWasException);
+        assertEquals("columns less than zero.", message);
+    }
 
-    public void testJTextFieldString(){
+    public void testJTextFieldString() {
         String str1 = "testJTextFieldString()";
         JTextField tf = new JTextField(str1);
-        assertEquals(str1,tf.getText());
+        assertEquals(str1, tf.getText());
         assertTrue(tf.getDocument() instanceof PlainDocument);
-        assertEquals(0,tf.getColumns());
-
+        assertEquals(0, tf.getColumns());
     }
 
-    public void testJTextFieldStringInt(){
+    public void testJTextFieldStringInt() {
         String str1 = "testJTextFieldString()";
-        JTextField tf = new JTextField(str1,5);
-
-        assertEquals(str1,tf.getText());
+        JTextField tf = new JTextField(str1, 5);
+        assertEquals(str1, tf.getText());
         assertTrue(tf.getDocument() instanceof PlainDocument);
-        assertEquals(5,tf.getColumns());
-
+        assertEquals(5, tf.getColumns());
         try {
             tf = new JTextField(-1);
-         } catch(IllegalArgumentException e){
+        } catch (IllegalArgumentException e) {
             bWasException = true;
             message = e.getMessage();
-         }
-         assertTrue(bWasException);
-         assertEquals("columns less than zero.", message);
+        }
+        assertTrue(bWasException);
+        assertEquals("columns less than zero.", message);
     }
 
-    public void testNotifyAction(){
-        assertEquals("notify-field-accept",JTextField.notifyAction);
+    public void testNotifyAction() {
+        assertEquals("notify-field-accept", JTextField.notifyAction);
     }
+
     //implementation dependent
     /*
-    public void testParamString() {
-        jtf.setActionCommand("ACTION_COMMAND");
-        String str = "," +
-               jtf.getX() + "," +
-               jtf.getY() + "," +
-               jtf.getSize().width + "x" + jtf.getSize().height + "," +
-               "layout=" + jtf.getLayout() + "," ;
-       str =str.replaceFirst("@[^,}]*","");
-       str +=
-               "alignmentX=" + "null"+ "," + //1.4.2
-               "alignmentY=" + "null"+ "," + //1.4.2
-               //"alignmentX=" + "0.0"+ "," + //1.5.0
-               //"alignmentY=" + "0.0"+ "," + //1.5.0
-               "border=" + jtf.getBorder() + "," +
-               "flags=296" + "," +
-               "maximumSize=,minimumSize=,preferredSize=," +
-               "caretColor=" + jtf.getCaretColor() + "," +
-               "disabledTextColor=" + jtf.getDisabledTextColor() + "," +
-               "editable=" + jtf.isEditable() + "," +
-               "margin=" + jtf.getMargin() + "," +
-               "selectedTextColor=" + jtf.getSelectedTextColor() + "," +
-               "selectionColor=" + jtf.getSelectionColor() +"," +
-               "columns=" + jtf.getColumns() + "," +
-               "columnWidth=" + jtf.getColumnWidth() + "," +
-               "command=ACTION_COMMAND," +
-               "horizontalAlignment=LEADING";
-        assertEquals(changeString(str), changeString(jtf.paramString()));
-    } */
-
-    public void  testPostActionEvent(){
+     public void testParamString() {
+     jtf.setActionCommand("ACTION_COMMAND");
+     String str = "," +
+     jtf.getX() + "," +
+     jtf.getY() + "," +
+     jtf.getSize().width + "x" + jtf.getSize().height + "," +
+     "layout=" + jtf.getLayout() + "," ;
+     str =str.replaceFirst("@[^,}]*","");
+     str +=
+     "alignmentX=" + "null"+ "," + //1.4.2
+     "alignmentY=" + "null"+ "," + //1.4.2
+     //"alignmentX=" + "0.0"+ "," + //1.5.0
+     //"alignmentY=" + "0.0"+ "," + //1.5.0
+     "border=" + jtf.getBorder() + "," +
+     "flags=296" + "," +
+     "maximumSize=,minimumSize=,preferredSize=," +
+     "caretColor=" + jtf.getCaretColor() + "," +
+     "disabledTextColor=" + jtf.getDisabledTextColor() + "," +
+     "editable=" + jtf.isEditable() + "," +
+     "margin=" + jtf.getMargin() + "," +
+     "selectedTextColor=" + jtf.getSelectedTextColor() + "," +
+     "selectionColor=" + jtf.getSelectionColor() +"," +
+     "columns=" + jtf.getColumns() + "," +
+     "columnWidth=" + jtf.getColumnWidth() + "," +
+     "command=ACTION_COMMAND," +
+     "horizontalAlignment=LEADING";
+     assertEquals(changeString(str), changeString(jtf.paramString()));
+     } */
+    public void testPostActionEvent() {
         SimpleActionListener listener1 = new SimpleActionListener("first");
         SimpleActionListener listener2 = new SimpleActionListener("second");
         SimpleActionListener listener3 = new SimpleActionListener("third");
@@ -524,66 +508,58 @@
         jtf.addActionListener(listener3);
         fireOrder = "";
         jtf.setAction(new DefaultEditorKit.BeepAction() {
-        public void actionPerformed(final ActionEvent arg0) {
-            fireOrder += "Action";
-            super.actionPerformed(arg0);
-        }
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public void actionPerformed(final ActionEvent arg0) {
+                fireOrder += "Action";
+                super.actionPerformed(arg0);
+            }
         });
         jtf.postActionEvent();
-        assertEquals("Actionthirdsecondfirst",fireOrder);
-
+        assertEquals("Actionthirdsecondfirst", fireOrder);
     }
 
     void testPropertyChangeEvent(final String name, final int oldValue, final int newValue,
-            final PropertyChangeEvent event){
-        testPropertyChangeEvent(name, new Integer(oldValue), new Integer(newValue),
-                event);
+            final PropertyChangeEvent event) {
+        testPropertyChangeEvent(name, new Integer(oldValue), new Integer(newValue), event);
     }
 
-    void testPropertyChangeEvent(final String name, final Object oldValue, final Object newValue,
-            final PropertyChangeEvent event){
+    void testPropertyChangeEvent(final String name, final Object oldValue,
+            final Object newValue, final PropertyChangeEvent event) {
         assertEquals(name, event.getPropertyName());
         assertEquals(oldValue, event.getOldValue());
         assertEquals(newValue, event.getNewValue());
     }
 
-    public void  testScrollRectToVisible(){
+    public void testScrollRectToVisible() {
     }
 
-
-    public void  testSetActionCommand(){
+    public void testSetActionCommand() {
         SimpleActionListener listener = new SimpleActionListener("");
         jtf.addActionListener(listener);
-
         jtf.fireActionPerformed();
         ActionEvent ae = listener.actionEvent;
         assertEquals(jtf.getText(), ae.getActionCommand());
-
-
         jtf.setText("LALALA");
         jtf.fireActionPerformed();
         ActionEvent ae1 = listener.actionEvent;
         assertEquals(jtf.getText(), ae1.getActionCommand());
-
-
         jtf.setActionCommand("JENJA");
         jtf.fireActionPerformed();
         ae = listener.actionEvent;
         assertEquals("JENJA", ae.getActionCommand());
-
         jtf.setActionCommand(null);
         jtf.fireActionPerformed();
         ae = listener.actionEvent;
         assertEquals(jtf.getText(), ae.getActionCommand());
-
         jtf.setActionCommand("");
         jtf.fireActionPerformed();
         ae = listener.actionEvent;
         assertEquals("", ae.getActionCommand());
-
     }
 
-    public void  testSetDocument(){
+    public void testSetDocument() {
         Document old = jtf.getDocument();
         Document doc = new PlainDocument();
         jtf.setDocument(doc);
@@ -591,18 +567,16 @@
         assertEquals(Boolean.TRUE, doc.getProperty("filterNewlines"));
     }
 
-    public void  testSetFont(){
+    public void testSetFont() {
         Font oldFont = jtf.getFont();
         FontMetrics fm = jtf.getFontMetrics(oldFont);
         assertEquals(fm.charWidth('m'), jtf.getColumnWidth());
-
         jtf.wasCallRevalidate = false;
         Font newFont = new java.awt.Font("SimSun", 0, 12);
         jtf.setFont(newFont);
         assertTrue(jtf.wasCallRevalidate);
         fm = jtf.getFontMetrics(newFont);
         assertEquals(fm.charWidth('m'), jtf.getColumnWidth());
-
         //checks PropertyCchanegEvent
         PropertyChangeEvent event = listener.event;
         assertEquals("font", event.getPropertyName());
@@ -610,9 +584,8 @@
         assertEquals(newFont, event.getNewValue());
     }
 
-    public void  testSetGetAction(){
+    public void testSetGetAction() {
         assertNull(jtf.getAction());
-
         Action action = new DefaultEditorKit.CutAction();
         jtf.setAction(action);
         assertEquals(action, jtf.getAction());
@@ -620,19 +593,17 @@
         assertTrue(jtf.wasCreateListeners);
         assertEquals(action, jtf.configureFrom);
         assertEquals(action, jtf.createFrom);
-        assertEquals(1,jtf.getActionListeners().length);
+        assertEquals(1, jtf.getActionListeners().length);
         assertEquals(action, jtf.getActionListeners()[0]);
         jtf.resetTestedFields();
-
         jtf.setAction(null);
         assertNull(jtf.getAction());
         assertTrue(jtf.wasConfigureProperties);
         assertFalse(jtf.wasCreateListeners);
         assertNull(jtf.configureFrom);
         assertNull(jtf.createFrom);
-        assertEquals(0,jtf.getActionListeners().length);
+        assertEquals(0, jtf.getActionListeners().length);
         jtf.resetTestedFields();
-
         jtf.addActionListener(action);
         jtf.setAction(action);
         assertEquals(action, jtf.getAction());
@@ -640,19 +611,19 @@
         assertTrue(jtf.wasCreateListeners);
         assertEquals(action, jtf.configureFrom);
         assertEquals(action, jtf.createFrom);
-        assertEquals(1,jtf.getActionListeners().length);
+        assertEquals(1, jtf.getActionListeners().length);
         assertEquals(action, jtf.getActionListeners()[0]);
     }
 
-    public void  testSetGetColumns(){
-        assertEquals(0,jtf.getColumns());
+    public void testSetGetColumns() {
+        assertEquals(0, jtf.getColumns());
         jtf.wasCallInvalidate = false;
         jtf.setColumns(5);
-        assertEquals(5,jtf.getColumns());
+        assertEquals(5, jtf.getColumns());
         assertTrue(jtf.wasCallInvalidate);
         try {
-           jtf.setColumns(-5);
-        } catch(IllegalArgumentException e){
+            jtf.setColumns(-5);
+        } catch (IllegalArgumentException e) {
             bWasException = true;
             message = e.getMessage();
         }
@@ -660,37 +631,31 @@
         assertEquals("columns less than zero.", message);
     }
 
-    public void  testSetGetHorizontalAlignment(){
-        assertEquals(JTextField.LEADING, jtf.getHorizontalAlignment());
-
-        jtf.setHorizontalAlignment(JTextField.LEFT);
-        assertEquals(JTextField.LEFT, jtf.getHorizontalAlignment());
-        testPropertyChangeEvent("horizontalAlignment", JTextField.LEADING,
-                JTextField.LEFT, listener.event);
-
-        jtf.setHorizontalAlignment(JTextField.CENTER);
-        assertEquals(JTextField.CENTER, jtf.getHorizontalAlignment());
-        testPropertyChangeEvent("horizontalAlignment", JTextField.LEFT,
-                JTextField.CENTER, listener.event);
-
-        jtf.setHorizontalAlignment(JTextField.RIGHT);
-        assertEquals(JTextField.RIGHT, jtf.getHorizontalAlignment());
-        testPropertyChangeEvent("horizontalAlignment", JTextField.CENTER,
-                JTextField.RIGHT, listener.event);
-
-        jtf.setHorizontalAlignment(JTextField.LEADING);
-        assertEquals(JTextField.LEADING, jtf.getHorizontalAlignment());
-        testPropertyChangeEvent("horizontalAlignment", JTextField.RIGHT,
-                JTextField.LEADING, listener.event);
-
-        jtf.setHorizontalAlignment(JTextField.TRAILING);
-        assertEquals(JTextField.TRAILING, jtf.getHorizontalAlignment());
-        testPropertyChangeEvent("horizontalAlignment", JTextField.LEADING,
-                JTextField.TRAILING, listener.event);
-
+    public void testSetGetHorizontalAlignment() {
+        assertEquals(SwingConstants.LEADING, jtf.getHorizontalAlignment());
+        jtf.setHorizontalAlignment(SwingConstants.LEFT);
+        assertEquals(SwingConstants.LEFT, jtf.getHorizontalAlignment());
+        testPropertyChangeEvent("horizontalAlignment", SwingConstants.LEADING,
+                SwingConstants.LEFT, listener.event);
+        jtf.setHorizontalAlignment(SwingConstants.CENTER);
+        assertEquals(SwingConstants.CENTER, jtf.getHorizontalAlignment());
+        testPropertyChangeEvent("horizontalAlignment", SwingConstants.LEFT,
+                SwingConstants.CENTER, listener.event);
+        jtf.setHorizontalAlignment(SwingConstants.RIGHT);
+        assertEquals(SwingConstants.RIGHT, jtf.getHorizontalAlignment());
+        testPropertyChangeEvent("horizontalAlignment", SwingConstants.CENTER,
+                SwingConstants.RIGHT, listener.event);
+        jtf.setHorizontalAlignment(SwingConstants.LEADING);
+        assertEquals(SwingConstants.LEADING, jtf.getHorizontalAlignment());
+        testPropertyChangeEvent("horizontalAlignment", SwingConstants.RIGHT,
+                SwingConstants.LEADING, listener.event);
+        jtf.setHorizontalAlignment(SwingConstants.TRAILING);
+        assertEquals(SwingConstants.TRAILING, jtf.getHorizontalAlignment());
+        testPropertyChangeEvent("horizontalAlignment", SwingConstants.LEADING,
+                SwingConstants.TRAILING, listener.event);
         try {
-           jtf.setHorizontalAlignment(5000);
-        } catch(IllegalArgumentException e){
+            jtf.setHorizontalAlignment(5000);
+        } catch (IllegalArgumentException e) {
             bWasException = true;
             message = e.getMessage();
         }
@@ -698,102 +663,93 @@
         assertEquals("horizontalAlignment", message);
     }
 
-    int getInitialScrollOffest(final JTextField c){
+    int getInitialScrollOffest(final JTextField c) {
         int prefWidth = c.getPreferredSize().width;
         int width = c.getWidth();
         int diff = prefWidth - width;
         return (diff >= 0) ? diff + 1 : 0;
-
     }
 
-    int getScrollOffset(final JTextField c, final int scrollOffset){
+    int getScrollOffset(final JTextField c, final int scrollOffset) {
         int prefWidth = c.getPreferredSize().width;
         int width = c.getWidth();
         int diff = prefWidth - width;
         int maxScrollOffset = (diff >= 0) ? diff + 1 : 0;
-        return Math.min(Math.max(0,scrollOffset), maxScrollOffset);
+        return Math.min(Math.max(0, scrollOffset), maxScrollOffset);
     }
 
-    void brmTest(final BoundedRangeModel model, final int min, final int value, final int extent, final int max){
+    void brmTest(final BoundedRangeModel model, final int min, final int value,
+            final int extent, final int max) {
         assertEquals(min, model.getMinimum());
         assertEquals(value, model.getValue());
         assertEquals(extent, model.getExtent());
         assertEquals(max, model.getMaximum());
     }
-    public void  testSetGetScrollOffset(){
-        assertEquals(getInitialScrollOffest(jtf),jtf.getScrollOffset());
-        //assertEquals(getInitialScrollOffest(jtfScroll),jtfScroll.getScrollOffset());
-        assertEquals(getInitialScrollOffest(jtfBidi),jtfBidi.getScrollOffset());
 
+    public void testSetGetScrollOffset() {
+        assertEquals(getInitialScrollOffest(jtf), jtf.getScrollOffset());
+        //assertEquals(getInitialScrollOffest(jtfScroll),jtfScroll.getScrollOffset());
+        assertEquals(getInitialScrollOffest(jtfBidi), jtfBidi.getScrollOffset());
         BoundedRangeModel brm = jtf.getHorizontalVisibility();
         int brm_min = brm.getMinimum();
         int brm_extent = brm.getExtent();
         int brm_max = brm.getMaximum();
-
         BoundedRangeModel brmScroll = jtfScroll.getHorizontalVisibility();
         int brmScroll_min = brmScroll.getMinimum();
         int brmScroll_extent = brmScroll.getExtent();
         int brmScroll_max = brmScroll.getMaximum();
-
         BoundedRangeModel brmBidi = jtfBidi.getHorizontalVisibility();
         int brmBidi_min = brmBidi.getMinimum();
         int brmBidi_extent = brmBidi.getExtent();
         int brmBidi_max = brmBidi.getMaximum();
-
         if (!isHarmony()) {
             return;
         }
-        for(int i = -3; i < 500; i++){
+        for (int i = -3; i < 500; i++) {
             jtf.setScrollOffset(i);
             assertEquals(getScrollOffset(jtf, i), jtf.getScrollOffset());
             brmTest(brm, brm_min, jtf.getScrollOffset(), brm_extent, brm_max);
-
             jtfScroll.setScrollOffset(i);
-            assertEquals(getScrollOffset(jtfScroll, i),
-                    jtfScroll.getScrollOffset());
-            brmTest(brmScroll, brmScroll_min, jtfScroll.getScrollOffset(),
-                    brmScroll_extent, brmScroll_max);
-
+            assertEquals(getScrollOffset(jtfScroll, i), jtfScroll.getScrollOffset());
+            brmTest(brmScroll, brmScroll_min, jtfScroll.getScrollOffset(), brmScroll_extent,
+                    brmScroll_max);
             jtfBidi.setScrollOffset(i);
-            assertEquals(getScrollOffset(jtfScroll, i),
-                    jtfScroll.getScrollOffset());
-            brmTest(brmBidi, brmBidi_min, jtfBidi.getScrollOffset(),
-                    brmBidi_extent, brmBidi_max);
-
+            assertEquals(getScrollOffset(jtfScroll, i), jtfScroll.getScrollOffset());
+            brmTest(brmBidi, brmBidi_min, jtfBidi.getScrollOffset(), brmBidi_extent,
+                    brmBidi_max);
         }
     }
 
-    public  void testSerialization(){
+    public void testSerialization() {
         /*
-        JTextField jt = new JTextField(bidiContent);
-        jt.setColumns(8);
-        jt.setFont(new java.awt.Font("SimSun", 0, 12));
-        Action action  = new DefaultEditorKit.CopyAction();
-        //jt.setAction(action);
-
-
-        JTextField jt1 = new JTextField();
-        try {
-            FileOutputStream fo = new FileOutputStream("tmp");
-            ObjectOutputStream so = new ObjectOutputStream(fo);
-            so.writeObject(jt);
-            so.flush();
-            so.close();
-            FileInputStream fi = new FileInputStream("tmp");
-            ObjectInputStream si = new ObjectInputStream(fi);
-            jt1 = (JTextField) si.readObject();
-            si.close();
-        } catch (Exception e) {
-            assertTrue("seralization failed" + e.getMessage(),false);
-        }
-        assertEquals(bidiContent, jt1.getText());
-        assertEquals(8,jt1.getColumns());
-        assertEquals(new java.awt.Font("SimSun", 0, 12),jt1.getFont());
-        assertNotSame(jt.getHorizontalVisibility(), jt1.getHorizontalVisibility());
-        assertEquals(jt.getScrollOffset(), jt1.getScrollOffset());
-        assertEquals(jt.getColumnWidth(), jt1.getColumnWidth());
-        assertNotSame(jt.getAccessibleContext(), jt1.getAccessibleContext());
-        */
+         JTextField jt = new JTextField(bidiContent);
+         jt.setColumns(8);
+         jt.setFont(new java.awt.Font("SimSun", 0, 12));
+         Action action  = new DefaultEditorKit.CopyAction();
+         //jt.setAction(action);
+
+
+         JTextField jt1 = new JTextField();
+         try {
+         FileOutputStream fo = new FileOutputStream("tmp");
+         ObjectOutputStream so = new ObjectOutputStream(fo);
+         so.writeObject(jt);
+         so.flush();
+         so.close();
+         FileInputStream fi = new FileInputStream("tmp");
+         ObjectInputStream si = new ObjectInputStream(fi);
+         jt1 = (JTextField) si.readObject();
+         si.close();
+         } catch (Exception e) {
+         assertTrue("seralization failed" + e.getMessage(),false);
+         }
+         assertEquals(bidiContent, jt1.getText());
+         assertEquals(8,jt1.getColumns());
+         assertEquals(new java.awt.Font("SimSun", 0, 12),jt1.getFont());
+         assertNotSame(jt.getHorizontalVisibility(), jt1.getHorizontalVisibility());
+         assertEquals(jt.getScrollOffset(), jt1.getScrollOffset());
+         assertEquals(jt.getColumnWidth(), jt1.getColumnWidth());
+         assertNotSame(jt.getAccessibleContext(), jt1.getAccessibleContext());
+         */
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextField_NotifyActionRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextField_NotifyActionRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextField_NotifyActionRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextField_NotifyActionRTest.java Sat Nov 25 16:04:10 2006
@@ -28,17 +28,19 @@
 import java.awt.event.KeyEvent;
 
 public class JTextField_NotifyActionRTest extends BasicSwingTestCase {
-
     private JFrame frame;
+
     private JPanel c;
+
     private JTextField textField;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
-
         frame = new JFrame();
     }
 
+    @Override
     protected void tearDown() throws Exception {
         if (frame != null) {
             frame.dispose();
@@ -56,7 +58,6 @@
         parent.add(textField);
         frame.pack();
         frame.setVisible(true);
-
         final Rectangle flag = new Rectangle();
         final ActionListener parentListener = new ActionListener() {
             public void actionPerformed(final ActionEvent event) {
@@ -68,25 +69,17 @@
                 flag.y = 100;
             }
         };
-        c.registerKeyboardAction(parentListener,
-                                 KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
-                                 JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
+        c.registerKeyboardAction(parentListener, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
+                JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
         SwingWaitTestCase.requestFocusInWindowForComponent(textField);
-
-        textField.dispatchEvent(new KeyEvent(textField,
-                                             KeyEvent.KEY_PRESSED,
-                                             0, 0,
-                                             KeyEvent.VK_ENTER, (char)13));
+        textField.dispatchEvent(new KeyEvent(textField, KeyEvent.KEY_PRESSED, 0, 0,
+                KeyEvent.VK_ENTER, (char) 13));
         assertEquals("parent's action has been fired", 100, flag.x);
         assertEquals("textFields action hasn't been fired", 0, flag.y);
-
         flag.x = 0;
         textField.addActionListener(textFieldListener);
-        textField.dispatchEvent(new KeyEvent(textField,
-                                             KeyEvent.KEY_PRESSED,
-                                             0, 0,
-                                             KeyEvent.VK_ENTER, (char)13));
+        textField.dispatchEvent(new KeyEvent(textField, KeyEvent.KEY_PRESSED, 0, 0,
+                KeyEvent.VK_ENTER, (char) 13));
         assertEquals("parent's action hasn't been fired", 0, flag.x);
         assertEquals("textFields action has been fired", 100, flag.y);
     }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneRTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneRTest.java Sat Nov 25 16:04:10 2006
@@ -29,79 +29,60 @@
 
 public class JTextPaneRTest extends SwingTestCase {
     private JTextPane textPane;
+
     private MutableAttributeSet attrs;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         textPane = new JTextPane();
-
         // init character attributeSet
         attrs = new SimpleAttributeSet();
-
         StyleConstants.setStrikeThrough(attrs, true);
         StyleConstants.setAlignment(attrs, StyleConstants.ALIGN_CENTER);
         StyleConstants.setUnderline(attrs, true);
         textPane.getDocument().insertString(0, "Hello  !", attrs);
-
         StyleConstants.setUnderline(attrs, false);
         textPane.getDocument().insertString(6, "world", attrs);
-     }
-
+    }
 
     public void testReplaceSelection_AtTheBeginningOfParagraph() {
-          StyledDocument doc = textPane.getStyledDocument();
-
-          try {
-              attrs = new SimpleAttributeSet();
-              StyleConstants.setUnderline(attrs, true);
-              doc.insertString(0, "Hello word!", attrs);
-
-              textPane.setCaretPosition(4);
-              textPane.insertIcon(MetalIconFactory.getTreeFolderIcon());
-
-              textPane.setCaretPosition(4);
-              textPane.replaceSelection("\n");
-
-              textPane.setCaretPosition(5);
-              textPane.replaceSelection("a");
-
-              textPane.setCaretPosition(6);
-              textPane.replaceSelection("b");
-
-              assertNull(StyleConstants.getIcon(
-                  doc.getCharacterElement(5).getAttributes()));
-
-              assertNull(StyleConstants.getIcon(
-                  doc.getCharacterElement(6).getAttributes()));
-
-          } catch (BadLocationException e) {
-          }
+        StyledDocument doc = textPane.getStyledDocument();
+        try {
+            attrs = new SimpleAttributeSet();
+            StyleConstants.setUnderline(attrs, true);
+            doc.insertString(0, "Hello word!", attrs);
+            textPane.setCaretPosition(4);
+            textPane.insertIcon(MetalIconFactory.getTreeFolderIcon());
+            textPane.setCaretPosition(4);
+            textPane.replaceSelection("\n");
+            textPane.setCaretPosition(5);
+            textPane.replaceSelection("a");
+            textPane.setCaretPosition(6);
+            textPane.replaceSelection("b");
+            assertNull(StyleConstants.getIcon(doc.getCharacterElement(5).getAttributes()));
+            assertNull(StyleConstants.getIcon(doc.getCharacterElement(6).getAttributes()));
+        } catch (BadLocationException e) {
+        }
     }
 
     public void testReplaceSelection_WithSelection() {
         textPane.setCaretPosition(4);
         textPane.insertIcon(MetalIconFactory.getTreeFolderIcon());
-
         textPane.select(4, 6);
         textPane.replaceSelection("TEXT");
-        assertNull(StyleConstants.getIcon(textPane.getStyledDocument()
-                                          .getCharacterElement(4)
-                                          .getAttributes()));
-
+        assertNull(StyleConstants.getIcon(textPane.getStyledDocument().getCharacterElement(4)
+                .getAttributes()));
     }
 
     public void testReplaceSelection_WithNoSelection() {
-        assertTrue(StyleConstants.isUnderline(textPane.getStyledDocument()
-                                              .getCharacterElement(5)
-                                              .getAttributes()));
+        assertTrue(StyleConstants.isUnderline(textPane.getStyledDocument().getCharacterElement(
+                5).getAttributes()));
         assertFalse(StyleConstants.isUnderline(textPane.getStyledDocument()
-                .getCharacterElement(6)
-                .getAttributes()));
-
+                .getCharacterElement(6).getAttributes()));
         textPane.select(6, 6);
         textPane.replaceSelection("TEXT");
-        assertTrue(StyleConstants.isUnderline(textPane.getStyledDocument()
-                .getCharacterElement(6)
-                .getAttributes()));
+        assertTrue(StyleConstants.isUnderline(textPane.getStyledDocument().getCharacterElement(
+                6).getAttributes()));
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JTextPaneTest.java Sat Nov 25 16:04:10 2006
@@ -23,7 +23,6 @@
 import java.awt.Component;
 import java.awt.Graphics;
 import java.util.Enumeration;
-
 import javax.swing.JEditorPane.PlainEditorKit;
 import javax.swing.plaf.metal.MetalIconFactory;
 import javax.swing.text.AttributeSet;
@@ -41,28 +40,25 @@
 import javax.swing.text.StyledEditorKit;
 
 //TODO: add multhithreaded tests for all thread-safe
-
 public class JTextPaneTest extends SwingTestCase {
     private JTextPane textPane;
+
     private MutableAttributeSet attrs;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         textPane = new JTextPane();
-
         // init character attributeSet
         attrs = new SimpleAttributeSet();
-
         StyleConstants.setStrikeThrough(attrs, true);
         StyleConstants.setAlignment(attrs, StyleConstants.ALIGN_CENTER);
         StyleConstants.setUnderline(attrs, true);
         textPane.getDocument().insertString(0, "Hello  !", attrs);
-
         StyleConstants.setUnderline(attrs, false);
         textPane.getDocument().insertString(6, "world", attrs);
-        textPane.getDocument().insertString(12, "\n World is beautifull!",
-                                                attrs);
-     }
+        textPane.getDocument().insertString(12, "\n World is beautifull!", attrs);
+    }
 
     public void testJTextPane() {
         assertNotNull(textPane.getDocument());
@@ -78,14 +74,14 @@
         StyledDocument doc = new DefaultStyledDocument();
         textPane.setDocument(doc);
         assertSame(doc, textPane.getDocument());
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setDocument(new PlainDocument());
             }
         });
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setDocument(null);
             }
@@ -96,38 +92,35 @@
         StyledDocument doc = new DefaultStyledDocument();
         textPane.setDocument(doc);
         assertSame(doc, textPane.getDocument());
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setDocument(new PlainDocument());
             }
         });
-
     }
 
     public void testGetStyledEditorKit() {
         assertSame(textPane.getEditorKit(), textPane.getStyledEditorKit());
-        assertSame(textPane.getStyledEditorKit(),
-                   textPane.getStyledEditorKit());
+        assertSame(textPane.getStyledEditorKit(), textPane.getStyledEditorKit());
     }
 
     public void testCreateDefaultEditorKit() {
-            EditorKit editorKit1 = textPane.createDefaultEditorKit();
-            EditorKit editorKit2 = textPane.createDefaultEditorKit();
-
-            assertNotSame(editorKit1, editorKit2);
-            assertEquals("javax.swing.text.StyledEditorKit",
-                         editorKit1.getClass().getName());
-        }
+        EditorKit editorKit1 = textPane.createDefaultEditorKit();
+        EditorKit editorKit2 = textPane.createDefaultEditorKit();
+        assertNotSame(editorKit1, editorKit2);
+        assertEquals("javax.swing.text.StyledEditorKit", editorKit1.getClass().getName());
+    }
 
     public void testSetEditorKit() {
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setEditorKit(new PlainEditorKit());
             }
         });
-
         testExceptionalCase(new IllegalArgumentCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setEditorKit(null);
             }
@@ -136,77 +129,54 @@
 
     public void testGetStyle() {
         Style style;
-
         style = textPane.getStyle(StyleContext.DEFAULT_STYLE);
         assertEquals(StyleContext.DEFAULT_STYLE, style.getName());
-        assertSame(textPane.getStyledDocument().getStyle(StyleContext.DEFAULT_STYLE),
-                   textPane.getStyle(StyleContext.DEFAULT_STYLE));
-
+        assertSame(textPane.getStyledDocument().getStyle(StyleContext.DEFAULT_STYLE), textPane
+                .getStyle(StyleContext.DEFAULT_STYLE));
         textPane.addStyle("child", style);
         style = textPane.getStyle("child");
         assertEquals("child", style.getName());
-        assertEquals(StyleContext.DEFAULT_STYLE,
-                     ((Style)style.getResolveParent()).getName());
-        assertSame(textPane.getStyledDocument().getStyle("child"),
-                   textPane.getStyle("child"));
+        assertEquals(StyleContext.DEFAULT_STYLE, ((Style) style.getResolveParent()).getName());
+        assertSame(textPane.getStyledDocument().getStyle("child"), textPane.getStyle("child"));
     }
 
     public void testAddStyle() {
-
         Style parent = textPane.addStyle("parent", null);
-        Style child  = textPane.addStyle("child", parent);
-
+        Style child = textPane.addStyle("child", parent);
         assertEquals(1, parent.getAttributeCount());
         assertNull(parent.getResolveParent());
         assertEquals(2, child.getAttributeCount());
         assertNotNull(child.getResolveParent());
-
         parent.addAttribute(StyleConstants.Bold, Boolean.FALSE);
         child.addAttribute(StyleConstants.Bold, Boolean.TRUE);
-        assertFalse(((Boolean)parent.getAttribute(StyleConstants.Bold))
-                   .booleanValue());
-        assertTrue(((Boolean)child.getAttribute(StyleConstants.Bold))
-               .booleanValue());
-
+        assertFalse(((Boolean) parent.getAttribute(StyleConstants.Bold)).booleanValue());
+        assertTrue(((Boolean) child.getAttribute(StyleConstants.Bold)).booleanValue());
         // Add styles with diff parameters
-
         Style parent1 = textPane.addStyle("p1", null);
         Style parent2 = textPane.addStyle("p2", null);
-        Object[] styles = {null,  null,
-                           "one", null,
-                           null,  parent1,
-                           "two", parent2
-        };
-
+        Object[] styles = { null, null, "one", null, null, parent1, "two", parent2 };
         for (int i = 0; i < styles.length; i += 2) {
-            Style style = textPane.addStyle((String)styles[i],
-                                            (Style)styles[i + 1]);
-            assertEquals("Iteration: " + i, (String)styles[i], style.getName());
-            assertSame("Iteration: " + i, styles[i + 1],
-                       style.getResolveParent());
+            Style style = textPane.addStyle((String) styles[i], (Style) styles[i + 1]);
+            assertEquals("Iteration: " + i, (String) styles[i], style.getName());
+            assertSame("Iteration: " + i, styles[i + 1], style.getResolveParent());
         }
-
         // unnamed style
-        Style anotherChild  = textPane.addStyle(null, parent);
+        Style anotherChild = textPane.addStyle(null, parent);
         assertEquals(1, anotherChild.getAttributeCount());
         assertNotNull(anotherChild.getResolveParent());
-
         //not unique name of the style
         Style anotherStyle;
-
         anotherStyle = textPane.addStyle("child", null);
         assertNotSame(child, anotherStyle);
         assertNotNull(anotherStyle);
-
-        anotherStyle  = textPane.addStyle("child", parent);
+        anotherStyle = textPane.addStyle("child", parent);
         assertNotSame(child, anotherStyle);
         assertNotNull(anotherStyle);
     }
 
     public void testRemoveStyle() {
         Style parent = textPane.addStyle("parent", null);
-        Style child  = textPane.addStyle("child", parent);
-
+        Style child = textPane.addStyle("child", parent);
         textPane.removeStyle("parent");
         assertNull(textPane.getStyle("parent"));
         assertEquals(2, child.getAttributeCount());
@@ -216,20 +186,14 @@
 
     public void testGetLogicalStyle() throws BadLocationException {
         textPane.getStyledDocument().insertString(11, "bold", attrs);
-
-        Style style = textPane.addStyle("bold",
-                                        textPane.getStyle(StyleContext.DEFAULT_STYLE));
-
+        Style style = textPane.addStyle("bold", textPane.getStyle(StyleContext.DEFAULT_STYLE));
         textPane.setCaretPosition(1);
         style.addAttribute(StyleConstants.Bold, Boolean.TRUE);
-
         textPane.setLogicalStyle(style);
         style = textPane.getLogicalStyle();
         textPane.setCaretPosition(3);
         assertSame(style, textPane.getLogicalStyle());
-        assertTrue(((Boolean)style.getAttribute(StyleConstants.Bold))
-                    .booleanValue());
-
+        assertTrue(((Boolean) style.getAttribute(StyleConstants.Bold)).booleanValue());
         attrs = new SimpleAttributeSet();
         StyleConstants.setBold(attrs, true);
         textPane.setParagraphAttributes(attrs, true);
@@ -237,66 +201,50 @@
     }
 
     public void testSetLogicalStyle() throws BadLocationException {
-
         // Set text
         attrs = textPane.getInputAttributes();
         attrs.removeAttributes(attrs.getAttributeNames());
         textPane.setText("");
-
         StyleConstants.setBold(attrs, true);
         textPane.getStyledDocument().insertString(0, "bold", attrs);
-
         StyleConstants.setBold(attrs, false);
         StyleConstants.setItalic(attrs, true);
         textPane.getStyledDocument().insertString(4, "italic\n", attrs);
-
         StyleConstants.setItalic(attrs, false);
         StyleConstants.setBold(attrs, true);
-
         // Add style
-        Style style = textPane.addStyle("bold",
-                                        textPane.getStyle(StyleContext.DEFAULT_STYLE));
-
+        Style style = textPane.addStyle("bold", textPane.getStyle(StyleContext.DEFAULT_STYLE));
         // Set style
         textPane.setCaretPosition(1);
         style.addAttribute(StyleConstants.Bold, Boolean.TRUE);
         assertFalse(StyleConstants.isBold(textPane.getParagraphAttributes()));
-
         textPane.setLogicalStyle(style);
         style = textPane.getLogicalStyle();
         textPane.setCaretPosition(3);
         assertSame(style, textPane.getLogicalStyle());
-        assertTrue(((Boolean)style.getAttribute(StyleConstants.Bold))
-                    .booleanValue());
+        assertTrue(((Boolean) style.getAttribute(StyleConstants.Bold)).booleanValue());
         assertTrue(StyleConstants.isBold(textPane.getParagraphAttributes()));
         assertTrue(StyleConstants.isBold(getCharacterAttributes(1)));
-
         // Set paragraph attributes
         attrs = new SimpleAttributeSet();
         StyleConstants.setBold(attrs, true);
         textPane.setParagraphAttributes(attrs, true);
         assertNull(textPane.getLogicalStyle());
-
         // Set another style
         textPane.getStyledDocument().setCharacterAttributes(1, 1, attrs, true);
-        assertFalse(StyleConstants.isUnderline(textPane
-                                               .getParagraphAttributes()));
+        assertFalse(StyleConstants.isUnderline(textPane.getParagraphAttributes()));
         assertFalse(StyleConstants.isUnderline(getCharacterAttributes(1)));
-
-        style = textPane.addStyle("underline",
-                                  textPane.getStyle(StyleContext.DEFAULT_STYLE));
+        style = textPane.addStyle("underline", textPane.getStyle(StyleContext.DEFAULT_STYLE));
         style.addAttribute(StyleConstants.Underline, Boolean.TRUE);
         textPane.setLogicalStyle(style);
         assertNotNull(textPane.getLogicalStyle());
-        assertEquals("underline", textPane.getLogicalStyle()
-                                  .getAttribute(StyleConstants.NameAttribute));
-        assertTrue(StyleConstants.isUnderline(textPane
-                                  .getParagraphAttributes()));
+        assertEquals("underline", textPane.getLogicalStyle().getAttribute(
+                StyleConstants.NameAttribute));
+        assertTrue(StyleConstants.isUnderline(textPane.getParagraphAttributes()));
         assertTrue(StyleConstants.isUnderline(getCharacterAttributes(1)));
     }
 
     public void testGetParagraphAttributes() {
-
         // init paragraph attributeSet
         textPane.setCaretPosition(1);
         Element paragraph = textPane.getStyledDocument().getParagraphElement(
@@ -304,79 +252,62 @@
         attrs = new SimpleAttributeSet();
         StyleConstants.setStrikeThrough(attrs, true);
         StyleConstants.setAlignment(attrs, StyleConstants.ALIGN_CENTER);
-
-        textPane.getStyledDocument().setParagraphAttributes(
-                paragraph.getStartOffset(),
-                paragraph.getEndOffset() - paragraph.getStartOffset()
-                , attrs, true);
-
+        textPane.getStyledDocument().setParagraphAttributes(paragraph.getStartOffset(),
+                paragraph.getEndOffset() - paragraph.getStartOffset(), attrs, true);
         // tests
         AttributeSet textAttrs;
-
         textPane.setCaretPosition(1);
         textAttrs = textPane.getParagraphAttributes();
         assertFalse(StyleConstants.isUnderline(textAttrs));
         assertTrue(StyleConstants.isStrikeThrough(textAttrs));
-        assertEquals(StyleConstants.ALIGN_CENTER,
-                     StyleConstants.getAlignment(textAttrs));
-
+        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
         textPane.setCaretPosition(8);
         textAttrs = textPane.getParagraphAttributes();
         assertFalse(StyleConstants.isUnderline(textAttrs));
         assertTrue(StyleConstants.isStrikeThrough(textAttrs));
-        assertEquals(StyleConstants.ALIGN_CENTER,
-                     StyleConstants.getAlignment(textAttrs));
+        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
     }
 
     public void testSetParagraphAttributes() {
         StyledDocument doc = textPane.getStyledDocument();
         AttributeSet textAttrs;
-
         // The attributes are applied to the paragraph at the current caret
         // position.
         textPane.setCaretPosition(1);
-
         StyleConstants.setSubscript(attrs, false);
         doc.setParagraphAttributes(0, doc.getLength(), attrs, false);
-        textAttrs =  textPane.getParagraphAttributes();
+        textAttrs = textPane.getParagraphAttributes();
         assertFalse(StyleConstants.isSubscript(textAttrs));
-
         StyleConstants.setSubscript(attrs, true);
         textPane.setParagraphAttributes(attrs, true);
-        textAttrs =  textPane.getParagraphAttributes();
+        textAttrs = textPane.getParagraphAttributes();
         assertTrue(StyleConstants.isSubscript(textAttrs));
-
         // The attributes are applied to the to the paragraphs that intersect
         // the selection
-
         textPane.select(1, 2);
         clearAndSetParagraphSubscript(doc);
         textAttrs = getParagraphAttributes(1);
         assertTrue(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertFalse(StyleConstants.isSubscript(textAttrs));
-
         textPane.select(1, 13);
         clearAndSetParagraphSubscript(doc);
         textAttrs = getParagraphAttributes(1);
         assertTrue(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertFalse(StyleConstants.isSubscript(textAttrs));
-
         textPane.select(1, 14);
         clearAndSetParagraphSubscript(doc);
         textAttrs = getParagraphAttributes(1);
         assertTrue(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertTrue(StyleConstants.isSubscript(textAttrs));
-
         textPane.select(18, 19);
         clearAndSetParagraphSubscript(doc);
         textAttrs = getParagraphAttributes(1);
         assertFalse(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertTrue(StyleConstants.isSubscript(textAttrs));
-
         textPane.select(13, 19);
         textPane.getUI().getRootView(textPane).getView(0);
         clearAndSetParagraphSubscript(doc);
@@ -384,31 +315,27 @@
         assertFalse(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertTrue(StyleConstants.isSubscript(textAttrs));
-
         textPane.select(12, 19);
         clearAndSetParagraphSubscript(doc);
         textAttrs = getParagraphAttributes(1);
         assertTrue(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertTrue(StyleConstants.isSubscript(textAttrs));
-
         textPane.select(1, 18);
         clearAndSetParagraphSubscript(doc);
         textAttrs = getParagraphAttributes(1);
         assertTrue(StyleConstants.isSubscript(textAttrs));
         textAttrs = getParagraphAttributes(18);
         assertTrue(StyleConstants.isSubscript(textAttrs));
-
-
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setParagraphAttributes(null, true);
             }
         });
-
         textPane.select(1, 1);
-
         testExceptionalCase(new NullPointerCase() {
+            @Override
             public void exceptionalAction() throws Exception {
                 textPane.setParagraphAttributes(null, true);
             }
@@ -416,40 +343,30 @@
     }
 
     public void testGetCharacterAttributes() {
-
         AttributeSet textAttrs;
-
         textPane.setCaretPosition(1);
         textAttrs = textPane.getCharacterAttributes();
         assertTrue(StyleConstants.isUnderline(textAttrs));
-        assertEquals(StyleConstants.ALIGN_CENTER,
-                     StyleConstants.getAlignment(textAttrs));
+        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
         assertTrue(StyleConstants.isStrikeThrough(textAttrs));
-
         textPane.setCaretPosition(8);
         textAttrs = textPane.getCharacterAttributes();
         assertFalse(StyleConstants.isUnderline(textAttrs));
-        assertEquals(StyleConstants.ALIGN_CENTER,
-                     StyleConstants.getAlignment(textAttrs));
+        assertEquals(StyleConstants.ALIGN_CENTER, StyleConstants.getAlignment(textAttrs));
         assertTrue(StyleConstants.isStrikeThrough(textAttrs));
     }
 
     public void testSetCharacterAttributes() {
         StyledDocument doc = textPane.getStyledDocument();
-
         // The attributes are applied to the paragraph at the current caret
         // position.
-
         textPane.setCaretPosition(1);
         StyleConstants.setSubscript(textPane.getInputAttributes(), false);
-        assertFalse(StyleConstants.isSubscript(textPane
-                                               .getCharacterAttributes()));
+        assertFalse(StyleConstants.isSubscript(textPane.getCharacterAttributes()));
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
         clearAndSetCharacterSubscript(doc);
-        assertFalse(StyleConstants.isSubscript(textPane
-                                               .getCharacterAttributes()));
+        assertFalse(StyleConstants.isSubscript(textPane.getCharacterAttributes()));
         assertTrue(StyleConstants.isSubscript(textPane.getInputAttributes()));
-
         textPane.select(2, 1);
         StyleConstants.setSubscript(textPane.getInputAttributes(), false);
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
@@ -459,10 +376,8 @@
         assertTrue(StyleConstants.isSubscript(textPane.getInputAttributes()));
         assertFalse(StyleConstants.isSubscript(getCharacterAttributes(1)));
         assertFalse(StyleConstants.isSubscript(getCharacterAttributes(18)));
-
         // The attributes are applied to the to the paragraphs that intersect
         // the selection
-
         textPane.select(1, 2);
         StyleConstants.setSubscript(textPane.getInputAttributes(), false);
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
@@ -472,7 +387,6 @@
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
         assertTrue(StyleConstants.isSubscript(getCharacterAttributes(1)));
         assertFalse(StyleConstants.isSubscript(getCharacterAttributes(18)));
-
         textPane.select(2, 13);
         StyleConstants.setSubscript(textPane.getInputAttributes(), false);
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
@@ -482,7 +396,6 @@
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
         assertTrue(StyleConstants.isSubscript(getCharacterAttributes(2)));
         assertFalse(StyleConstants.isSubscript(getCharacterAttributes(18)));
-
         textPane.select(13, 19);
         StyleConstants.setSubscript(textPane.getInputAttributes(), false);
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
@@ -492,7 +405,6 @@
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
         assertFalse(StyleConstants.isSubscript(getCharacterAttributes(1)));
         assertTrue(StyleConstants.isSubscript(getCharacterAttributes(18)));
-
         textPane.select(1, 18);
         StyleConstants.setSubscript(textPane.getInputAttributes(), false);
         assertFalse(StyleConstants.isSubscript(textPane.getInputAttributes()));
@@ -506,21 +418,16 @@
     }
 
     public void testGetInputAttributes() {
-
-        MutableAttributeSet inpAttr = ((StyledEditorKit)textPane
-                .getEditorKit()).getInputAttributes();
-
+        MutableAttributeSet inpAttr = ((StyledEditorKit) textPane.getEditorKit())
+                .getInputAttributes();
         assertSame(textPane.getInputAttributes(), inpAttr);
     }
 
     public void testInsertComponent() {
         AttributeSet attributes;
-
         textPane.setCaretPosition(1);
-
         attrs = textPane.getInputAttributes();
         assertAttrubutes(attrs, false, false, true, false, false, true);
-
         textPane.insertComponent(new JButton("Format C:\\>"));
         if (isHarmony()) {
             assertAttrubutes(attrs, false, false, true, false, false, true);
@@ -528,29 +435,21 @@
             assertAttrubutes(attrs, false, false, false, false, false, false);
         }
         assertNull(StyleConstants.getComponent(attrs));
-        attributes = textPane.getStyledDocument().getCharacterElement(1)
-                .getAttributes();
+        attributes = textPane.getStyledDocument().getCharacterElement(1).getAttributes();
         assertAttrubutes(attributes, false, false, false, false, false, false);
         assertNotNull(StyleConstants.getComponent(attributes));
-
         attrs = new SimpleAttributeSet(attributes);
         StyleConstants.setUnderline(attrs, true);
         textPane.getStyledDocument().setCharacterAttributes(1, 1, attrs, true);
         textPane.setCaretPosition(1);
-        assertAttrubutes(textPane.getInputAttributes(),
-                         false, false, true, false, false, true);
-
+        assertAttrubutes(textPane.getInputAttributes(), false, false, true, false, false, true);
         textPane.select(2, 2);
-        assertAttrubutes(textPane.getInputAttributes(),
-                         false, false, false, false, false, true);
+        assertAttrubutes(textPane.getInputAttributes(), false, false, false, false, false, true);
         textPane.replaceSelection("*");
-
         attrs = textPane.getInputAttributes();
         assertAttrubutes(attrs, false, false, false, false, false, true);
         assertNull(StyleConstants.getComponent(attrs));
-
-        attributes = textPane.getStyledDocument().getCharacterElement(2)
-                .getAttributes();
+        attributes = textPane.getStyledDocument().getCharacterElement(2).getAttributes();
         assertAttrubutes(attributes, false, false, false, false, false, true);
         assertNull(StyleConstants.getComponent(attributes));
     }
@@ -560,9 +459,7 @@
         textPane.setCaretPosition(3);
         attrs = textPane.getInputAttributes();
         assertAttrubutes(attrs, false, false, true, false, false, true);
-
         textPane.insertIcon(new Icon() {
-
             public void paintIcon(Component c, Graphics g, int x, int y) {
                 g.drawRect(x, y, getIconWidth(), getIconHeight());
             }
@@ -574,18 +471,14 @@
             public int getIconHeight() {
                 return 40;
             }
-
         });
         if (isHarmony()) {
             assertAttrubutes(attrs, false, false, true, false, false, true);
         } else {
-             assertAttrubutes(attrs, false, false, false, false, false, false);
+            assertAttrubutes(attrs, false, false, false, false, false, false);
         }
-
-        Element iconElement = textPane.getStyledDocument()
-                              .getDefaultRootElement().getElement(0)
-                              .getElement(1);
-
+        Element iconElement = textPane.getStyledDocument().getDefaultRootElement()
+                .getElement(0).getElement(1);
         AttributeSet attributes = iconElement.getAttributes();
         assertNotNull(attributes.getAttribute(StyleConstants.IconAttribute));
         assertAttrubutes(attributes, false, false, false, false, false, false);
@@ -593,103 +486,71 @@
 
     public void testReplaceSelection() throws BadLocationException {
         AttributeSet textAttrs;
-
         // There is replacement and selection
         textPane.select(6, 22);
-
         textAttrs = getCharacterAttributes(6);
-
         assertTrue(StyleConstants.isUnderline(getCharacterAttributes(5)));
         assertFalse(StyleConstants.isUnderline(getCharacterAttributes(6)));
-
         textPane.replaceSelection("_BUGGGGS_are_");
         assertFalse(StyleConstants.isUnderline(getCharacterAttributes(6)));
-
         compareAttributes(textAttrs, 6, 18);
         assertEquals("Hello _BUGGGGS_are_ beautifull!!", textPane.getText());
-
         // There is replacement and no selection
         textPane.setCaretPosition(1);
         textPane.select(6, 6);
         textPane.replaceSelection("_BUGGGGS!_The");
-        assertEquals("Hello _BUGGGGS!_The_BUGGGGS_are_ beautifull!!",
-                     textPane.getText());
-
+        assertEquals("Hello _BUGGGGS!_The_BUGGGGS_are_ beautifull!!", textPane.getText());
         textPane.setCaretPosition(3);
         textPane.setCaretPosition(6);
         textPane.replaceSelection("q");
-        assertEquals(textPane.getStyledDocument().getCharacterElement(6)
-                     .getAttributes(),
-                     textPane.getStyledDocument().getCharacterElement(7)
-                     .getAttributes());
-
+        assertEquals(textPane.getStyledDocument().getCharacterElement(6).getAttributes(),
+                textPane.getStyledDocument().getCharacterElement(7).getAttributes());
         textPane.select(2, 3);
         textPane.replaceSelection("");
         // There is selection and no replacement
         textPane.select(0, 6);
         textPane.replaceSelection("");
-        assertEquals("_BUGGGGS!_The_BUGGGGS_are_ beautifull!!",
-                 textPane.getText());
-
+        assertEquals("_BUGGGGS!_The_BUGGGGS_are_ beautifull!!", textPane.getText());
         textPane.select(1, 27);
         textPane.replaceSelection("");
         assertEquals("_beautifull!!", textPane.getText());
-
         // There is no selection and no replacement
         textPane.select(1, 1);
         textPane.replaceSelection("");
-
         //Document is not editable
         textPane.setEditable(false);
-
         textPane.select(1, 1);
         textPane.replaceSelection("Hello");
         assertEquals("_beautifull!!", textPane.getText());
-
         textPane.select(2, 4);
         textPane.replaceSelection("Hello");
         assertEquals("_beautifull!!", textPane.getText());
-
         textPane = new JTextPane();
         textPane.replaceSelection("1");
-        assertEquals(textPane.getStyledDocument().getCharacterElement(0)
-                .getAttributes(),
-                textPane.getStyledDocument().getCharacterElement(1)
-                .getAttributes());
-
+        assertEquals(textPane.getStyledDocument().getCharacterElement(0).getAttributes(),
+                textPane.getStyledDocument().getCharacterElement(1).getAttributes());
         textPane.select(0, 1);
         textPane.replaceSelection("");
-
         attrs = new SimpleAttributeSet();
         StyleConstants.setUnderline(attrs, true);
         textPane.getStyledDocument().insertString(0, "Hello!", attrs);
-
         textPane.select(0, 0);
         textPane.replaceSelection("1");
-        assertEquals(textPane.getStyledDocument().getCharacterElement(0)
-                .getAttributes(),
-                textPane.getStyledDocument().getCharacterElement(1)
-                .getAttributes());
+        assertEquals(textPane.getStyledDocument().getCharacterElement(0).getAttributes(),
+                textPane.getStyledDocument().getCharacterElement(1).getAttributes());
         textPane.select(0, 1);
         textPane.replaceSelection("2");
-        assertEquals(textPane.getStyledDocument().getCharacterElement(0)
-                .getAttributes(),
-                textPane.getStyledDocument().getCharacterElement(1)
-                .getAttributes());
-
+        assertEquals(textPane.getStyledDocument().getCharacterElement(0).getAttributes(),
+                textPane.getStyledDocument().getCharacterElement(1).getAttributes());
         textPane.setCaretPosition(1);
         textPane.insertIcon(MetalIconFactory.getFileChooserNewFolderIcon());
         textPane.select(2, 2);
         textPane.replaceSelection("3");
-
-        attrs = new SimpleAttributeSet(textPane.getStyledDocument()
-                                       .getCharacterElement(1)
-                                       .getAttributes());
+        attrs = new SimpleAttributeSet(textPane.getStyledDocument().getCharacterElement(1)
+                .getAttributes());
         assertAttrubutes(attrs, false, false, false, false, false, false);
         assertNotNull(StyleConstants.getIcon(attrs));
-
-        attrs = new SimpleAttributeSet(textPane.getStyledDocument()
-                .getCharacterElement(2)
+        attrs = new SimpleAttributeSet(textPane.getStyledDocument().getCharacterElement(2)
                 .getAttributes());
         assertAttrubutes(attrs, false, false, false, false, false, false);
         assertNull(StyleConstants.getIcon(attrs));
@@ -701,12 +562,11 @@
     }
 
     private AttributeSet getParagraphAttributes(final int position) {
-        return textPane.getStyledDocument().getParagraphElement(position)
-               .getAttributes();
+        return textPane.getStyledDocument().getParagraphElement(position).getAttributes();
     }
+
     private AttributeSet getCharacterAttributes(final int position) {
-        return textPane.getStyledDocument().getCharacterElement(position)
-               .getAttributes();
+        return textPane.getStyledDocument().getCharacterElement(position).getAttributes();
     }
 
     private void clearAndSetParagraphSubscript(final StyledDocument doc) {
@@ -723,41 +583,31 @@
         textPane.setCharacterAttributes(attrs, true);
     }
 
-    private void compareAttributes(final AttributeSet textAttrs,
-                                   final int startOffset, final int endOffset) {
-
+    private void compareAttributes(final AttributeSet textAttrs, final int startOffset,
+            final int endOffset) {
         for (int i = startOffset; i < endOffset + 1; i++) {
             compareAttributeSets(textAttrs, getCharacterAttributes(i));
         }
     }
 
     private void compareAttributeSets(final AttributeSet expectedTextAttrs,
-                                      final AttributeSet textAttrs) {
-        assertEquals(expectedTextAttrs.getAttributeCount(),
-                     textAttrs.getAttributeCount());
-        for (Enumeration expectedNames = expectedTextAttrs.getAttributeNames();
-             expectedNames.hasMoreElements();) {
-
+            final AttributeSet textAttrs) {
+        assertEquals(expectedTextAttrs.getAttributeCount(), textAttrs.getAttributeCount());
+        for (Enumeration<?> expectedNames = expectedTextAttrs.getAttributeNames(); expectedNames
+                .hasMoreElements();) {
             Object expectedName = expectedNames.nextElement();
-            assertEquals(expectedTextAttrs.getAttribute(expectedName),
-                         textAttrs.getAttribute(expectedName));
+            assertEquals(expectedTextAttrs.getAttribute(expectedName), textAttrs
+                    .getAttribute(expectedName));
         }
-        for (Enumeration names = textAttrs.getAttributeNames();
-         names.hasMoreElements();) {
-
+        for (Enumeration<?> names = textAttrs.getAttributeNames(); names.hasMoreElements();) {
             Object name = names.nextElement();
-            assertEquals(textAttrs.getAttribute(name),
-                         expectedTextAttrs.getAttribute(name));
-            }
+            assertEquals(textAttrs.getAttribute(name), expectedTextAttrs.getAttribute(name));
+        }
     }
 
-    private void assertAttrubutes(final AttributeSet attrs,
-                                  final boolean isBold,
-                                  final boolean isItalic,
-                                  final boolean isStrikeThrough,
-                                  final boolean isSubscript,
-                                  final boolean isSuperScript,
-                                  final boolean isUnderline) {
+    private void assertAttrubutes(final AttributeSet attrs, final boolean isBold,
+            final boolean isItalic, final boolean isStrikeThrough, final boolean isSubscript,
+            final boolean isSuperScript, final boolean isUnderline) {
         assertEquals(isBold, StyleConstants.isBold(attrs));
         assertEquals(isItalic, StyleConstants.isItalic(attrs));
         assertEquals(isStrikeThrough, StyleConstants.isStrikeThrough(attrs));

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JToggleButtonModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JToggleButtonModelTest.java?view=diff&rev=479240&r1=479239&r2=479240
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JToggleButtonModelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/JToggleButtonModelTest.java Sat Nov 25 16:04:10 2006
@@ -22,9 +22,8 @@
  */
 package javax.swing;
 
-
 public class JToggleButtonModelTest extends DefaultButtonModelTest {
-
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         buttonModel = new JToggleButton.ToggleButtonModel();
@@ -33,26 +32,24 @@
     /*
      * @see DefaultButtonModelTest#tearDown()
      */
+    @Override
     protected void tearDown() throws Exception {
         buttonModel = null;
         super.tearDown();
     }
 
+    @Override
     public void testSetPressed() {
         super.testSetPressed();
-
         AbstractButton button = new JToggleButton();
         ButtonModel model = button.getModel();
         model.setPressed(true);
         model.setArmed(true);
         model.setPressed(false);
-
         assertTrue("selected", button.isSelected());
-
         model.setPressed(true);
         model.setArmed(true);
         model.setPressed(false);
-
         assertFalse("selected", button.isSelected());
         model.setSelected(true);
         assertTrue("selected", button.isSelected());
@@ -66,5 +63,4 @@
         assertTrue("enabled ", model.isEnabled());
         assertFalse("rollover ", model.isRollover());
     }
-
 }



Mime
View raw message