Debian Codegraph @

tests/autopilot/lomiriuitoolkit/lomiri_scenarios.py

raw symbols SCIP
1 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2 #
3 # Copyright (C) 2014 Canonical Ltd.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; version 3.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 from autopilot import platform
18
19
20 NEXUS4_DEVICE = 'Nexus4'
21 NEXUS10_DEVICE = 'Nexus10'
22 DEFAULT_DEVICES = (NEXUS4_DEVICE, NEXUS10_DEVICE)
23
24
25 def get_device_simulation_scenarios(devices=DEFAULT_DEVICES):
26 """Return a list of devices to be simulated on tests.
27
28 :param devices: The device or devices to simulate. Default value is all the
29 officially supported devices.
30 :type devices: string or sequence of strings.
31 :return: A list of scenarios to be used with the testscenarios python
32 module, with the values of app_width, app_height and grid_unit
33 corresponding to the selected device.
34
35 """
36 if platform.model() == 'Desktop':
37 return _get_device_simulation_scenarios_for_desktop(devices)
38 else:
39 return [(platform.model(), {})]
40
41
42 def _get_device_simulation_scenarios_for_desktop(devices):
43 scenarios = []
44 if NEXUS4_DEVICE in devices:
45 scenarios.append(
46 ('Simulating Nexus 4 in desktop',
47 dict(app_width=768, app_height=1280, grid_unit_px=18))
48 )
49 if NEXUS10_DEVICE in devices:
50 scenarios.append(
51 ('Simulating Nexus 10 in desktop',
52 dict(app_width=2560, app_height=1600, grid_unit_px=20))
53 )
54 return scenarios