1 package platform.test.screenshot
2 
3 /**
4  * The emulations specs for all 8 permutations of:
5  * - phone or tablet.
6  * - dark of light mode.
7  * - portrait or landscape.
8  */
9 val DeviceEmulationSpec.Companion.PhoneAndTabletFull
10     get() = PhoneAndTabletFullSpec
11 
12 private val PhoneAndTabletFullSpec =
13     DeviceEmulationSpec.forDisplays(Displays.Phone, Displays.Tablet)
14 
15 /**
16  * The emulations specs of:
17  * - phone + light mode + portrait.
18  * - phone + light mode + landscape.
19  * - tablet + dark mode + portrait.
20  *
21  * This allows to test the most important permutations of a screen/layout with only 3
22  * configurations.
23  */
24 val DeviceEmulationSpec.Companion.PhoneAndTabletMinimal
25     get() = PhoneAndTabletMinimalSpec
26 
27 private val PhoneAndTabletMinimalSpec =
28     DeviceEmulationSpec.forDisplays(Displays.Phone, isDarkTheme = false) +
29         DeviceEmulationSpec.forDisplays(Displays.Tablet, isDarkTheme = true, isLandscape = false)
30 
31 val DeviceEmulationSpec.Companion.externalDisplaysMinimal
32     get() = externalDisplaysMinimalSpec
33 
34 private val externalDisplaysMinimalSpec: List<DeviceEmulationSpec> =
35     DeviceEmulationSpec.forDisplays(
36         Displays.External480p,
37         Displays.External720p,
38         Displays.External1080p,
39         Displays.External4k,
40         isDarkTheme = false,
41         isLandscape = true
42     )
43 
44 object Displays {
45     val Phone =
46         DisplaySpec(
47             "phone",
48             width = 1440,
49             height = 3120,
50             densityDpi = 560,
51         )
52 
53     val Tablet =
54         DisplaySpec(
55             "tablet",
56             width = 2560,
57             height = 1600,
58             densityDpi = 320,
59         )
60 
61     val FoldableOuter =
62         DisplaySpec(
63             "foldable_outer",
64             width = 1080,
65             height = 2092,
66             densityDpi = 420,
67         )
68 
69     val FoldableInner =
70         DisplaySpec(
71             "foldable_inner",
72             width = 2208,
73             height = 1840,
74             densityDpi = 420,
75         )
76 
77     val TallerFoldableOuter =
78         DisplaySpec(
79             "taller_foldable_outer",
80             width = 1080,
81             height = 2424,
82             densityDpi = 395,
83         )
84 
85     val TallerFoldableInner =
86         DisplaySpec(
87             "taller_foldable_inner",
88             width = 2076,
89             height = 2152,
90             densityDpi = 360,
91         )
92 
93     val External480p =
94         DisplaySpec(
95             "external480p",
96             width = 720,
97             height = 480,
98             densityDpi = 142,
99         )
100 
101     val External720p =
102         DisplaySpec(
103             "external720p",
104             width = 1280,
105             height = 720,
106             densityDpi = 213,
107         )
108 
109     val External1080p =
110         DisplaySpec(
111             "external1080p",
112             width = 1920,
113             height = 1080,
114             densityDpi = 320,
115         )
116 
117     val External4k =
118         DisplaySpec(
119             "external4k",
120             width = 3840,
121             height = 2160,
122             densityDpi = 320,
123         )
124 }
125