on xenial help sign in
Add -windowgeometry option to the Dash and drop any user-visible mentions of Dash

Autopilot needs to resize the dash, has been doing that post-start until now, resulting in unreliable tests. Dash is a name we should only use internally, the marketed term is Scopes. Approved by: Michael Zanetti, Leo Arias

commitd276e0e66a45e42e15d523bfc269d06a19f35d93 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 18 Sep 2014, 21:22 (12 years ago) parent9e38890f17adda
7 files changed+28−30
data/unity8-dash.desktop.in+3−3 data/unity8.desktop.in+1−1 qml/Dash/DashApplication.qml+2−2 qml/Dash/ScopesOverview.qml+1−1 src/Dash/CMakeLists.txt+1 src/Dash/main.cpp+16−2 tests/autopilot/unity8/shell/tests/__init__.py+4−21
data/unity8-dash.desktop.in+3−3
@@ -1,9 +1,9 @@
11[Desktop Entry]
22Type=Application
3−Name=Unity 8 Dash
4−Comment=The converged Unity shell dash
3+Name=Scopes
4+Comment=An interface for using the Scopes system
55Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-dash
66Terminal=false
7−Icon=unity8
7+Icon=
88NoDisplay=true
99X-Ubuntu-Touch=true
data/unity8.desktop.in+1−1
@@ -4,6 +4,6 @@ Name=Unity 8
44Comment=The converged Unity shell
55Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8
66Terminal=false
7−Icon=unity8
7+Icon=
88NoDisplay=true
99X-Ubuntu-Touch=true
qml/Dash/DashApplication.qml+2−2
@@ -19,8 +19,8 @@ import Ubuntu.Components 1.0
1919import Ubuntu.Thumbnailer 0.1 // Register support for image://thumbnailer/ and image://albumart/
2020
2121MainView {
22− width: units.gu(40)
23− height: units.gu(71)
22+ width: applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
23+ height: applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(68)
2424
2525 useDeprecatedToolbar: false
2626
qml/Dash/ScopesOverview.qml+1−1
@@ -203,7 +203,7 @@ Item {
203203 }
204204 width: parent.width
205205 clip: true
206− title: i18n.tr("Manage Dash")
206+ title: i18n.tr("Manage Scopes")
207207 scopeStyle: overviewScopeStyle
208208 showSignatureLine: false
209209 searchEntryEnabled: true
src/Dash/CMakeLists.txt+1
@@ -1,5 +1,6 @@
11set(DASH_SRCS
22 main.cpp
3+ ../ApplicationArguments.h
34 ../MouseTouchAdaptor.cpp
45 ../CachingNetworkManagerFactory.cpp
56)
src/Dash/main.cpp+16−2
@@ -28,6 +28,7 @@
2828
2929#include <paths.h>
3030#include "../MouseTouchAdaptor.h"
31+#include "../ApplicationArguments.h"
3132#include "../CachingNetworkManagerFactory.h"
3233
3334int main(int argc, const char *argv[])
@@ -42,7 +43,11 @@ int main(int argc, const char *argv[])
4243 "Allow the mouse to provide touch input");
4344 parser.addOption(mousetouchOption);
4445
45− // FIXME Remove once we drop the need of the hint
46+ QCommandLineOption windowGeometryOption(QStringList() << "windowgeometry",
47+ "Specify the window geometry as [<width>x<height>]", "windowgeometry", "1");
48+ parser.addOption(windowGeometryOption);
49+
50+ // FIXME Remove once we drop the need of the hint
4651 QCommandLineOption desktopFileHintOption("desktop_file_hint",
4752 "The desktop_file_hint option for QtMir", "hint_file");
4853 parser.addOption(desktopFileHintOption);
@@ -52,6 +57,14 @@ int main(int argc, const char *argv[])
5257 parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
5358 parser.process(*application);
5459
60+ ApplicationArguments qmlArgs;
61+ if (parser.isSet(windowGeometryOption) &&
62+ parser.value(windowGeometryOption).split('x').size() == 2)
63+ {
64+ QStringList geom = parser.value(windowGeometryOption).split('x');
65+ qmlArgs.setSize(geom.at(0).toInt(), geom.at(1).toInt());
66+ }
67+
5568 if (getenv("QT_LOAD_TESTABILITY")) {
5669 QLibrary testLib(QLatin1String("qttestability"));
5770 if (testLib.load()) {
@@ -72,7 +85,8 @@ int main(int argc, const char *argv[])
7285
7386 QQuickView* view = new QQuickView();
7487 view->setResizeMode(QQuickView::SizeRootObjectToView);
75− view->setTitle("Unity Dash");
88+ view->setTitle("Scopes");
89+ view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
7690
7791 // You will need this if you want to interact with touch-only components using a mouse
7892 // Needed only when manually testing on a desktop.
tests/autopilot/unity8/shell/tests/__init__.py+4−21
@@ -432,12 +432,6 @@ class DashBaseTestCase(AutopilotTestCase):
432432 binary_path = get_binary_path('unity8-dash')
433433 dash_proxy = self.launch_dash(binary_path, self.environment)
434434
435− if self.should_simulate_device():
436− # XXX Currently we have no way to launch the application with a
437− # specific size, so we must resize it after it's launched.
438− # --elopio - 2014-06-25
439− self.resize_window()
440−
441435 self.dash_app = dash_helpers.DashApp(dash_proxy)
442436 self.dash = self.dash_app.dash
443437 self.wait_for_dash()
@@ -470,18 +464,7 @@ class DashBaseTestCase(AutopilotTestCase):
470464 simulate_device_fixture = self.useFixture(
471465 toolkit_fixtures.SimulateDevice(
472466 self.app_width, self.app_height, self.grid_unit_px))
473− self.app_width = simulate_device_fixture.app_width
474− self.app_height = simulate_device_fixture.app_height
475−
476− def resize_window(self):
477− application = self.process_manager.get_running_applications()[0]
478− window = application.get_windows()[0]
479− window.resize(self.app_width, self.app_height)
480−
481− def get_window_size():
482− _, _, window_width, window_height = window.geometry
483− return window_width, window_height
484−
485− self.assertThat(
486− get_window_size,
487− Eventually(Equals((self.app_width, self.app_height))))
467+ self.environment['GRID_UNIT_PX'] = simulate_device_fixture.grid_unit_px
468+ self.environment['ARGS'] = '-windowgeometry {0}x{1}'\
469+ .format(simulate_device_fixture.app_width,
470+ simulate_device_fixture.app_height)