harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r480833 - in /harmony/enhanced/classlib/trunk/modules/swing: make/ src/main/java/common/org/apache/harmony/x/swing/ src/test/api/java/common/javax/swing/text/ src/test/api/java/common/org/apache/harmony/x/swing/
Date Thu, 30 Nov 2006 04:44:31 GMT
Author: ndbeyer
Date: Wed Nov 29 20:44:29 2006
New Revision: 480833

URL: http://svn.apache.org/viewvc?view=rev&rev=480833
Log:
Apply modified patch for HARMONY-2253: [classlib][swing] unit test fails: j.s.text.ParagraphViewTest

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/org/apache/harmony/x/swing/UtilitiesTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.drl Wed Nov 29 20:44:29
2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86.ibm Wed Nov 29 20:44:29
2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.drl Wed Nov 29
20:44:29 2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.linux.x86_64.ibm Wed Nov 29
20:44:29 2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.drl Wed Nov 29
20:44:29 2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86.ibm Wed Nov 29
20:44:29 2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.drl Wed Nov
29 20:44:29 2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/make/exclude.windows.x86_64.ibm Wed Nov
29 20:44:29 2006
@@ -23,7 +23,6 @@
 javax/swing/text/GapContentTest.java
 javax/swing/text/GapContent_InternalTest.java
 javax/swing/text/InternationalFormatterTest.java
-javax/swing/text/ParagraphViewTest.java
 javax/swing/text/PlainViewI18N_LayoutTest.java
 javax/swing/text/PlainViewI18N_LineView_UpdateTest.java
 javax/swing/text/StringContentTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/Utilities.java
Wed Nov 29 20:44:29 2006
@@ -693,8 +693,8 @@
     public static Point getMousePointerScreenLocation() {
         Point p = null;
         try {
-            p = (Point)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            p = AccessController.doPrivileged(new PrivilegedAction<Point>() {
+                public Point run() {
                     return MouseInfo.getPointerInfo().getLocation();
                 }
             });
@@ -818,14 +818,14 @@
      */
     public static MenuElement[] getSubElements(final Container menu) {
         final Component[] components = menu.getComponents();
-        final ArrayList result = new ArrayList(components.length);
+        final ArrayList<MenuElement> result = new ArrayList<MenuElement>(components.length);
         for (int i = 0; i < components.length; i++) {
             if (components[i] instanceof MenuElement) {
-                result.add(components[i]);
+                result.add((MenuElement)components[i]);
             }
         }
 
-        return (MenuElement[])result.toArray(new MenuElement[result.size()]);
+        return result.toArray(new MenuElement[result.size()]);
     }
 
     /**
@@ -856,10 +856,10 @@
         if (!(element instanceof Container)) {
             return new MenuElement[0];
         }
-        final ArrayList hierarchy = new ArrayList();
+        final ArrayList<MenuElement> hierarchy = new ArrayList<MenuElement>();
         Container c = (Container)element;
         do {
-            hierarchy.add(0, c);
+            hierarchy.add(0, (MenuElement)c);
             if (c instanceof JMenuBar) {
                 break;
             }
@@ -870,7 +870,7 @@
             }
         } while (c != null && c instanceof MenuElement);
 
-        return (MenuElement[])hierarchy.toArray(new MenuElement[hierarchy.size()]);
+        return hierarchy.toArray(new MenuElement[hierarchy.size()]);
     }
 
     /**
@@ -969,14 +969,19 @@
      * Returns sum of two integers. This function prevents overflow, and
      * if the result were greater than Integer.MAX_VALUE, the maximum
      * integer would be returned.
+     * <p><strong>Note:</strong> this does not prevent underflow.
      *
      * @param item1 the first number
      * @param item2 the second number
      * @return the sum
      */
     public static int safeIntSum(final int item1, final int item2) {
-        return (item1 > Integer.MAX_VALUE - item2) ? Integer.MAX_VALUE
-                : item1 + item2;
+        if (item2 > 0) {
+            return (item1 > Integer.MAX_VALUE - item2) ? Integer.MAX_VALUE
+                                                       : item1 + item2;
+        }
+        // TODO Handle negative values correctly: MIN_VALUE - 1 == MIN_VALUE
+        return item1 + item2;
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/text/ParagraphViewTest.java
Wed Nov 29 20:44:29 2006
@@ -14,10 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Alexey A. Ivanov
- * @version $Revision$
- */
+
 package javax.swing.text;
 
 import java.awt.Container;
@@ -50,6 +47,7 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        setIgnoreNotImplemented(true);
         doc = new DefaultStyledDocument();
         doc.insertString(0, "plainbolditalic\nparagraph2", null);
         //                   0123456789012345
@@ -341,16 +339,6 @@
         assertEquals(2, view.getViewCount());
         int width = (int) view.getPreferredSpan(View.X_AXIS);
         int height = (int) view.getPreferredSpan(View.Y_AXIS);
-        //        for (int i = 0; i < view.getViewCount(); i++) {
-        //            System.out.println("[" + i + "]: ("
-        //                               +  view.getOffset(View.X_AXIS, i) + ", "
-        //                               + view.getOffset(View.Y_AXIS, i) + ") x ("
-        //                               +  view.getSpan(View.X_AXIS, i) + ", "
-        //                               + view.getSpan(View.Y_AXIS, i) + ") <-- "
-        //                               + view.getView(i).getPreferredSpan(View.X_AXIS)
-        //                               + " x "
-        //                               + view.getView(i).getPreferredSpan(View.Y_AXIS));
-        //        }
         assertEquals(64 /*WIDTH*/, width);
         assertEquals(PartView.CHAR_HEIGHT * 2, height);
         Shape alloc = new Rectangle(WIDTH, HEIGHT * 2);

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/org/apache/harmony/x/swing/UtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/org/apache/harmony/x/swing/UtilitiesTest.java?view=diff&rev=480833&r1=480832&r2=480833
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/org/apache/harmony/x/swing/UtilitiesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/org/apache/harmony/x/swing/UtilitiesTest.java
Wed Nov 29 20:44:29 2006
@@ -14,12 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Alexander T. Simbirtsev
- * @version $Revision$
- * Created on 19.01.2005
 
- */
 package org.apache.harmony.x.swing;
 
 import java.awt.Font;
@@ -62,5 +57,15 @@
         assertFalse(Utilities.isEmptyString("\t"));
         assertFalse(Utilities.isEmptyString("\n"));
         assertFalse(Utilities.isEmptyString("\r"));
+    }
+
+    // Regression for HARMONY-2253
+    public void testSafeIntSum() {
+        assertEquals(0, Utilities.safeIntSum(9, -9));
+        assertEquals(0, Utilities.safeIntSum(-9, 9));
+        assertEquals(-18, Utilities.safeIntSum(-9, -9));
+        assertEquals(Integer.MIN_VALUE + 1, Utilities.safeIntSum(Integer.MIN_VALUE, 1));
+        // assertEquals(Integer.MIN_VALUE, Utilities.safeIntSum(Integer.MIN_VALUE, -1));
+        // assertEquals(Integer.MIN_VALUE, Utilities.safeIntSum(Integer.MIN_VALUE + 2, -2));
     }
 }



Mime
View raw message