1 /* 2 * Copyright 2023 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 com.android.input.screenshot 18 19 import platform.test.screenshot.DeviceEmulationSpec 20 import platform.test.screenshot.DisplaySpec 21 22 /** 23 * The emulations specs for all 8 permutations of: 24 * - phone or tablet. 25 * - dark of light mode. 26 * - portrait or landscape. 27 */ 28 val DeviceEmulationSpec.Companion.PhoneAndTabletFull 29 get() = PhoneAndTabletFullSpec 30 31 private val PhoneAndTabletFullSpec = 32 DeviceEmulationSpec.forDisplays(Displays.Phone, Displays.Tablet) 33 34 /** 35 * The emulations specs of: 36 * - phone + light mode + portrait. 37 * - phone + light mode + landscape. 38 * - tablet + dark mode + portrait. 39 * 40 * This allows to test the most important permutations of a screen/layout with only 3 41 * configurations. 42 */ 43 val DeviceEmulationSpec.Companion.PhoneAndTabletMinimal 44 get() = PhoneAndTabletMinimalSpec 45 46 private val PhoneAndTabletMinimalSpec = 47 DeviceEmulationSpec.forDisplays(Displays.Phone, isDarkTheme = false) + 48 DeviceEmulationSpec.forDisplays(Displays.Tablet, isDarkTheme = true, isLandscape = false) 49 50 /** 51 * This allows to test only single most important configuration. 52 */ 53 val DeviceEmulationSpec.Companion.PhoneMinimal 54 get() = PhoneMinimalSpec 55 56 private val PhoneMinimalSpec = 57 DeviceEmulationSpec.forDisplays(Displays.Phone, isDarkTheme = false, isLandscape = false) 58 59 object Displays { 60 val Phone = 61 DisplaySpec( 62 "phone", 63 width = 1440, 64 height = 3120, 65 densityDpi = 560, 66 ) 67 68 val Tablet = 69 DisplaySpec( 70 "tablet", 71 width = 2560, 72 height = 1600, 73 densityDpi = 320, 74 ) 75 }