From: Chris Craik Date: Fri, 28 Apr 2017 20:34:11 +0000 (-0700) Subject: Move ColorSpace#Renderer tests to APCT X-Git-Tag: android-x86-9.0-r1~1044^2~1195^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=10682305f0c14cdda8bca3d516fe4bde9e477bad;p=android-x86%2Fframeworks-base.git Move ColorSpace#Renderer tests to APCT 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 --- 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); + } +}