am 49bca3aa: Merge "Adjust Tests to Work without Hinting" into gingerbread

* commit '49bca3aafbcc877e4ea06bcdfab8dab060ef7244':
  Adjust Tests to Work without Hinting
diff --git a/tests/res/drawable/typeface_test.png b/tests/res/drawable/typeface_test.png
deleted file mode 100644
index c337f5f..0000000
--- a/tests/res/drawable/typeface_test.png
+++ /dev/null
Binary files differ
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
old mode 100644
new mode 100755
index bf39818..b394d28
--- a/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
@@ -112,7 +112,7 @@
         // underline is at least one pixel high
         assertTrue(rect.top <= rect.bottom);
         // underline is roughly the same length at the text (5% tolerance)
-        assertEquals(mTextWidth, rect.right - rect.left, mTextWidth * 0.05);
+        assertEquals(mTextWidth, rect.right - rect.left, mTextWidth * 0.053);
         // underline is under the text or at least at the bottom of it
         assertTrue(rect.top >= TEXT_Y);
     }
diff --git a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
old mode 100644
new mode 100755
index d09483d..c861b3e
--- a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
@@ -16,21 +16,12 @@
 
 package android.graphics.cts;
 
-import com.android.cts.stub.R;
-
-import dalvik.annotation.KnownFailure;
 import dalvik.annotation.TestLevel;
 import dalvik.annotation.TestTargetClass;
 import dalvik.annotation.TestTargetNew;
 import dalvik.annotation.TestTargets;
 
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
 import android.graphics.Typeface;
-import android.graphics.Bitmap.Config;
 import android.test.AndroidTestCase;
 
 @TestTargetClass(android.graphics.Typeface.class)
@@ -174,28 +165,5 @@
 
         Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "samplefont.ttf");
         assertNotNull(typeface);
-
-        Bitmap bitmap = Bitmap.createBitmap(100, 100, Config.ARGB_8888);
-        bitmap.eraseColor(Color.BLACK);
-        Canvas canvas = new Canvas(bitmap);
-        Paint p = new Paint();
-        p.setTypeface(typeface);
-        p.setColor(Color.WHITE);
-        p.setTextAlign(Paint.Align.CENTER);
-        p.setTextSize(50);
-        p.setFlags(0); // clear all flags (not sure what defaults flags are set)
-        canvas.drawText("test", bitmap.getWidth() / 2, 3 * bitmap.getHeight() / 4 , p);
-
-        BitmapFactory.Options opt = new BitmapFactory.Options();
-        opt.inScaled = false;
-        Bitmap expected = BitmapFactory.decodeResource(
-                getContext().getResources(), R.drawable.typeface_test, opt);
-        assertEquals(expected.getWidth(), bitmap.getWidth());
-        assertEquals(expected.getHeight(), bitmap.getHeight());
-        for (int y = 0; y < bitmap.getHeight(); y++) {
-            for (int x = 0; x < bitmap.getWidth(); x++) {
-                assertEquals(expected.getPixel(x, y), bitmap.getPixel(x, y));
-            }
-        }
     }
 }
diff --git a/tests/tests/text/src/android/text/cts/TextUtilsTest.java b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
old mode 100644
new mode 100755
index 04f9366..0b274f5
--- a/tests/tests/text/src/android/text/cts/TextUtilsTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
@@ -98,7 +98,7 @@
         // issue 1688347, the expected result for this case does not be described
         // in the javadoc of commaEllipsize().
         assertEquals("",
-                TextUtils.commaEllipsize(text, p, textWidth - 1, "plus 1", "%d plus").toString());
+                TextUtils.commaEllipsize(text, p, textWidth - 1.4f, "plus 1", "%d plus").toString());
         // avail is long enough for only one item plus the appropriate ellipsis.
         assertEquals("long, 3 plus",
                 TextUtils.commaEllipsize(text, p, textWidth, "plus 1", "%d plus").toString());
diff --git a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
old mode 100644
new mode 100755
index 9968bda..be2eede
--- a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
@@ -187,7 +187,7 @@
             }
         }));
         assertTrue(mTextView.getScrollX() > previousScrollX);
-        assertEquals(rightMost, mTextView.getScrollX(), 0f);
+        assertEquals(rightMost, mTextView.getScrollX(), 1.0f);
 
         previousScrollX = mTextView.getScrollX();
         assertTrue(getActionResult(new ActionRunnerWithResult() {
diff --git a/tests/tests/text/src/android/text/method/cts/TouchTest.java b/tests/tests/text/src/android/text/method/cts/TouchTest.java
old mode 100644
new mode 100755
index e5275af..6b53f1d
--- a/tests/tests/text/src/android/text/method/cts/TouchTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TouchTest.java
@@ -96,7 +96,7 @@
             }
         });
         getInstrumentation().waitForIdleSync();
-        assertEquals(width - tv.getWidth(), tv.getScrollX());
+        assertEquals(width - tv.getWidth(), tv.getScrollX(), 1.0f);
         assertEquals(5, tv.getScrollY());
 
         runTestOnUiThread(new Runnable() {
@@ -105,7 +105,7 @@
             }
         });
         getInstrumentation().waitForIdleSync();
-        assertEquals(width - tv.getWidth(), tv.getScrollX());
+        assertEquals(width - tv.getWidth(), tv.getScrollX(), 1.0f);
         assertEquals(5, tv.getScrollY());
     }
 
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
old mode 100644
new mode 100755
index b444f11..dc8e8b7
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -1880,12 +1880,12 @@
         mTextView.getFocusedRect(rc);
         assertNotNull(mTextView.getLayout());
         assertEquals(mTextView.getLayout().getPrimaryHorizontal(13),
-                (float) rc.left, 0.01f);
+                (float) rc.left, 0.4f);
         // 'right' is one pixel larger than 'left'
         assertEquals(mTextView.getLayout().getPrimaryHorizontal(13) + 1,
-                (float) rc.right, 0.01f);
+                (float) rc.right, 0.4f);
         assertEquals(mTextView.getLayout().getLineTop(0), rc.top);
-        assertEquals(mTextView.getLayout().getLineBottom(0), rc.bottom);
+        assertEquals(mTextView.getLayout().getLineBottom(0), rc.bottom, 0.4f);
 
         // Exception
         try {