ztenghui | fb6289c | 2015-05-12 14:42:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package android.uirendering.cts.testclasses; |
| 17 | |
| 18 | import android.graphics.Color; |
| 19 | import android.graphics.Point; |
| 20 | import android.uirendering.cts.bitmapverifiers.SamplePointVerifier; |
| 21 | |
| 22 | import com.android.cts.uirendering.R; |
| 23 | |
| 24 | import android.test.suitebuilder.annotation.SmallTest; |
| 25 | import android.uirendering.cts.testinfrastructure.ActivityTestBase; |
| 26 | |
| 27 | public class ShadowTests extends ActivityTestBase { |
| 28 | @SmallTest |
| 29 | public void testShadowLayout() { |
ztenghui | d6b1d4e | 2015-06-11 15:00:25 -0700 | [diff] [blame] | 30 | int shadowColorValue = 0xDB; |
| 31 | // Android TV theme overrides shadow opacity to be darker. |
| 32 | if (getActivity().getOnTv()) { |
| 33 | shadowColorValue = 0xBB; |
| 34 | } |
Teng-Hui Zhu | bf91bc3 | 2015-09-02 11:10:43 -0700 | [diff] [blame] | 35 | // Use a higher threshold (30) than default value (20); |
ztenghui | d6b1d4e | 2015-06-11 15:00:25 -0700 | [diff] [blame] | 36 | SamplePointVerifier verifier = new SamplePointVerifier( |
| 37 | new Point[] { |
| 38 | // view area |
| 39 | new Point(25, 64), |
| 40 | new Point(64, 64), |
| 41 | // shadow area |
| 42 | new Point(25, 65), |
| 43 | new Point(64, 65) |
| 44 | }, |
| 45 | new int[] { |
| 46 | Color.WHITE, |
| 47 | Color.WHITE, |
| 48 | Color.rgb(shadowColorValue, shadowColorValue, shadowColorValue), |
| 49 | Color.rgb(shadowColorValue, shadowColorValue, shadowColorValue), |
Teng-Hui Zhu | bf91bc3 | 2015-09-02 11:10:43 -0700 | [diff] [blame] | 50 | }, |
| 51 | 30); |
ztenghui | fb6289c | 2015-05-12 14:42:49 -0700 | [diff] [blame] | 52 | createTest() |
| 53 | .addLayout(R.layout.simple_shadow_layout, null, true/* HW only */) |
ztenghui | d6b1d4e | 2015-06-11 15:00:25 -0700 | [diff] [blame] | 54 | .runWithVerifier(verifier); |
ztenghui | fb6289c | 2015-05-12 14:42:49 -0700 | [diff] [blame] | 55 | } |
| 56 | } |