on xenial help sign in
Added geometry to indicators client setup
commitd147b7f539da20d40b241416b1ec1606411ae7d9 authorNick Dedekind <nicholas.dedekind@gmail.com> dateTue 9 Jul 2013, 11:15 (13 years ago) parent972288a
3 files changed+36−18
src/Panel/Indicators/client/indicatorsclient.cpp+20−10 tests/autopilot/indicators_client/tests/__init__.py+15−7 tests/autopilot/indicators_client/tests/test_battery.py+1−1
src/Panel/Indicators/client/indicatorsclient.cpp+20−10
@@ -56,6 +56,26 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
5656 m_view(0)
5757{
5858 m_application = new QApplication(argc, argv);
59+ QStringList args = m_application->arguments();
60+
61+ m_view = new QQuickView;
62+ m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
63+ prependImportPaths(m_view->engine(), ::overrideImportPaths());
64+ appendImportPaths(m_view->engine(), ::fallbackImportPaths());
65+
66+ m_view->setSource(QUrl("IndicatorsClient.qml"));
67+ m_view->setResizeMode(QQuickView::SizeRootObjectToView);
68+
69+ if (args.contains(QLatin1String("-geometry")) && args.size() > args.indexOf(QLatin1String("-geometry")) + 1) {
70+ QStringList geometryArg = args.at(args.indexOf(QLatin1String("-geometry")) + 1).split('x');
71+ if (geometryArg.size() == 2) {
72+ m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
73+ }
74+ }
75+ else {
76+ //Usable size on desktop
77+ m_view->setMinimumSize(QSize(480, 720));
78+ }
5979}
6080
6181IndicatorsClient::~IndicatorsClient()
@@ -69,21 +89,11 @@ IndicatorsClient::~IndicatorsClient()
6989
7090void IndicatorsClient::setupUI()
7191{
72− m_view = new QQuickView;
73− m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
74− prependImportPaths(m_view->engine(), ::overrideImportPaths());
75− appendImportPaths(m_view->engine(), ::fallbackImportPaths());
76−
77− m_view->setSource(QUrl("IndicatorsClient.qml"));
78− m_view->setResizeMode(QQuickView::SizeRootObjectToView);
7992
80− //Usable size on desktop
81− m_view->setMinimumSize(QSize(480, 720));
8293}
8394
8495int IndicatorsClient::run()
8596{
86− setupUI();
8797 m_view->show();
8898 return m_application->exec();
8999}
tests/autopilot/indicators_client/tests/__init__.py+15−7
@@ -38,19 +38,27 @@ class IndicatorsTestCase(AutopilotTestCase):
3838 ('with touch', dict(input_device_class=Touch)),
3939 ]
4040
41− def setUp(self):
41+ def setUp(self, geometry):
4242 self.pointing_device = Pointer(self.input_device_class.create())
4343 super(IndicatorsTestCase, self).setUp()
4444 if os.path.realpath(__file__).startswith("/usr/"):
45− self.launch_test_installed()
45+ self.launch_test_installed(geometry)
4646 else:
47− self.launch_test_local()
47+ self.launch_test_local(geometry)
4848
49− def launch_test_local(self):
50− self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client", app_type='qt')
49+ def launch_test_local(self,geometry):
50+ if geometry != "0x0":
51+ self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
52+ "-geometry", geometry, app_type='qt')
53+ else:
54+ self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
55+ app_type='qt')
5156
52− def launch_test_installed(self):
53− self.app = self.launch_test_application("indicators-client", app_type='qt')
57+ def launch_test_installed(self, geometry):
58+ if geometry != "0x0":
59+ self.app = self.launch_test_application("indicators-client", "-geometry", geometry, app_type='qt')
60+ else:
61+ self.app = self.launch_test_application("indicators-client", app_type='qt')
5462
5563 def skipWrapper(*args, **kwargs):
5664 pass
tests/autopilot/indicators_client/tests/test_battery.py+1−1
@@ -17,7 +17,7 @@ import math
1717
1818class TestDisplayMenus(IndicatorsTestCase):
1919 def setUp(self):
20− super(TestDisplayMenus, self).setUp()
20+ super(TestDisplayMenus, self).setUp("384x640")
2121
2222 # This opens the messaging menu so you don't have to do that in
2323 # every test case