on xenial help sign in
Merged trunk
578d8c1Andrea Cimitan
cmake/modules/Plugins.cmake+1
@@ -24,6 +24,7 @@ macro(export_qmlfiles PLUGIN PLUGIN_SUBPATH)
24 add_custom_target(${PLUGIN}-qmlfiles ALL
24 add_custom_target(${PLUGIN}-qmlfiles ALL
25 COMMAND cp ${QMLFILES} ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}
25 COMMAND cp ${QMLFILES} ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}
26 DEPENDS ${QMLFILES}
26 DEPENDS ${QMLFILES}
27+ SOURCES ${QMLFILES}
27 )
28 )
28
29
29 # install the qmlfiles file.
30 # install the qmlfiles file.
debian/changelog+36
@@ -1,3 +1,39 @@
1+unity8 (7.84+14.04.20140212-0ubuntu1) trusty; urgency=low
2+
3+ [ Gerry Boland ]
4+ * Add InputFilterArea to sidestage handle to block input to mainstage
5+ app while moving sidestage (LP: #1275732)
6+
7+ [ Leo Arias ]
8+ * On the autopilot helper to open a scope, wait for the dash content
9+ list to stop moving. (LP: #1277591)
10+ * Added a test to swipe out an application started by url-dispatcher.
11+
12+ [ Nick Dedekind ]
13+ * Added a "-profile" option to the indicator-client to switch between
14+ indicator service profiles.
15+ * Fixed issue importing plugin qml files into qtcreator
16+
17+ [ Albert Astals ]
18+ * Fix test_previewCycle
19+ * Don't move the list contentY unless there's a preview to show (LP:
20+ #1271676)
21+ * Add overlay to card. Fix implicit card height. .
22+ * PreviewHeader Is just a link of the widgetData with the CardHeader
23+ * Fix tst_Preview.qml
24+ * Scopes guys want the data back
25+ * Link the pageheader scope with the current scope So that the
26+ activity indicator on search works again (LP: #1279316)
27+
28+ [ Andrea Cimitan ]
29+ * Add PreviewImage
30+ * Preview widget for video playback
31+
32+ [ CI bot ]
33+ * Add overlay to card. Fix implicit card height. .
34+
35+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 12 Feb 2014 15:15:03 +0000
36+
1unity8 (7.84+14.04.20140207.1-0ubuntu1) trusty; urgency=low
37unity8 (7.84+14.04.20140207.1-0ubuntu1) trusty; urgency=low
2
38
3 [ Ted Gould ]
39 [ Ted Gould ]
debian/control+2
@@ -111,8 +111,10 @@ Depends: gir1.2-glib-2.0,
111 python-fixtures,
111 python-fixtures,
112 python-gi,
112 python-gi,
113 python-mock,
113 python-mock,
114+ ubuntu-ui-toolkit-autopilot,
114 unity8 (>= ${source:Version}),
115 unity8 (>= ${source:Version}),
115 unity8-fake-env (>= ${source:Version}),
116 unity8-fake-env (>= ${source:Version}),
117+ url-dispatcher-tools,
116 ${misc:Depends},
118 ${misc:Depends},
117 ${python:Depends},
119 ${python:Depends},
118 ${shlibs:Depends},
120 ${shlibs:Depends},
plugins/Unity/Indicators/indicatorsmanager.cpp+5−4
@@ -26,8 +26,6 @@
26
26
27#include <paths.h>
27#include <paths.h>
28
28
29−const QString profile = "phone";
30−
31
29
32class IndicatorsManager::IndicatorData
30class IndicatorsManager::IndicatorData
33{
31{
@@ -49,6 +47,7 @@ public:
49IndicatorsManager::IndicatorsManager(QObject* parent)
47IndicatorsManager::IndicatorsManager(QObject* parent)
50 : QObject(parent)
48 : QObject(parent)
51 , m_loaded(false)
49 , m_loaded(false)
50+ , m_profile("phone")
52{
51{
53}
52}
54
53
@@ -58,9 +57,11 @@ IndicatorsManager::~IndicatorsManager()
58
57
59}
58}
60
59
61−void IndicatorsManager::load()
60+void IndicatorsManager::load(const QString& profile)
62{
61{
63 unload();
62 unload();
63+ m_profile = profile;
64+
64 QStringList xdgLocations = shellDataDirs();//QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
65 QStringList xdgLocations = shellDataDirs();//QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
65
66
66 m_fsWatcher.reset(new QFileSystemWatcher(this));
67 m_fsWatcher.reset(new QFileSystemWatcher(this));
@@ -300,7 +301,7 @@ Indicator::Ptr IndicatorsManager::indicator(const QString& indicator_name)
300 Indicator::Ptr new_indicator(new Indicator(this));
301 Indicator::Ptr new_indicator(new Indicator(this));
301 data->m_indicator = new_indicator;
302 data->m_indicator = new_indicator;
302 QSettings settings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this);
303 QSettings settings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this);
303− new_indicator->init(profile, data->m_fileInfo.fileName(), settings);
304+ new_indicator->init(m_profile, data->m_fileInfo.fileName(), settings);
304 return new_indicator;
305 return new_indicator;
305}
306}
306
307
plugins/Unity/Indicators/indicatorsmanager.h+2−1
@@ -38,7 +38,7 @@ public:
38 explicit IndicatorsManager(QObject* parent = 0);
38 explicit IndicatorsManager(QObject* parent = 0);
39 ~IndicatorsManager();
39 ~IndicatorsManager();
40
40
41− Q_INVOKABLE void load();
41+ Q_INVOKABLE void load(const QString& profile);
42 Q_INVOKABLE void unload();
42 Q_INVOKABLE void unload();
43
43
44 Indicator::Ptr indicator(const QString& indicator_name);
44 Indicator::Ptr indicator(const QString& indicator_name);
@@ -71,6 +71,7 @@ private:
71 QHash<QString, IndicatorData*> m_indicatorsData;
71 QHash<QString, IndicatorData*> m_indicatorsData;
72 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
72 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
73 bool m_loaded;
73 bool m_loaded;
74+ QString m_profile;
74};
75};
75
76
76#endif // INDICATORS_MANAGER_H
77#endif // INDICATORS_MANAGER_H
plugins/Unity/Indicators/indicatorsmodel.cpp+2−2
@@ -85,10 +85,10 @@ int IndicatorsModel::count() const
85
85
86 Load all indicators.
86 Load all indicators.
87*/
87*/
88−void IndicatorsModel::load()
88+void IndicatorsModel::load(const QString& profile)
89{
89{
90 m_indicators.clear();
90 m_indicators.clear();
91− m_manager->load();
91+ m_manager->load(profile);
92}
92}
93
93
94/*!
94/*!
plugins/Unity/Indicators/indicatorsmodel.h+1−1
@@ -40,7 +40,7 @@ public:
40 IndicatorsModel(QObject *parent=0);
40 IndicatorsModel(QObject *parent=0);
41 ~IndicatorsModel();
41 ~IndicatorsModel();
42
42
43− Q_INVOKABLE void load();
43+ Q_INVOKABLE void load(const QString& profile);
44 Q_INVOKABLE void unload();
44 Q_INVOKABLE void unload();
45
45
46 Q_INVOKABLE QVariant data(int row, int role) const;
46 Q_INVOKABLE QVariant data(int row, int role) const;
po/km.po+7−5
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity8\n"
8"Project-Id-Version: unity8\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-02-04 15:43+0000\n"
10"POT-Creation-Date: 2014-02-04 15:43+0000\n"
11−"PO-Revision-Date: 2013-11-20 07:34+0000\n"
11+"PO-Revision-Date: 2014-02-12 07:06+0000\n"
12"Last-Translator: Khoem Sokhem <khoemsokhem@khmeros.info>\n"
12"Last-Translator: Khoem Sokhem <khoemsokhem@khmeros.info>\n"
13"Language-Team: Khmer <km@li.org>\n"
13"Language-Team: Khmer <km@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
18−"X-Launchpad-Export-Date: 2014-02-12 06:27+0000\n"
18+"X-Launchpad-Export-Date: 2014-02-13 06:51+0000\n"
19"X-Generator: Launchpad (build 16916)\n"
19"X-Generator: Launchpad (build 16916)\n"
20
20
21#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:43
@@ -74,6 +74,8 @@ msgid ""
74"You have now mastered the edge gestures and can start using the "
74"You have now mastered the edge gestures and can start using the "
75"phone<br><br>Tap on the screen to start"
75"phone<br><br>Tap on the screen to start"
76msgstr ""
76msgstr ""
77+"ឥឡូវ​អ្នក​បាន​ពិនិត្យ​កាយវិការ​គែម​ "
78+"និង​អាច​ចាប់ផ្ដើម​ប្រើ​ទូរស័ព្ទ<br><br>ប៉ះ លើ​អេក្រង់​ដើម្បី​ចាប់ផ្ដើម"
77
79
78#: qml/Components/PageHeader.qml:339
80#: qml/Components/PageHeader.qml:339
79msgid "Recent searches"
81msgid "Recent searches"
@@ -81,11 +83,11 @@ msgstr "ការ​ស្វែងរក​ថ្មី"
81
83
82#: qml/Components/SeeMore.qml:32
84#: qml/Components/SeeMore.qml:32
83msgid "See more"
85msgid "See more"
84−msgstr ""
86+msgstr "មើល​ច្រើន​ទៀត"
85
87
86#: qml/Components/SeeMore.qml:61
88#: qml/Components/SeeMore.qml:61
87msgid "See less"
89msgid "See less"
88−msgstr ""
90+msgstr "មើល​តិច​ជាង"
89
91
90#: qml/Dash/Apps/AppPreview.qml:136
92#: qml/Dash/Apps/AppPreview.qml:136
91msgid "Rate this"
93msgid "Rate this"
@@ -159,7 +161,7 @@ msgstr "បង្ហាញ​ពាក្យ​សម្ងាត់"
159
161
160#: qml/Notifications/NotificationMenuItemFactory.qml:103
162#: qml/Notifications/NotificationMenuItemFactory.qml:103
161msgid "Please enter SIM PIN"
163msgid "Please enter SIM PIN"
162−msgstr ""
164+msgstr "បញ្ចូល​កូដ PIN របស់​ស៊ីមកាត"
163
165
164#: qml/Panel/SearchIndicator.qml:27
166#: qml/Panel/SearchIndicator.qml:27
165msgid "Search"
167msgid "Search"
qml/Dash/DashContent.qml+2
@@ -156,9 +156,11 @@ Item {
156
156
157 PageHeader {
157 PageHeader {
158 id: pageHeader
158 id: pageHeader
159+ objectName: "pageHeader"
159 width: parent.width
160 width: parent.width
160 searchEntryEnabled: true
161 searchEntryEnabled: true
161 searchHistory: dashContent.searchHistory
162 searchHistory: dashContent.searchHistory
163+ scope: dashContentList.currentItem.theScope
162
164
163 childItem: TabBar {
165 childItem: TabBar {
164 id: tabBar
166 id: tabBar
qml/Dash/PreviewListView.qml+10−4
@@ -32,6 +32,7 @@ Item {
32 property alias model: previewListView.model
32 property alias model: previewListView.model
33 property alias currentIndex: previewListView.currentIndex
33 property alias currentIndex: previewListView.currentIndex
34 property alias currentItem: previewListView.currentItem
34 property alias currentItem: previewListView.currentItem
35+ property alias count: previewListView.count
35
36
36 Image {
37 Image {
37 objectName: "pointerArrow"
38 objectName: "pointerArrow"
@@ -87,15 +88,19 @@ Item {
87 id: previewDelegateMapper
88 id: previewDelegateMapper
88 }
89 }
89
90
90− onCurrentIndexChanged: {
91+ onCurrentIndexChanged: positionListView();
92+
93+ function positionListView() {
94+ if (!open) {
95+ return;
96+ }
97+
91 var row = Math.floor(currentIndex / categoryDelegate.columns);
98 var row = Math.floor(currentIndex / categoryDelegate.columns);
92 if (categoryDelegate.collapsedRowCount <= row) {
99 if (categoryDelegate.collapsedRowCount <= row) {
93 categoryView.expandedCategoryId = categoryId
100 categoryView.expandedCategoryId = categoryId
94 }
101 }
95
102
96− if (open) {
97− categoryDelegate.highlightIndex = currentIndex
103+ categoryDelegate.highlightIndex = currentIndex
98− }
99
104
100 if (!init && model !== undefined) {
105 if (!init && model !== undefined) {
101 var item = model.get(currentIndex)
106 var item = model.get(currentIndex)
@@ -136,6 +141,7 @@ Item {
136 onScreen = true;
141 onScreen = true;
137 categoryDelegate.highlightIndex = currentIndex;
142 categoryDelegate.highlightIndex = currentIndex;
138 pageHeader.unfocus();
143 pageHeader.unfocus();
144+ positionListView();
139 } else {
145 } else {
140 // Cancel any pending preview requests or actions
146 // Cancel any pending preview requests or actions
141 if (previewListView.currentItem.previewData !== undefined) {
147 if (previewListView.currentItem.previewData !== undefined) {
qml/Dash/Previews/Preview.qml+1
@@ -71,6 +71,7 @@ Item {
71 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
71 bottomMargin: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
72
72
73 model: previewModel
73 model: previewModel
74+ cacheBuffer: units.gu(40)
74
75
75 Behavior on contentY { UbuntuNumberAnimation { } }
76 Behavior on contentY { UbuntuNumberAnimation { } }
76
77
qml/Dash/Previews/PreviewActionButton.qml+2−2
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19
19
20Button {
20Button {
21− signal triggeredAction(string id)
21+ signal triggeredAction(var actionData)
22
22
23 property var data: null
23 property var data: null
24 objectName: "button" + (data && data.id || "")
24 objectName: "button" + (data && data.id || "")
@@ -26,5 +26,5 @@ Button {
26 text: data && data.label || ""
26 text: data && data.label || ""
27 iconSource: data && data.icon || ""
27 iconSource: data && data.icon || ""
28 iconPosition: "left"
28 iconPosition: "left"
29− onClicked: triggeredAction(data.id)
29+ onClicked: triggeredAction(data)
30}
30}
qml/Dash/Previews/PreviewActionCombo.qml+2−2
@@ -22,7 +22,7 @@ Item {
22
22
23 implicitHeight: childrenRect.height
23 implicitHeight: childrenRect.height
24
24
25− signal triggeredAction(string id)
25+ signal triggeredAction(var actionData)
26
26
27 property alias model: actionRepeater.model
27 property alias model: actionRepeater.model
28
28
@@ -59,7 +59,7 @@ Item {
59 delegate: PreviewActionButton {
59 delegate: PreviewActionButton {
60 data: modelData
60 data: modelData
61 width: implicitWidth < parent.width ? parent.width : implicitWidth
61 width: implicitWidth < parent.width ? parent.width : implicitWidth
62− onClicked: root.triggeredAction(modelData.id)
62+ onClicked: root.triggeredAction(modelData)
63 }
63 }
64 }
64 }
65 }
65 }
qml/Dash/Previews/PreviewActions.qml+2−2
@@ -49,7 +49,7 @@ PreviewWidget {
49 Connections {
49 Connections {
50 target: loader.item
50 target: loader.item
51 onTriggeredAction: {
51 onTriggeredAction: {
52− root.triggered(root.widgetId, id, null);
52+ root.triggered(root.widgetId, actionData.id, actionData);
53 }
53 }
54 }
54 }
55 }
55 }
@@ -57,7 +57,7 @@ PreviewWidget {
57 PreviewActionButton {
57 PreviewActionButton {
58 data: visible ? row.actions[0] : null
58 data: visible ? row.actions[0] : null
59 visible: row.actions && row.actions.length > 0
59 visible: row.actions && row.actions.length > 0
60− onTriggeredAction: root.triggered(root.widgetId, id, null)
60+ onTriggeredAction: root.triggered(root.widgetId, actionData.id, actionData)
61 width: (root.width - units.gu(1)) / 2
61 width: (root.width - units.gu(1)) / 2
62 }
62 }
63 }
63 }
qml/Panel/Indicators.qml+3−1
@@ -31,6 +31,8 @@ Showable {
31 property bool pinnedMode: true //should be set true if indicators menu can cover whole screen
31 property bool pinnedMode: true //should be set true if indicators menu can cover whole screen
32 property alias overFlowWidth: indicatorRow.overFlowWidth
32 property alias overFlowWidth: indicatorRow.overFlowWidth
33 property alias showAll: indicatorRow.showAll
33 property alias showAll: indicatorRow.showAll
34+ // TODO: This should be sourced by device type (eg "desktop", "tablet", "phone"...)
35+ property string profile: "phone"
34
36
35 readonly property real hintValue: panelHeight + menuContent.headerHeight
37 readonly property real hintValue: panelHeight + menuContent.headerHeight
36 readonly property int lockThreshold: openedHeight / 2
38 readonly property int lockThreshold: openedHeight / 2
@@ -429,6 +431,6 @@ Showable {
429
431
430 Component.onCompleted: initialise();
432 Component.onCompleted: initialise();
431 function initialise() {
433 function initialise() {
432− visibleIndicators.load();
434+ visibleIndicators.load(profile);
433 }
435 }
434}
436}
qml/Panel/Indicators/VisibleIndicators.qml+2−2
@@ -78,7 +78,7 @@ Item {
78 }
78 }
79 }
79 }
80
80
81− function load() {
81+ function load(profile) {
82− indicatorsModel.load();
82+ indicatorsModel.load(profile);
83 }
83 }
84}
84}
qml/Panel/Indicators/client/IndicatorsClient.qml+1−2
@@ -33,8 +33,7 @@ Rectangle {
33 function reset() {
33 function reset() {
34 clear();
34 clear();
35 var component = Qt.createComponent("IndicatorsList.qml");
35 var component = Qt.createComponent("IndicatorsList.qml");
36− var page = component.createObject(pages);
36+ var page = component.createObject(pages, {"profile": indicatorProfile});
37− console.log(component.errorString());
38 push(page);
37 push(page);
39 }
38 }
40 }
39 }
qml/Panel/Indicators/client/IndicatorsList.qml+2−1
@@ -26,12 +26,13 @@ import "../.."
26Page {
26Page {
27 id: page
27 id: page
28 anchors.fill: parent
28 anchors.fill: parent
29+ property string profile: ""
29 title: "Plugin list"
30 title: "Plugin list"
30
31
31 Indicators.IndicatorsModel {
32 Indicators.IndicatorsModel {
32 id: indicatorsModel
33 id: indicatorsModel
33
34
34− Component.onCompleted: load()
35+ Component.onCompleted: load(profile)
35 }
36 }
36
37
37 ListView {
38 ListView {
qml/SideStage/SideStage.qml+5
@@ -65,4 +65,9 @@ Stage {
65 Behavior on width { NumberAnimation { easing.type: Easing.OutQuart} }
65 Behavior on width { NumberAnimation { easing.type: Easing.OutQuart} }
66 z: -1
66 z: -1
67 }
67 }
68+
69+ InputFilterArea {
70+ anchors.fill: handle
71+ blockInput: visible
72+ }
68}
73}
src/Panel/Indicators/client/indicatorsclient.cpp+6−1
@@ -41,9 +41,14 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
41 prependImportPaths(m_view->engine(), ::overrideImportPaths());
41 prependImportPaths(m_view->engine(), ::overrideImportPaths());
42 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
42 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
43
43
44+ QString profile = "phone";
45+ if (args.contains(QLatin1String("-profile")) && args.size() > args.indexOf(QLatin1String("-profile")) + 1) {
46+ profile = args.at(args.indexOf(QLatin1String("-profile")) + 1);
47+ }
48+ m_view->rootContext()->setContextProperty("indicatorProfile", profile);
49+
44 m_view->setSource(QUrl("IndicatorsClient.qml"));
50 m_view->setSource(QUrl("IndicatorsClient.qml"));
45 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
51 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
46−
47 if (args.contains(QLatin1String("-geometry")) && args.size() > args.indexOf(QLatin1String("-geometry")) + 1) {
52 if (args.contains(QLatin1String("-geometry")) && args.size() > args.indexOf(QLatin1String("-geometry")) + 1) {
48 QStringList geometryArg = args.at(args.indexOf(QLatin1String("-geometry")) + 1).split('x');
53 QStringList geometryArg = args.at(args.indexOf(QLatin1String("-geometry")) + 1).split('x');
49 if (geometryArg.size() == 2) {
54 if (geometryArg.size() == 2) {
tests/autopilot/unity8/__init__.py+16−12
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -88,28 +88,31 @@ def get_binary_path(binary="unity8"):
88 return binary_path
88 return binary_path
89
89
90
90
91−def get_data_dirs():
91+def get_data_dirs(data_dirs_mock_enabled=True):
92 """Prepend a mock data path to XDG_DATA_DIRS."""
92 """Prepend a mock data path to XDG_DATA_DIRS."""
93+ data_dirs = _get_xdg_env_path()
94+ if data_dirs_mock_enabled:
95+ mock_data_path = _get_full_mock_data_path()
96+ if os.path.exists(mock_data_path):
97+ if data_dirs is not None:
98+ data_dirs = '{0}:{1}'.format(mock_data_path, data_dirs)
99+ else:
100+ data_dirs = mock_data_path
101+ return data_dirs
102+
103+
104+def _get_full_mock_data_path():
93 if running_installed_tests():
105 if running_installed_tests():
94 data_path = "/usr/share/unity8/mocks/data"
106 data_path = "/usr/share/unity8/mocks/data"
95 else:
107 else:
96 data_path = "../../mocks/data"
108 data_path = "../../mocks/data"
97− full_data_path = os.path.abspath(
109+ return os.path.abspath(
98 os.path.join(
110 os.path.join(
99 os.path.dirname(__file__),
111 os.path.dirname(__file__),
100 data_path
112 data_path
101 )
113 )
102 )
114 )
103
115
104− if os.path.exists(full_data_path):
105− xdg_path = _get_xdg_env_path()
106− if xdg_path is not None:
107− return "{0}:{1}".format(full_data_path, xdg_path)
108− else:
109− return full_data_path
110− else:
111− return None
112−
113
116
114def _get_xdg_env_path():
117def _get_xdg_env_path():
115 path = os.getenv("XDG_DATA_DIRS")
118 path = os.getenv("XDG_DATA_DIRS")
@@ -129,6 +132,7 @@ def _get_xdg_upstart_env():
129 except subprocess.CalledProcessError:
132 except subprocess.CalledProcessError:
130 return None
133 return None
131
134
135+
132def get_grid_size():
136def get_grid_size():
133 grid_size = os.getenv('GRID_UNIT_PX')
137 grid_size = os.getenv('GRID_UNIT_PX')
134 if grid_size is None:
138 if grid_size is None:
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+9−13
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2013 Canonical
4+# Copyright (C) 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -44,9 +44,8 @@ class ApplicationLifecycleTests(UnityTestCase):
44 self.skipTest("Test cannot be run on the desktop.")
44 self.skipTest("Test cannot be run on the desktop.")
45
45
46 def swipe_screen_from_right(self):
46 def swipe_screen_from_right(self):
47− qml_view = self.main_window.get_qml_view()
47+ width = self.main_window.width
48− width = qml_view.width
49− height = qml_view.height
48+ height = self.main_window.height
50 start_x = width
49 start_x = width
51 start_y = int(height/2)
50 start_y = int(height/2)
52 end_x = int(width/2)
51 end_x = int(width/2)
@@ -55,9 +54,6 @@ class ApplicationLifecycleTests(UnityTestCase):
55 logger.info("Swiping screen from the right edge")
54 logger.info("Swiping screen from the right edge")
56 self.touch.drag(start_x, start_y, end_x, end_y)
55 self.touch.drag(start_x, start_y, end_x, end_y)
57
56
58− def _get_current_focused_app_id(self):
59− return self._proxy.select_single("Shell").currentFocusedAppId
60−
61 def _launch_app(self, app_name):
57 def _launch_app(self, app_name):
62 """Launches the application *app_name*
58 """Launches the application *app_name*
63
59
@@ -86,7 +82,7 @@ class ApplicationLifecycleTests(UnityTestCase):
86
82
87 self.assertThat(app, NotEquals(None))
83 self.assertThat(app, NotEquals(None))
88 self.assertThat(
84 self.assertThat(
89− self._get_current_focused_app_id(),
85+ self.main_window.get_current_focused_app_id(),
90 Eventually(Equals("messaging-app"))
86 Eventually(Equals("messaging-app"))
91 )
87 )
92
88
@@ -98,13 +94,13 @@ class ApplicationLifecycleTests(UnityTestCase):
98
94
99 self._launch_app("messaging-app")
95 self._launch_app("messaging-app")
100 self.assertThat(
96 self.assertThat(
101− self._get_current_focused_app_id(),
97+ self.main_window.get_current_focused_app_id(),
102 Eventually(Equals("messaging-app"))
98 Eventually(Equals("messaging-app"))
103 )
99 )
104
100
105 self._launch_app("address-book-app")
101 self._launch_app("address-book-app")
106 self.assertThat(
102 self.assertThat(
107− self._get_current_focused_app_id(),
103+ self.main_window.get_current_focused_app_id(),
108 Eventually(Equals("address-book-app"))
104 Eventually(Equals("address-book-app"))
109 )
105 )
110
106
@@ -119,19 +115,19 @@ class ApplicationLifecycleTests(UnityTestCase):
119
115
120 self._launch_app("messaging-app")
116 self._launch_app("messaging-app")
121 self.assertThat(
117 self.assertThat(
122− self._get_current_focused_app_id(),
118+ self.main_window.get_current_focused_app_id(),
123 Eventually(Equals("messaging-app"))
119 Eventually(Equals("messaging-app"))
124 )
120 )
125
121
126 self._launch_app("address-book-app")
122 self._launch_app("address-book-app")
127 self.assertThat(
123 self.assertThat(
128− self._get_current_focused_app_id(),
124+ self.main_window.get_current_focused_app_id(),
129 Eventually(Equals("address-book-app"))
125 Eventually(Equals("address-book-app"))
130 )
126 )
131
127
132 self.swipe_screen_from_right()
128 self.swipe_screen_from_right()
133
129
134 self.assertThat(
130 self.assertThat(
135− self._get_current_focused_app_id(),
131+ self.main_window.get_current_focused_app_id(),
136 Eventually(Equals("messaging-app"))
132 Eventually(Equals("messaging-app"))
137 )
133 )
tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.pynew file+116
@@ -0,0 +1,116 @@
1+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2+#
3+# Unity Autopilot Test Suite
4+# Copyright (C) 2014 Canonical
5+#
6+# This program is free software: you can redistribute it and/or modify
7+# it under the terms of the GNU General Public License as published by
8+# the Free Software Foundation, either version 3 of the License, or
9+# (at your option) any later version.
10+#
11+# This program is distributed in the hope that it will be useful,
12+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+# GNU General Public License for more details.
15+#
16+# You should have received a copy of the GNU General Public License
17+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#
19+
20+"""Test the integration with the URL dispatcher service."""
21+
22+import os
23+import tempfile
24+
25+from autopilot import platform
26+from autopilot.matchers import Eventually
27+from testtools.matchers import Equals
28+from ubuntuuitoolkit import base as toolkit_base
29+
30+from unity8 import process_helpers
31+from unity8.shell import tests
32+
33+
34+class URLDispatcherTestCase(tests.UnityTestCase):
35+
36+ scenarios = tests._get_device_emulation_scenarios()
37+
38+ test_qml = ("""
39+import QtQuick 2.0
40+import Ubuntu.Components 0.1
41+
42+MainView {
43+ width: units.gu(48)
44+ height: units.gu(60)
45+
46+ Label {
47+ text: 'Test application.'
48+ }
49+}
50+""")
51+
52+ desktop_file_contents = ("""[Desktop Entry]
53+Type=Application
54+Name=test
55+Exec={qmlscene} {qml_file_path}
56+Icon=Not important
57+""")
58+
59+ def setUp(self):
60+ if platform.model() == 'Desktop':
61+ self.skipTest("URL dispatcher doesn't work on the desktop.")
62+ super(URLDispatcherTestCase, self).setUp()
63+ self._qml_mock_enabled = False
64+ self._data_dirs_mock_enabled = False
65+ unity_proxy = self.launch_unity()
66+ process_helpers.unlock_unity(unity_proxy)
67+
68+ def create_test_application(self):
69+ # FIXME most of this code is duplicated in the toolkit. We should
70+ # create a fixture on the toolkit for other projects to use.
71+ # http://pad.lv/1277334 --elopio - 2014-02-06
72+ qml_file_path = self._write_test_qml_file()
73+ self.addCleanup(os.remove, qml_file_path)
74+ desktop_file_path = self._write_test_desktop_file(qml_file_path)
75+ self.addCleanup(os.remove, desktop_file_path)
76+ return qml_file_path, desktop_file_path
77+
78+ def _write_test_qml_file(self):
79+ qml_file = tempfile.NamedTemporaryFile(suffix='.qml', delete=False)
80+ qml_file.write(self.test_qml.encode('utf-8'))
81+ qml_file.close()
82+ return qml_file.name
83+
84+ def _write_test_desktop_file(self, qml_file_path):
85+ desktop_file_dir = self._get_local_desktop_file_directory()
86+ if not os.path.exists(desktop_file_dir):
87+ os.makedirs(desktop_file_dir)
88+ desktop_file = tempfile.NamedTemporaryFile(
89+ suffix='.desktop', dir=desktop_file_dir, delete=False)
90+ contents = self.desktop_file_contents.format(
91+ qmlscene=toolkit_base.get_qmlscene_launch_command(),
92+ qml_file_path=qml_file_path)
93+ desktop_file.write(contents.encode('utf-8'))
94+ desktop_file.close()
95+ return desktop_file.name
96+
97+ def _get_local_desktop_file_directory(self):
98+ return os.path.join(
99+ os.environ.get('HOME'), '.local', 'share', 'applications')
100+
101+ def test_swipe_out_application_started_by_url_dispatcher(self):
102+ _, desktop_file_path = self.create_test_application()
103+ desktop_file_name = os.path.basename(desktop_file_path)
104+ application_name, _ = os.path.splitext(desktop_file_name)
105+
106+ self.assertEqual('', self.main_window.get_current_focused_app_id())
107+ self.addCleanup(os.system, 'pkill qmlscene')
108+ os.system('url-dispatcher application:///{}'.format(desktop_file_name))
109+ self.assertThat(
110+ self.main_window.get_current_focused_app_id,
111+ Eventually(Equals(application_name)))
112+
113+ self.main_window.show_dash_swiping()
114+ self.assertThat(
115+ self.main_window.get_current_focused_app_id,
116+ Eventually(Equals('')))
tests/autopilot/unity8/process_helpers.py+9−7
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Utilities
3# Unity Autopilot Utilities
4−# Copyright (C) 2013 Canonical
4+# Copyright (C) 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -23,8 +23,8 @@ from autopilot.introspection import (
23)
23)
24import logging
24import logging
25import subprocess
25import subprocess
26−from unity8.shell.emulators import UnityEmulatorBase
26+from unity8.shell import emulators
27−from unity8.shell.emulators.main_window import MainWindow
27+from unity8.shell.emulators import main_window as main_window_emulator
28
28
29logger = logging.getLogger(__name__)
29logger = logging.getLogger(__name__)
30
30
@@ -54,7 +54,7 @@ def unlock_unity(unity_proxy_obj=None):
54 try:
54 try:
55 pid = _get_unity_pid()
55 pid = _get_unity_pid()
56 unity = _get_unity_proxy_object(pid)
56 unity = _get_unity_proxy_object(pid)
57− main_window = MainWindow(unity)
57+ main_window = unity.select_single(main_window_emulator.QQuickView)
58 except ProcessSearchError as e:
58 except ProcessSearchError as e:
59 raise CannotAccessUnity(
59 raise CannotAccessUnity(
60 "Cannot introspect unity, make sure that it has been started "
60 "Cannot introspect unity, make sure that it has been started "
@@ -64,7 +64,8 @@ def unlock_unity(unity_proxy_obj=None):
64 % str(e)
64 % str(e)
65 )
65 )
66 else:
66 else:
67− main_window = MainWindow(unity_proxy_obj)
67+ main_window = unity_proxy_obj.select_single(
68+ main_window_emulator.QQuickView)
68
69
69 greeter = main_window.get_greeter()
70 greeter = main_window.get_greeter()
70 if greeter.created == False:
71 if greeter.created == False:
@@ -110,7 +111,8 @@ def restart_unity(*args):
110 status = _get_unity_status()
111 status = _get_unity_status()
111 if "start/" in status:
112 if "start/" in status:
112 try:
113 try:
113− output = subprocess.check_output(['/sbin/initctl', 'stop', 'unity8'])
114+ output = subprocess.check_output(
115+ ['/sbin/initctl', 'stop', 'unity8'])
114 logger.info(output)
116 logger.info(output)
115 except subprocess.CalledProcessError as e:
117 except subprocess.CalledProcessError as e:
116 e.args += (
118 e.args += (
@@ -155,5 +157,5 @@ def _get_unity_pid():
155def _get_unity_proxy_object(pid):
157def _get_unity_proxy_object(pid):
156 return get_proxy_object_for_existing_process(
158 return get_proxy_object_for_existing_process(
157 pid=pid,
159 pid=pid,
158− emulator_base=UnityEmulatorBase,
160+ emulator_base=emulators.UnityEmulatorBase,
159 )
161 )
tests/autopilot/unity8/shell/emulators/dash.py+1−1
@@ -94,9 +94,9 @@ class Dash(emulators.UnityEmulatorBase):
94
94
95 while not scope_loader.isCurrent:
95 while not scope_loader.isCurrent:
96 scroll()
96 scroll()
97+ self.dash_content_list.moving.wait_for(False)
97
98
98 scope = self._get_scope_from_loader(scope_loader)
99 scope = self._get_scope_from_loader(scope_loader)
99− scope.moving.wait_for(False)
100 scope.isCurrent.wait_for(True)
100 scope.isCurrent.wait_for(True)
101 return scope
101 return scope
102
102
tests/autopilot/unity8/shell/emulators/main_window.py+45−27
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -17,85 +17,103 @@
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
18#
19
19
20+import logging
20
21
22+from autopilot import logging as autopilot_logging
23+
24+from unity8.shell import emulators
21from unity8.shell.emulators.greeter import Greeter
25from unity8.shell.emulators.greeter import Greeter
22from unity8.shell.emulators.hud import Hud
26from unity8.shell.emulators.hud import Hud
23from unity8.shell.emulators.dash import Dash
27from unity8.shell.emulators.dash import Dash
24from unity8.shell.emulators.launcher import Launcher
28from unity8.shell.emulators.launcher import Launcher
25
29
30+logger = logging.getLogger(__name__)
26
31
27−class MainWindow(object):
28− """An emulator class that makes it easy to interact with the shell"""
29−
30− def __init__(self, app):
31− self.app = app
32
32
33− def get_qml_view(self):
33+class QQuickView(emulators.UnityEmulatorBase):
34− """Get the main QML view"""
34+ """An emulator class that makes it easy to interact with the shell"""
35− return self.app.select_single("QQuickView")
36
35
37 def get_greeter(self):
36 def get_greeter(self):
38− return self.app.select_single(Greeter)
37+ return self.select_single(Greeter)
39
38
40 def get_greeter_content_loader(self):
39 def get_greeter_content_loader(self):
41− return self.app.wait_select_single(
40+ return self.wait_select_single(
42 "QQuickLoader",
41 "QQuickLoader",
43 objectName="greeterContentLoader"
42 objectName="greeterContentLoader"
44 )
43 )
45
44
46 def get_greeter_background(self):
45 def get_greeter_background(self):
46+ return self.select_single(
47− return self.app.select_single("CrossFadeImage", objectName="greeterBackground")
47+ "CrossFadeImage", objectName="greeterBackground")
48
48
49 def get_login_loader(self):
49 def get_login_loader(self):
50− return self.app.select_single("QQuickLoader", objectName="loginLoader")
50+ return self.select_single("QQuickLoader", objectName="loginLoader")
51
51
52 def get_login_list(self):
52 def get_login_list(self):
53− return self.app.select_single("LoginList")
53+ return self.select_single("LoginList")
54
54
55 def get_hud(self):
55 def get_hud(self):
56− return self.app.select_single(Hud)
56+ return self.select_single(Hud)
57
57
58 def get_hud_showable(self):
58 def get_hud_showable(self):
59− return self.app.select_single("Showable", objectName="hudShowable")
59+ return self.select_single("Showable", objectName="hudShowable")
60
60
61 def get_hud_show_button(self):
61 def get_hud_show_button(self):
62− return self.app.select_single("HudButton")
62+ return self.select_single("HudButton")
63
63
64 def get_hud_edge_drag_area(self):
64 def get_hud_edge_drag_area(self):
65− return self.app.select_single(objectName="hudDragArea")
65+ return self.select_single(objectName="hudDragArea")
66
66
67 def get_dash(self):
67 def get_dash(self):
68− return self.app.select_single(Dash)
68+ return self.select_single(Dash)
69
69
70 def get_bottombar(self):
70 def get_bottombar(self):
71− return self.app.select_single("Bottombar")
71+ return self.select_single("Bottombar")
72
72
73 def get_launcher(self):
73 def get_launcher(self):
74− return self.app.select_single(Launcher)
74+ return self.select_single(Launcher)
75
75
76 def get_pinPadLoader(self):
76 def get_pinPadLoader(self):
77− return self.app.select_single(
77+ return self.select_single(
78 "QQuickLoader",
78 "QQuickLoader",
79 objectName="pinPadLoader"
79 objectName="pinPadLoader"
80 )
80 )
81
81
82 def get_pinPadButton(self, buttonId):
82 def get_pinPadButton(self, buttonId):
83− return self.app.select_single(
83+ return self.select_single(
84 "PinPadButton",
84 "PinPadButton",
85 objectName="pinPadButton%i" % buttonId
85 objectName="pinPadButton%i" % buttonId
86 )
86 )
87
87
88 def get_lockscreen(self):
88 def get_lockscreen(self):
89− return self.app.select_single("Lockscreen")
89+ return self.select_single("Lockscreen")
90
90
91 def get_pinentryField(self):
91 def get_pinentryField(self):
92− return self.app.select_single(objectName="pinentryField")
92+ return self.select_single(objectName="pinentryField")
93
93
94 def get_indicator(self, indicator_name):
94 def get_indicator(self, indicator_name):
95− return self.app.wait_select_single(
95+ return self.wait_select_single(
96 'DefaultIndicatorWidget',
96 'DefaultIndicatorWidget',
97 objectName=indicator_name+'-widget'
97 objectName=indicator_name+'-widget'
98 )
98 )
99
99
100 def get_shell_background(self):
100 def get_shell_background(self):
101+ return self.select_single(
101− return self.app.select_single("CrossFadeImage", objectName="backgroundImage")
102+ "CrossFadeImage", objectName="backgroundImage")
103+
104+ @autopilot_logging.log_action(logger.info)
105+ def show_dash_swiping(self):
106+ """Show the dash swiping from the left."""
107+ width = self.width
108+ height = self.height
109+ start_x = 0
110+ start_y = height // 2
111+ end_x = width
112+ end_y = start_y
113+
114+ self.pointing_device.drag(start_x, start_y, end_x, end_y)
115+ return self.get_dash()
116+
117+ def get_current_focused_app_id(self):
118+ """Return the id of the focused application."""
119+ return self.select_single('Shell').currentFocusedAppId
tests/autopilot/unity8/shell/tests/__init__.py+8−6
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -43,8 +43,8 @@ from unity8 import (
43 get_data_dirs
43 get_data_dirs
44)
44)
45from unity8.process_helpers import restart_unity_with_testability
45from unity8.process_helpers import restart_unity_with_testability
46+from unity8.shell.emulators import main_window as main_window_emulator
46from unity8.shell.emulators.dash import Dash
47from unity8.shell.emulators.dash import Dash
47−from unity8.shell.emulators.main_window import MainWindow
48
48
49
49
50logger = logging.getLogger(__name__)
50logger = logging.getLogger(__name__)
@@ -139,10 +139,9 @@ class UnityTestCase(AutopilotTestCase):
139 self._proxy = None
139 self._proxy = None
140 self._lightdm_mock_type = None
140 self._lightdm_mock_type = None
141 self._qml_mock_enabled = True
141 self._qml_mock_enabled = True
142+ self._data_dirs_mock_enabled = True
142 self._environment = {}
143 self._environment = {}
143
144
144− self._patch_data_dirs()
145−
146 #### FIXME: This is a work around re: lp:1238417 ####
145 #### FIXME: This is a work around re: lp:1238417 ####
147 if model() != "Desktop":
146 if model() != "Desktop":
148 from autopilot.input import _uinput
147 from autopilot.input import _uinput
@@ -268,6 +267,9 @@ class UnityTestCase(AutopilotTestCase):
268 if self._qml_mock_enabled:
267 if self._qml_mock_enabled:
269 self._setup_extra_mock_environment_patch()
268 self._setup_extra_mock_environment_patch()
270
269
270+ if self._data_dirs_mock_enabled:
271+ self._patch_data_dirs()
272+
271 # FIXME: we shouldn't be doing this
273 # FIXME: we shouldn't be doing this
272 # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
274 # $MIR_SOCKET, fallback to $XDG_RUNTIME_DIR/mir_socket and
273 # /tmp/mir_socket as last resort
275 # /tmp/mir_socket as last resort
@@ -321,7 +323,7 @@ class UnityTestCase(AutopilotTestCase):
321 logger.warning("Appears unity was already stopped!")
323 logger.warning("Appears unity was already stopped!")
322
324
323 def _patch_data_dirs(self):
325 def _patch_data_dirs(self):
324− data_dirs = get_data_dirs()
326+ data_dirs = get_data_dirs(self._data_dirs_mock_enabled)
325 if data_dirs is not None:
327 if data_dirs is not None:
326 self._environment['XDG_DATA_DIRS'] = data_dirs
328 self._environment['XDG_DATA_DIRS'] = data_dirs
327
329
@@ -391,4 +393,4 @@ class UnityTestCase(AutopilotTestCase):
391
393
392 @property
394 @property
393 def main_window(self):
395 def main_window(self):
394− return MainWindow(self._proxy)
396+ return self._proxy.select_single(main_window_emulator.QQuickView)
tests/autopilot/unity8/shell/tests/test_hud.py+4−7
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -41,7 +41,6 @@ class TestHud(UnityTestCase, DragMixin):
41 """
41 """
42 unity_proxy = self.launch_unity()
42 unity_proxy = self.launch_unity()
43 unlock_unity(unity_proxy)
43 unlock_unity(unity_proxy)
44− window = self.main_window.get_qml_view()
45 hud_show_button = self.main_window.get_hud_show_button()
44 hud_show_button = self.main_window.get_hud_show_button()
46 edge_drag_area = self.main_window.get_hud_edge_drag_area()
45 edge_drag_area = self.main_window.get_hud_edge_drag_area()
47 hud = self.main_window.get_hud()
46 hud = self.main_window.get_hud()
@@ -49,7 +48,7 @@ class TestHud(UnityTestCase, DragMixin):
49 self._launch_test_app_from_app_screen()
48 self._launch_test_app_from_app_screen()
50
49
51 swipe_coords = hud.get_button_swipe_coords(
50 swipe_coords = hud.get_button_swipe_coords(
52− window,
51+ self.main_window,
53 hud_show_button
52 hud_show_button
54 )
53 )
55 initialBottomMargin = int(hud_show_button.bottomMargin)
54 initialBottomMargin = int(hud_show_button.bottomMargin)
@@ -83,14 +82,13 @@ class TestHud(UnityTestCase, DragMixin):
83 """
82 """
84 unity_proxy = self.launch_unity()
83 unity_proxy = self.launch_unity()
85 unlock_unity(unity_proxy)
84 unlock_unity(unity_proxy)
86− window = self.main_window.get_qml_view()
87 hud_show_button = self.main_window.get_hud_show_button()
85 hud_show_button = self.main_window.get_hud_show_button()
88 hud = self.main_window.get_hud()
86 hud = self.main_window.get_hud()
89
87
90 self._launch_test_app_from_app_screen()
88 self._launch_test_app_from_app_screen()
91
89
92 swipe_coords = hud.get_button_swipe_coords(
90 swipe_coords = hud.get_button_swipe_coords(
93− window,
91+ self.main_window,
94 hud_show_button
92 hud_show_button
95 )
93 )
96
94
@@ -137,7 +135,6 @@ class TestHud(UnityTestCase, DragMixin):
137 """
135 """
138 unity_proxy = self.launch_unity()
136 unity_proxy = self.launch_unity()
139 unlock_unity(unity_proxy)
137 unlock_unity(unity_proxy)
140− window = self.main_window.get_qml_view()
141 hud = self.main_window.get_hud()
138 hud = self.main_window.get_hud()
142
139
143 self._launch_test_app_from_app_screen()
140 self._launch_test_app_from_app_screen()
@@ -146,7 +143,7 @@ class TestHud(UnityTestCase, DragMixin):
146
143
147 start_x, start_y = hud.get_close_button_coords()
144 start_x, start_y = hud.get_close_button_coords()
148 end_x = start_x
145 end_x = start_x
149− end_y = int(window.height / 2)
146+ end_y = int(self.main_window.height / 2)
150
147
151 self.touch.drag(start_x, start_y, end_x, end_y)
148 self.touch.drag(start_x, start_y, end_x, end_y)
152 self.assertThat(hud.shown, Eventually(Equals(False)))
149 self.assertThat(hud.shown, Eventually(Equals(False)))
tests/autopilot/unity8/shell/tests/test_notifications.py+2−3
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -61,8 +61,7 @@ class NotificationsBase(UnityTestCase):
61 return os.path.dirname(__file__) + "/../../../../../qml/graphics/" + icon_name
61 return os.path.dirname(__file__) + "/../../../../../qml/graphics/" + icon_name
62
62
63 def _get_notifications_list(self):
63 def _get_notifications_list(self):
64− main_view = self.main_window.get_qml_view()
64+ return self.main_window.select_single(
65− return main_view.select_single(
66 "Notifications",
65 "Notifications",
67 objectName='notificationList'
66 objectName='notificationList'
68 )
67 )
tests/data/unity/indicators/com.canonical.indicator.fake1+4−4
@@ -3,8 +3,8 @@ Name=indicator-fake1
3ObjectPath=/com/canonical/indicator/fake1
3ObjectPath=/com/canonical/indicator/fake1
4Position=1
4Position=1
5
5
6−[phone]
6+[test1]
7−ObjectPath=/com/canonical/indicator/fake1/phone
7+ObjectPath=/com/canonical/indicator/fake1/test1
8
8
9−[desktop]
9+[test2]
10−ObjectPath=/com/canonical/indicator/fake1/desktop
10+ObjectPath=/com/canonical/indicator/fake1/test2
tests/data/unity/indicators/com.canonical.indicator.fake2+4−4
@@ -3,8 +3,8 @@ Name=indicator-fake2
3ObjectPath=/com/canonical/indicator/fake2
3ObjectPath=/com/canonical/indicator/fake2
4Position=0
4Position=0
5
5
6−[phone]
6+[test1]
7−ObjectPath=/com/canonical/indicator/fake2/phone
7+ObjectPath=/com/canonical/indicator/fake2/test1
8
8
9−[desktop]
9+[test2]
10−ObjectPath=/com/canonical/indicator/fake2/desktop
10+ObjectPath=/com/canonical/indicator/fake2/test2
tests/data/unity/indicators/com.canonical.indicator.fake3+4−4
@@ -3,8 +3,8 @@ Name=indicator-fake3
3ObjectPath=/com/canonical/indicator/fake3
3ObjectPath=/com/canonical/indicator/fake3
4Position=3
4Position=3
5
5
6−[phone]
6+[test1]
7−ObjectPath=/com/canonical/indicator/fake3/phone
7+ObjectPath=/com/canonical/indicator/fake3/test1
8
8
9−[desktop]
9+[test2]
10−ObjectPath=/com/canonical/indicator/fake3/desktop
10+ObjectPath=/com/canonical/indicator/fake3/test2
tests/data/unity/indicators/com.canonical.indicator.fake4+4−4
@@ -3,8 +3,8 @@ Name=indicator-fake4
3ObjectPath=/com/canonical/indicator/fake4
3ObjectPath=/com/canonical/indicator/fake4
4Position=2
4Position=2
5
5
6−[phone]
6+[test1]
7−ObjectPath=/com/canonical/indicator/fake4/phone
7+ObjectPath=/com/canonical/indicator/fake4/test1
8
8
9−[desktop]
9+[test2]
10−ObjectPath=/com/canonical/indicator/fake4/desktop
10+ObjectPath=/com/canonical/indicator/fake4/test2
tests/mocks/Unity/fake_scope.cpp+4−4
@@ -36,9 +36,9 @@ Scope::Scope(QString const& id, QString const& name, bool visible, QObject* pare
36 , m_visible(visible)
36 , m_visible(visible)
37 , m_searching(false)
37 , m_searching(false)
38 , m_isActive(false)
38 , m_isActive(false)
39+ , m_previewRendererName("preview-generic")
39 , m_categories(new Categories(this))
40 , m_categories(new Categories(this))
40 , m_results(new DeeListModel(this))
41 , m_results(new DeeListModel(this))
41− , m_previewRendererName("preview-generic")
42{
42{
43 DeeModel* results_model = create_results_model(20, 300);
43 DeeModel* results_model = create_results_model(20, 300);
44 m_categories->setResultModel(results_model);
44 m_categories->setResultModel(results_model);
@@ -155,7 +155,6 @@ void Scope::activate(const QVariant &uri, const QVariant &icon_hint, const QVari
155 const QVariant &result_type, const QVariant &mimetype, const QVariant &title,
155 const QVariant &result_type, const QVariant &mimetype, const QVariant &title,
156 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
156 const QVariant &comment, const QVariant &dnd_uri, const QVariant &metadata)
157{
157{
158− Q_UNUSED(uri);
159 Q_UNUSED(icon_hint);
158 Q_UNUSED(icon_hint);
160 Q_UNUSED(category);
159 Q_UNUSED(category);
161 Q_UNUSED(result_type);
160 Q_UNUSED(result_type);
@@ -165,7 +164,8 @@ void Scope::activate(const QVariant &uri, const QVariant &icon_hint, const QVari
165 Q_UNUSED(dnd_uri);
164 Q_UNUSED(dnd_uri);
166 Q_UNUSED(metadata);
165 Q_UNUSED(metadata);
167
166
167+ if (uri != "uri://result.2")
168− m_timer.start();
168+ m_timer.start();
169}
169}
170
170
171void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
171void Scope::preview(const QVariant &uri, const QVariant &icon_hint, const QVariant &category,
@@ -202,7 +202,7 @@ DeeModel* create_categories_model(unsigned category_count) {
202 for(unsigned i = 0; i < category_count; ++i)
202 for(unsigned i = 0; i < category_count; ++i)
203 {
203 {
204 dee_model_append(category_model,
204 dee_model_append(category_model,
205− std::to_string(i).c_str(),
205+ (i == 2) ? "applications.scope" : std::to_string(i).c_str(),
206 ("Category "+std::to_string(i)).c_str(),
206 ("Category "+std::to_string(i)).c_str(),
207 "gtk-apply",
207 "gtk-apply",
208 i % 2 == 0 ? "grid" : "carousel",
208 i % 2 == 0 ? "grid" : "carousel",
tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp+29−6
@@ -50,7 +50,7 @@ private Q_SLOTS:
50 QVERIFY(!manager.isLoaded());
50 QVERIFY(!manager.isLoaded());
51 QCOMPARE(manager.indicators().count(), 0);
51 QCOMPARE(manager.indicators().count(), 0);
52
52
53− manager.load();
53+ manager.load("test1");
54
54
55 QVERIFY(manager.isLoaded());
55 QVERIFY(manager.isLoaded());
56 QCOMPARE(manager.indicators().count(), 4);
56 QCOMPARE(manager.indicators().count(), 4);
@@ -64,10 +64,10 @@ private Q_SLOTS:
64 /*
64 /*
65 * Test the creation & initialising of the indicator data
65 * Test the creation & initialising of the indicator data
66 */
66 */
67− void testPluginInterface()
67+ void testPluginInterfaceProfile1()
68 {
68 {
69 IndicatorsManager manager;
69 IndicatorsManager manager;
70− manager.load();
70+ manager.load("test1");
71
71
72 Indicator::Ptr indicator = manager.indicator("indicator-fake1");
72 Indicator::Ptr indicator = manager.indicator("indicator-fake1");
73 QVERIFY(indicator ? true : false);
73 QVERIFY(indicator ? true : false);
@@ -81,7 +81,30 @@ private Q_SLOTS:
81 QCOMPARE(props["busName"].toString(), QString("com.canonical.indicator.fake1"));
81 QCOMPARE(props["busName"].toString(), QString("com.canonical.indicator.fake1"));
82 QCOMPARE(props["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
82 QCOMPARE(props["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
83
83
84− QCOMPARE(props["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake1/phone"));
84+ QCOMPARE(props["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake1/test1"));
85+ }
86+
87+ /*
88+ * Test the creation & initialising of the indicator data
89+ */
90+ void testPluginInterfaceProfile2()
91+ {
92+ IndicatorsManager manager;
93+ manager.load("test2");
94+
95+ Indicator::Ptr indicator = manager.indicator("indicator-fake1");
96+ QVERIFY(indicator ? true : false);
97+
98+ QCOMPARE(indicator->identifier(), QString("indicator-fake1"));
99+ QCOMPARE(indicator->position(), 1);
100+
101+ // Check that the initial properties have been set.
102+ QVariantMap props = indicator->indicatorProperties().toMap();
103+ QCOMPARE(props.count(), 4);
104+ QCOMPARE(props["busName"].toString(), QString("com.canonical.indicator.fake1"));
105+ QCOMPARE(props["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
106+
107+ QCOMPARE(props["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake1/test2"));
85 }
108 }
86
109
87 /*
110 /*
@@ -90,7 +113,7 @@ private Q_SLOTS:
90 void testPluginInstance()
113 void testPluginInstance()
91 {
114 {
92 IndicatorsManager manager;
115 IndicatorsManager manager;
93− manager.load();
116+ manager.load("test2");
94
117
95 Indicator::Ptr i0 = manager.indicator("indicator-fake1");
118 Indicator::Ptr i0 = manager.indicator("indicator-fake1");
96 Indicator::Ptr i1 = manager.indicator("indicator-fake1");
119 Indicator::Ptr i1 = manager.indicator("indicator-fake1");
@@ -110,7 +133,7 @@ private Q_SLOTS:
110 void testPluginInitAndShutdown()
133 void testPluginInitAndShutdown()
111 {
134 {
112 IndicatorsManager manager;
135 IndicatorsManager manager;
113− manager.load();
136+ manager.load("test1");
114
137
115 QWeakPointer<Indicator> wp0;
138 QWeakPointer<Indicator> wp0;
116 QWeakPointer<Indicator> wp1;
139 QWeakPointer<Indicator> wp1;
tests/plugins/Unity/Indicators/indicatorsmodeltest.cpp+49−4
@@ -50,7 +50,7 @@ private Q_SLOTS:
50
50
51 QCOMPARE(model.property("count").toInt(), 0);
51 QCOMPARE(model.property("count").toInt(), 0);
52
52
53− model.load();
53+ model.load("test1");
54
54
55 QCOMPARE(model.property("count").toInt(), 4);
55 QCOMPARE(model.property("count").toInt(), 4);
56
56
@@ -61,13 +61,13 @@ private Q_SLOTS:
61 }
61 }
62
62
63 /*
63 /*
64− * Testa that the plugin data was loaded correctly
64+ * Testa that the plugin data was loaded correctly ( "test1" )
65 */
65 */
66− void testDataAndOrder()
66+ void testDataAndOrderProfile1()
67 {
67 {
68 // Priority order. (2, 1, 4, 3)
68 // Priority order. (2, 1, 4, 3)
69 IndicatorsModel model;
69 IndicatorsModel model;
70− model.load();
70+ model.load("test1");
71
71
72 // should be in order:
72 // should be in order:
73 // fake3, fake4, fake1, fake2
73 // fake3, fake4, fake1, fake2
@@ -75,18 +75,63 @@ private Q_SLOTS:
75 QCOMPARE(model.data(0, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake3"));
75 QCOMPARE(model.data(0, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake3"));
76 QCOMPARE(model.data(0, IndicatorsModelRole::Position).toInt(), 3);
76 QCOMPARE(model.data(0, IndicatorsModelRole::Position).toInt(), 3);
77 QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
77 QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
78+ QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake3"));
79+ QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake3/test1"));
78
80
79 QCOMPARE(model.data(1, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake4"));
81 QCOMPARE(model.data(1, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake4"));
80 QCOMPARE(model.data(1, IndicatorsModelRole::Position).toInt(), 2);
82 QCOMPARE(model.data(1, IndicatorsModelRole::Position).toInt(), 2);
81 QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
83 QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
84+ QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake4"));
85+ QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake4/test1"));
82
86
83 QCOMPARE(model.data(2, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake1"));
87 QCOMPARE(model.data(2, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake1"));
84 QCOMPARE(model.data(2, IndicatorsModelRole::Position).toInt(), 1);
88 QCOMPARE(model.data(2, IndicatorsModelRole::Position).toInt(), 1);
85 QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake1"));
89 QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake1"));
90+ QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
91+ QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake1/test1"));
86
92
87 QCOMPARE(model.data(3, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake2"));
93 QCOMPARE(model.data(3, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake2"));
88 QCOMPARE(model.data(3, IndicatorsModelRole::Position).toInt(), 0);
94 QCOMPARE(model.data(3, IndicatorsModelRole::Position).toInt(), 0);
89 QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake2"));
95 QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake2"));
96+ QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake2"));
97+ QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake2/test1"));
98+ }
99+
100+ /*
101+ * Testa that the plugin data was loaded correctly ( "test2" )
102+ */
103+ void testDataAndOrderProfile2()
104+ {
105+ // Priority order. (2, 1, 4, 3)
106+ IndicatorsModel model;
107+ model.load("test2");
108+
109+ // should be in order:
110+ // fake3, fake4, fake1, fake2
111+
112+ QCOMPARE(model.data(0, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake3"));
113+ QCOMPARE(model.data(0, IndicatorsModelRole::Position).toInt(), 3);
114+ QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
115+ QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake3"));
116+ QCOMPARE(model.data(0, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake3/test2"));
117+
118+ QCOMPARE(model.data(1, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake4"));
119+ QCOMPARE(model.data(1, IndicatorsModelRole::Position).toInt(), 2);
120+ QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
121+ QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake4"));
122+ QCOMPARE(model.data(1, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake4/test2"));
123+
124+ QCOMPARE(model.data(2, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake1"));
125+ QCOMPARE(model.data(2, IndicatorsModelRole::Position).toInt(), 1);
126+ QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake1"));
127+ QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake1"));
128+ QCOMPARE(model.data(2, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake1/test2"));
129+
130+ QCOMPARE(model.data(3, IndicatorsModelRole::Identifier).toString(), QString("indicator-fake2"));
131+ QCOMPARE(model.data(3, IndicatorsModelRole::Position).toInt(), 0);
132+ QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["busName"].toString(), QString("com.canonical.indicator.fake2"));
133+ QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["actionsObjectPath"].toString(), QString("/com/canonical/indicator/fake2"));
134+ QCOMPARE(model.data(3, IndicatorsModelRole::IndicatorProperties).toMap()["menuObjectPath"].toString(), QString("/com/canonical/indicator/fake2/test2"));
90 }
135 }
91};
136};
92
137
tests/qmltests/Dash/Previews/tst_Preview.qml+14−6
@@ -87,21 +87,29 @@ Rectangle {
87
87
88 function test_containOnFocus() {
88 function test_containOnFocus() {
89 waitForRendering(preview);
89 waitForRendering(preview);
90+ tryCompareFunction(function () { return findChild(preview, "widget-9") != null }, true);
90− var widget = findChild(preview, "widget-13");
91+ var widget = findChild(preview, "widget-9");
91−
92− widget.forceActiveFocus();
93
92
94 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
93 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
94+ verify(bottomLeft.y > preview.height);
95
95
96+ widget.forceActiveFocus();
97+
98+ tryCompareFunction(function () {
99+ var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
96− tryCompareFunction(function () { return bottomLeft.y <= preview.height }, true);
100+ return bottomLeft.y <= preview.height
101+ }, true);
97 }
102 }
98
103
99 function test_containOnGrow() {
104 function test_containOnGrow() {
100 waitForRendering(preview);
105 waitForRendering(preview);
106+ tryCompareFunction(function () { return findChild(preview, "widget-13") != null }, true);
101 var widget = findChild(preview, "widget-13");
107 var widget = findChild(preview, "widget-13");
102
108
103− widget.forceActiveFocus();
109+ var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
104− widget.height += 200;
110+ verify(bottomLeft.y > preview.height);
111+
112+ root.height += units.gu(50);
105
113
106 tryCompareFunction(function () {
114 tryCompareFunction(function () {
107 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
115 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
tests/qmltests/Dash/tst_Card.qml+1
@@ -85,6 +85,7 @@ Rectangle {
85 id: cardTool
85 id: cardTool
86 template: card.template
86 template: card.template
87 components: card.components
87 components: card.components
88+ viewWidth: units.gu(48)
88 }
89 }
89
90
90 Card {
91 Card {
tests/qmltests/Dash/tst_DashContent.qml+2
@@ -250,6 +250,8 @@ Item {
250 function test_scope_mapping(data) {
250 function test_scope_mapping(data) {
251 dashContent.setCurrentScopeAtIndex(data.index, true, false);
251 dashContent.setCurrentScopeAtIndex(data.index, true, false);
252 tryCompareFunction(get_current_item_object_name, data.objectName)
252 tryCompareFunction(get_current_item_object_name, data.objectName)
253+ var pageHeader = findChild(dashContent, "pageHeader");
254+ compare(pageHeader.scope, scopesModel.get(data.index));
253 }
255 }
254
256
255 function test_is_active_data() {
257 function test_is_active_data() {
tests/qmltests/Dash/tst_GenericScopeView.qml+66−29
@@ -32,7 +32,7 @@ Item {
32 id: scopes
32 id: scopes
33
33
34 onLoadedChanged: {
34 onLoadedChanged: {
35− genericScopeView.scope = scopes.get(0)
35+ genericScopeView.scope = scopes.get(2)
36 }
36 }
37 }
37 }
38
38
@@ -41,17 +41,10 @@ Item {
41 signal mainStageFocusedApplicationChanged()
41 signal mainStageFocusedApplicationChanged()
42 }
42 }
43
43
44− PreviewListView {
45− id: previewListView
46− anchors.fill: parent
47− openEffect: openEffect
48− categoryView: genericScopeView.categoryView
49− scope: genericScopeView.scope
50− }
51−
52 DashContentOpenEffect {
44 DashContentOpenEffect {
53 id: openEffect
45 id: openEffect
54 previewListView: previewListView
46 previewListView: previewListView
47+ sourceItem: genericScopeView
55 }
48 }
56
49
57 PageHeaderLabel {
50 PageHeaderLabel {
@@ -101,36 +94,42 @@ Item {
101 function test_showDash() {
94 function test_showDash() {
102 previewListView.open = true;
95 previewListView.open = true;
103 tryCompare(openEffect, "live", true);
96 tryCompare(openEffect, "live", true);
104− scopes.get(0).showDash();
97+ scopes.get(2).showDash();
105 tryCompare(previewListView, "open", false);
98 tryCompare(previewListView, "open", false);
106 tryCompare(openEffect, "live", true);
99 tryCompare(openEffect, "live", true);
107 }
100 }
108
101
109 function test_hideDash() {
102 function test_hideDash() {
110 previewListView.open = true;
103 previewListView.open = true;
111− scopes.get(0).hideDash();
104+ scopes.get(2).hideDash();
112 tryCompare(previewListView, "open", false);
105 tryCompare(previewListView, "open", false);
106+ tryCompare(openEffect, "gap", 0);
113 }
107 }
114
108
115− function openPreview() {
109+ function openPreview(filterGridName, willOpen) {
116− var categoryListView = findChild(genericScopeView, "categoryListView");
110+ if (filterGridName === undefined)
117− categoryListView.positionAtBeginning();
111+ filterGridName = "0";
118−
112+ if (willOpen === undefined)
113+ willOpen = true;
119 tryCompareFunction(function() {
114 tryCompareFunction(function() {
120− var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
115+ var filterGrid = findChild(genericScopeView, filterGridName);
116+ if (filterGrid != null) {
117+ var tile = findChild(filterGrid, "delegate0");
121− return tile != undefined;
118+ return tile != null;
119+ }
120+ return false;
122 },
121 },
123 true);
122 true);
124− var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
123+ var tile = findChild(findChild(genericScopeView, filterGridName), "delegate0");
125 mouseClick(tile, tile.width / 2, tile.height / 2);
124 mouseClick(tile, tile.width / 2, tile.height / 2);
126− tryCompare(previewListView, "open", true);
125+ tryCompare(previewListView, "open", willOpen);
127− tryCompare(openEffect, "gap", 1);
126+ tryCompare(openEffect, "gap", willOpen ? 1 : 0);
128 }
127 }
129
128
130 function checkArrowPosition(index) {
129 function checkArrowPosition(index) {
131 tryCompareFunction(function() {
130 tryCompareFunction(function() {
132 var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
131 var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
133− return tile != undefined;
132+ return tile != null;
134 },
133 },
135 true);
134 true);
136 var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
135 var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
@@ -154,6 +153,8 @@ Item {
154
153
155 function test_previewOpenClose() {
154 function test_previewOpenClose() {
156 tryCompare(previewListView, "open", false);
155 tryCompare(previewListView, "open", false);
156+ var categoryListView = findChild(genericScopeView, "categoryListView");
157+ categoryListView.positionAtBeginning();
157
158
158 openPreview();
159 openPreview();
159
160
@@ -193,7 +194,11 @@ Item {
193 }
194 }
194
195
195 function test_previewCycle() {
196 function test_previewCycle() {
197+ var categoryListView = findChild(genericScopeView, "categoryListView");
198+ categoryListView.positionAtBeginning();
199+
196 tryCompare(previewListView, "open", false);
200 tryCompare(previewListView, "open", false);
201+ tryCompare(openEffect, "gap", 0);
197
202
198 openPreview();
203 openPreview();
199
204
@@ -211,7 +216,7 @@ Item {
211 checkArrowPosition(0);
216 checkArrowPosition(0);
212
217
213 // flick to the next previews
218 // flick to the next previews
214−
219+ tryCompare(previewListView, "count", 15);
215 for (var i = 1; i < previewListView.count; ++i) {
220 for (var i = 1; i < previewListView.count; ++i) {
216
221
217 mouseFlick(previewListView, previewListView.width - units.gu(1),
222 mouseFlick(previewListView, previewListView.width - units.gu(1),
@@ -246,8 +251,13 @@ Item {
246 }
251 }
247
252
248 function test_show_spinner() {
253 function test_show_spinner() {
254+ var categoryListView = findChild(genericScopeView, "categoryListView");
255+ waitForRendering(categoryListView);
256+ categoryListView.contentY = units.gu(13);
249 openPreview();
257 openPreview();
250 var previewLoader = findChild(previewListView, "previewLoader0");
258 var previewLoader = findChild(previewListView, "previewLoader0");
259+ compare(previewLoader.source.toString().split("/").pop(), "DashPreviewPlaceholder.qml");
260+ compare(categoryListView.contentY, 0)
251 tryCompare(previewLoader, "progress", 1.0);
261 tryCompare(previewLoader, "progress", 1.0);
252 tryCompareFunction(function() { return previewLoader.item != undefined; }, true);
262 tryCompareFunction(function() { return previewLoader.item != undefined; }, true);
253
263
@@ -263,13 +273,13 @@ Item {
263 function test_changeScope() {
273 function test_changeScope() {
264 genericScopeView.scope.searchQuery = "test"
274 genericScopeView.scope.searchQuery = "test"
265 genericScopeView.scope = scopes.get(1)
275 genericScopeView.scope = scopes.get(1)
266− genericScopeView.scope = scopes.get(0)
276+ genericScopeView.scope = scopes.get(2)
267 tryCompare(genericScopeView.scope, "searchQuery", "")
277 tryCompare(genericScopeView.scope, "searchQuery", "")
268 }
278 }
269
279
270 function test_filter_expand_collapse() {
280 function test_filter_expand_collapse() {
271 // wait for the item to be there
281 // wait for the item to be there
272− tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != undefined; }, true);
282+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != null; }, true);
273
283
274 var header = findChild(genericScopeView, "dashSectionHeader0")
284 var header = findChild(genericScopeView, "dashSectionHeader0")
275 var category = findChild(genericScopeView, "dashCategory0")
285 var category = findChild(genericScopeView, "dashCategory0")
@@ -306,7 +316,7 @@ Item {
306 }
316 }
307
317
308 function test_showPreviewCarousel() {
318 function test_showPreviewCarousel() {
309− tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != undefined; }, true);
319+ tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);
310 var tile = findChild(genericScopeView, "carouselDelegate");
320 var tile = findChild(genericScopeView, "carouselDelegate");
311 mouseClick(tile, tile.width / 2, tile.height / 2);
321 mouseClick(tile, tile.width / 2, tile.height / 2);
312 tryCompare(openEffect, "gap", 1);
322 tryCompare(openEffect, "gap", 1);
@@ -332,15 +342,15 @@ Item {
332 tryCompare(previewListView, "open", false);
342 tryCompare(previewListView, "open", false);
333 }
343 }
334
344
335− function test_filter_expand_expand() {
345+ function test_filter_expand_expand_collapse() {
336 // wait for the item to be there
346 // wait for the item to be there
337− tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != undefined; }, true);
347+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeaderapplications.scope") != null; }, true);
338
348
339 var categoryListView = findChild(genericScopeView, "categoryListView");
349 var categoryListView = findChild(genericScopeView, "categoryListView");
340 categoryListView.contentY = categoryListView.height;
350 categoryListView.contentY = categoryListView.height;
341
351
342− var header2 = findChild(genericScopeView, "dashSectionHeader2")
352+ var header2 = findChild(genericScopeView, "dashSectionHeaderapplications.scope")
343− var category2 = findChild(genericScopeView, "dashCategory2")
353+ var category2 = findChild(genericScopeView, "dashCategoryapplications.scope")
344 var category2FilterGrid = category2.children[0].children[0].children[0];
354 var category2FilterGrid = category2.children[0].children[0].children[0];
345 verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
355 verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
346
356
@@ -368,11 +378,30 @@ Item {
368 tryCompare(category0, "filtered", false);
378 tryCompare(category0, "filtered", false);
369 tryCompare(category2, "filtered", true);
379 tryCompare(category2, "filtered", true);
370 tryCompare(category2FilterGrid, "filter", true);
380 tryCompare(category2FilterGrid, "filter", true);
381+ mouseClick(header0, header0.width / 2, header0.height / 2);
382+ tryCompare(category0, "filtered", true);
383+ tryCompare(category2, "filtered", true);
384+ }
385+
386+ function test_bug1271676_no_move_y_no_preview() {
387+ waitForRendering(genericScopeView);
388+ var categoryListView = findChild(genericScopeView, "categoryListView");
389+ waitForRendering(categoryListView);
390+ tryCompareFunction(function() { return findChild(genericScopeView, "dashCategoryapplications.scope") != null; }, true);
391+ var category = findChild(genericScopeView, "dashCategoryapplications.scope")
392+ categoryListView.contentY = category.y;
393+ waitForRendering(categoryListView);
394+ var contentYBefore = categoryListView.contentY
395+ openPreview("applications.scope", false); // This actually doesn't open anything because we
396+ // have code so that the item of installed
397+ // does activate instead of preview and never shows a preview
398+ compare(categoryListView.contentY, contentYBefore);
371 }
399 }
372
400
373 function test_narrow_delegate_ranges_expand() {
401 function test_narrow_delegate_ranges_expand() {
374 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);
402 tryCompareFunction(function() { return findChild(genericScopeView, "dashCategory0") != undefined; }, true);
375 var category = findChild(genericScopeView, "dashCategory0")
403 var category = findChild(genericScopeView, "dashCategory0")
404+ tryCompare(category, "filtered", true);
376
405
377 shell.width = units.gu(20)
406 shell.width = units.gu(20)
378 var categoryListView = findChild(genericScopeView, "categoryListView");
407 var categoryListView = findChild(genericScopeView, "categoryListView");
@@ -386,4 +415,12 @@ Item {
386 }
415 }
387 }
416 }
388 }
417 }
418+
419+ PreviewListView {
420+ id: previewListView
421+ anchors.fill: parent
422+ openEffect: openEffect
423+ categoryView: genericScopeView.categoryView
424+ scope: genericScopeView.scope
425+ }
389}
426}
tests/qmltests/Panel/tst_IndicatorRow.qml+2−2
@@ -32,7 +32,7 @@ Item {
32
32
33 function init_test()
33 function init_test()
34 {
34 {
35− indicatorModel.load();
35+ indicatorModel.load("test1");
36
36
37 indicatorRow.state = "initial";
37 indicatorRow.state = "initial";
38 indicatorRow.setCurrentItemIndex(-1);
38 indicatorRow.setCurrentItemIndex(-1);
@@ -52,7 +52,7 @@ Item {
52
52
53 indicatorsModel: indicatorModel
53 indicatorsModel: indicatorModel
54
54
55− Component.onCompleted: indicatorModel.load()
55+ Component.onCompleted: indicatorModel.load("test1")
56 }
56 }
57
57
58 Indicators.IndicatorsModel {
58 Indicators.IndicatorsModel {
tests/qmltests/Panel/tst_Indicators.qml+1
@@ -43,6 +43,7 @@ Item {
43 width: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
43 width: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
44 y: 0
44 y: 0
45 shown: false
45 shown: false
46+ profile: "test1"
46
47
47 openedHeight: parent.height - click_me.height
48 openedHeight: parent.height - click_me.height
48 }
49 }
tests/qmltests/Panel/tst_MenuContent.qml+1−1
@@ -41,7 +41,7 @@ Item {
41
41
42 Indicators.IndicatorsModel {
42 Indicators.IndicatorsModel {
43 id: indicatorsModel
43 id: indicatorsModel
44− Component.onCompleted: load()
44+ Component.onCompleted: load("test1")
45 }
45 }
46
46
47 MenuContent {
47 MenuContent {
tests/qmltests/Panel/tst_Panel.qml+4
@@ -40,6 +40,10 @@ Item {
40 Panel {
40 Panel {
41 id: panel
41 id: panel
42 anchors.fill: parent
42 anchors.fill: parent
43+
44+ indicators {
45+ profile: "test1"
46+ }
43 }
47 }
44
48
45 UT.UnityTestCase {
49 UT.UnityTestCase {