summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2017-05-01 17:34:59 +0000
committer android-build-merger <android-build-merger@google.com> 2017-05-01 17:34:59 +0000
commitb55bb7089722e0ca60c1a318724293773984fb4c (patch)
treeedfe18d0c4eb863a938d36186de4ed8a61d32fbd
parent9930a35e44db2ffc59e4f5082efdd46d1aaaab2e (diff)
parent117ce083bf1b2ab32ae9b6734ae08f8b4ad4b13f (diff)
Merge "Move ColorSpace#Renderer tests to APCT" into oc-dev
am: 117ce083bf Change-Id: I86a5aec02da2012542fc6b9cbb5bab83d0ca9bf6
-rw-r--r--core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java b/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java
new file mode 100644
index 000000000000..6e38fb685887
--- /dev/null
+++ b/core/tests/coretests/src/android/graphics/ColorSpaceRendererTest.java
@@ -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);
+ }
+}