Removing Some Pixel Comparison Tests

Bug 4064073

These tests break when the underlying drawing libraries are
updated and don't have much to do with testing the
framework.

Change-Id: Ibfcad8c5fbc9184e635b84ea6d906b2826cad837
diff --git a/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
deleted file mode 100644
index 3db864b..0000000
--- a/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.graphics.cts;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.RadialGradient;
-import android.graphics.Shader;
-import android.graphics.Shader.TileMode;
-
-import junit.framework.TestCase;
-
-@TestTargetClass(RadialGradient.class)
-public class RadialGradientTest extends TestCase {
-    private static final int SIZE = 200;
-    private static final int RADIUS = 80;
-    private static final int CENTER = SIZE / 2;
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "RadialGradient",
-        args = {float.class, float.class, float.class, int[].class, float[].class,
-                TileMode.class}
-    )
-    public void testRadialGradient() {
-        final int[] colors = { Color.BLUE, Color.GREEN, Color.RED };
-        final float[] positions = { 0f, 0.3f, 1f };
-        int tolerance = (int)(0xFF / (0.3f * RADIUS) * 2);
-        RadialGradient rg = new RadialGradient(CENTER, CENTER, RADIUS, colors, positions,
-                Shader.TileMode.CLAMP);
-        Bitmap b = Bitmap.createBitmap(SIZE, SIZE, Bitmap.Config.ARGB_8888);
-        Canvas canvas = new Canvas(b);
-        Paint p = new Paint();
-        p.setShader(rg);
-        canvas.drawRect(0, 0, SIZE, SIZE, p);
-        checkPixels(b, colors, positions, tolerance);
-    }
-
-    @TestTargetNew(
-        level = TestLevel.COMPLETE,
-        method = "RadialGradient",
-        args = {float.class, float.class, float.class, int.class, int.class, TileMode.class}
-    )
-    public void testRadialGradientWithColor() {
-        final int[] colors = { Color.BLUE, Color.GREEN };
-        final float[] positions = { 0f, 1f };
-        int tolerance = (int)(0xFF / RADIUS * 2);
-        RadialGradient rg = new RadialGradient(CENTER, CENTER, RADIUS, colors[0], colors[1],
-                Shader.TileMode.CLAMP);
-        Bitmap b = Bitmap.createBitmap(SIZE, SIZE, Bitmap.Config.ARGB_8888);
-        Canvas canvas = new Canvas(b);
-        Paint p = new Paint();
-        p.setShader(rg);
-        canvas.drawRect(0, 0, SIZE, SIZE, p);
-        checkPixels(b, colors, positions, tolerance);
-    }
-
-    private void checkPixels(Bitmap bitmap, int[] colors, float[] positions, int tolerance) {
-        for (int y = 0; y < SIZE; y++) {
-            for (int x = 0; x < SIZE; x++) {
-                double dist = dist(x, y, CENTER, CENTER) / RADIUS;
-                int idx;
-                int color;
-                for (idx = 0; idx < positions.length; idx++) {
-                    if (positions[idx] > dist) {
-                        break;
-                    }
-                }
-                if (idx == 0) {
-                    // use start color
-                    color = colors[0];
-                } else if (idx == positions.length) {
-                    // clamp to end color
-                    color = colors[positions.length - 1];
-                } else {
-                    // linear interpolation
-                    int i1 = idx - 1; // index of next lower color and position
-                    int i2 = idx; // index of next higher color and position
-                    double delta = (dist - positions[i1]) / (positions[i2] - positions[i1]);
-                    int alpha = (int) ((1d - delta) * Color.alpha(colors[i1]) +
-                            delta * Color.alpha(colors[i2]));
-                    int red = (int) ((1d - delta) * Color.red(colors[i1]) +
-                            delta * Color.red(colors[i2]));
-                    int green = (int) ((1d - delta) * Color.green(colors[i1]) +
-                            delta * Color.green(colors[i2]));
-                    int blue = (int) ((1d - delta) * Color.blue(colors[i1]) +
-                            delta * Color.blue(colors[i2]));
-                    color = Color.argb(alpha, red, green, blue);
-                }
-                int pixel = bitmap.getPixel(x, y);
-
-                assertEquals(Color.alpha(color), Color.alpha(pixel), tolerance);
-                assertEquals(Color.red(color), Color.red(pixel), tolerance);
-                assertEquals(Color.green(color), Color.green(pixel), tolerance);
-                assertEquals(Color.blue(color), Color.blue(pixel), tolerance);
-            }
-        }
-    }
-
-    /**
-     * Calculate distance between two points.
-     */
-    private double dist(int x1, int y1, int x2, int y2) {
-        int distX = x1 - x2;
-        int distY = y1 - y2;
-        return Math.sqrt(distX * distX + distY * distY);
-    }
-
-}
diff --git a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
index d09483d..c861b3e 100644
--- 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));
-            }
-        }
     }
 }