blob: 4582935c0608400308ce4c33c1e823e5a7b95685 [file] [log] [blame]
ztenghuifb6289c2015-05-12 14:42:49 -07001/*
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 */
16package android.uirendering.cts.testclasses;
17
18import android.graphics.Color;
19import android.graphics.Point;
20import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
21
22import com.android.cts.uirendering.R;
23
24import android.test.suitebuilder.annotation.SmallTest;
25import android.uirendering.cts.testinfrastructure.ActivityTestBase;
26
27public class ShadowTests extends ActivityTestBase {
28 @SmallTest
29 public void testShadowLayout() {
ztenghuid6b1d4e2015-06-11 15:00:25 -070030 int shadowColorValue = 0xDB;
31 // Android TV theme overrides shadow opacity to be darker.
32 if (getActivity().getOnTv()) {
33 shadowColorValue = 0xBB;
34 }
Teng-Hui Zhubf91bc32015-09-02 11:10:43 -070035 // Use a higher threshold (30) than default value (20);
ztenghuid6b1d4e2015-06-11 15:00:25 -070036 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 Zhubf91bc32015-09-02 11:10:43 -070050 },
51 30);
ztenghuifb6289c2015-05-12 14:42:49 -070052 createTest()
53 .addLayout(R.layout.simple_shadow_layout, null, true/* HW only */)
ztenghuid6b1d4e2015-06-11 15:00:25 -070054 .runWithVerifier(verifier);
ztenghuifb6289c2015-05-12 14:42:49 -070055 }
56}