• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 
17 package android.server.wm;
18 
19 import static org.junit.Assert.assertThat;
20 
21 import android.app.Activity;
22 import android.platform.test.annotations.Presubmit;
23 
24 import androidx.test.rule.ActivityTestRule;
25 
26 import org.junit.Rule;
27 import org.junit.Test;
28 
29 /**
30  * Build/Install/Run:
31  *  atest CtsWindowManagerSdk25TestCases:AspectRatioSdk25Tests
32  */
33 @Presubmit
34 public class AspectRatioSdk25Tests extends AspectRatioTestsBase {
35 
36     // Max supported aspect ratio for pre-O apps.
37     private static final float MAX_PRE_O_ASPECT_RATIO = 1.86f;
38 
39     // Test target activity that has targetSdk="25" and resizeableActivity="false".
40     public static class Sdk25MaxAspectRatioActivity extends Activity {
41     }
42 
43     @Rule
44     public ActivityTestRule<Sdk25MaxAspectRatioActivity> mSdk25MaxAspectRatioActivity =
45             new ActivityTestRule<>(Sdk25MaxAspectRatioActivity.class,
46                     false /* initialTouchMode */, false /* launchActivity */);
47 
48     @Test
testMaxAspectRatioPreOActivity()49     public void testMaxAspectRatioPreOActivity() {
50         runAspectRatioTest(mSdk25MaxAspectRatioActivity,
51                 (actual, displayId, activitySize, displaySize) -> {
52             assertThat(actual, lessThanOrEqualToInexact(MAX_PRE_O_ASPECT_RATIO));
53         });
54     }
55 }
56