OSDN Git Service

Move ColorSpace#Renderer tests to APCT
authorChris Craik <ccraik@google.com>
Fri, 28 Apr 2017 20:34:11 +0000 (13:34 -0700)
committerChris Craik <ccraik@google.com>
Fri, 28 Apr 2017 21:08:13 +0000 (14:08 -0700)
Bug: 37779858
Test: adb install -r ${ANDROID_PRODUCT_OUT}/data/app/FrameworksCoreTests/FrameworksCoreTests.apk && adb shell am instrument -w -e class android.graphics.ColorSpaceRendererTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I2888cdc8f4912721fdfcbbe5861f260781d165aa

core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java [new file with mode: 0644]

diff --git a/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java b/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java
new file mode 100644 (file)
index 0000000..6e38fb6
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class ColorSpaceRendererTest {
+
+    @Test
+    public void testRendererSize() {
+        Bitmap b = ColorSpace.createRenderer()
+                .size(0)
+                .render();
+        assertEquals(128, b.getWidth());
+        assertEquals(128, b.getHeight());
+
+        b = ColorSpace.createRenderer()
+                .size(768)
+                .render();
+        assertEquals(768, b.getWidth());
+        assertEquals(768, b.getHeight());
+    }
+
+    @Test
+    public void testRenderer() {
+        Bitmap b = ColorSpace.createRenderer()
+                .size(1024)
+                .clip(true)
+                .showWhitePoint(false)
+                .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .render();
+        assertNotNull(b);
+    }
+
+    @Test
+    public void testUcsRenderer() {
+        Bitmap b = ColorSpace.createRenderer()
+                .size(1024)
+                .clip(true)
+                .showWhitePoint(false)
+                .uniformChromaticityScale(true)
+                .add(ColorSpace.get(ColorSpace.Named.SRGB), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.DCI_P3), 0xffffffff)
+                .add(ColorSpace.get(ColorSpace.Named.PRO_PHOTO_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .add(ColorSpace.get(ColorSpace.Named.ADOBE_RGB), 0.1f, 0.5f, 0.1f, 0xff000000)
+                .render();
+        assertNotNull(b);
+    }
+}