on xenial help sign in
Merge
commitcf638dfc5ada54f70978dcc887192e4a89768b48 authorAlbert Astals <albert.astals@canonical.com> dateThu 17 Apr 2014, 10:17 (13 years ago) parentabadfcfa07cba7
34 files changed+206−575
data/unity8.conf+2−1 debian/changelog+74 debian/control−3 plugins/Unity/Indicators/CMakeLists.txt−3 plugins/Unity/Indicators/indicatorsmanager.cpp−33 plugins/Unity/Indicators/indicatorsmanager.h−2 qml/Components/AnimationControllerWithSignals.qml−64 qml/Components/Carousel.qml+13−19 qml/Dash/DashContent.qml+5−10 qml/Dash/GenericScopeView.qml+8−7 qml/Dash/Previews/PreviewRatingDisplay.qml+4−2 qml/Dash/Previews/PreviewRatingInput.qml+4−2 qml/Dash/ScopeDelegateMapper.qml−30 qml/graphics/phone_background.jpg qml/graphics/tablet_background.jpg run+15−1 tests/autopilot/unity8/shell/emulators/dash.py+10−5 tests/autopilot/unity8/shell/tests/test_emulators.py+3−11 tests/autopilot/unity8/shell/tests/test_notifications.py+3−4 tests/qmltests/CMakeLists.txt−1 tests/qmltests/Components/tst_AnimationControllerWithSignals.qml−142 tests/qmltests/Components/tst_Carousel.qml+34−7 tests/qmltests/Dash/qml/FakeScopeView.qml−45 tests/qmltests/Dash/qml/fake_generic_scopeView.qml−24 tests/qmltests/Dash/qml/fake_scopeView1.qml−24 tests/qmltests/Dash/qml/fake_scopeView2.qml−24 tests/qmltests/Dash/qml/fake_scopeView3.qml−24 tests/qmltests/Dash/qml/fake_scopeView4.qml−24 tests/qmltests/Dash/tst_Dash.qml−11 tests/qmltests/Dash/tst_DashContent.qml+27−51 tests/qmltests/Dash/tst_GenericScopeView.qml+1−1 tests/qmltests/Launcher/tst_Launcher.qml+1 tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+1 tests/qmltests/Panel/Indicators/tst_MessageMenuItemFactory.qml+1
data/unity8.conf+2−1
@@ -1,7 +1,7 @@
11description "Unity Shell v8"
22author "Ricardo Mendoza <ricmm@ubuntu.com>"
33
4−emits scope-ui-starting
4+emits scope-ui-starting indicator-services-start
55
66start on ((xsession SESSION=ubuntu-touch) or (xsession SESSION=ubuntu-touch-surfaceflinger)) and started dbus
77stop on desktop-end
@@ -42,6 +42,7 @@ pre-start script
4242 fi
4343
4444 initctl emit scope-ui-starting
45+ initctl emit indicator-services-start
4546end script
4647
4748exec ${BINARY:-unity8} $ARGS
debian/changelog+74
@@ -1,3 +1,77 @@
1+unity8 (7.85+14.04.20140416-0ubuntu1) trusty; urgency=low
2+
3+ [ Albert Astals ]
4+ * Fix last item X position Fixes clicking on the last item sometimes
5+ not working (LP: #1301871)
6+ * Use upstart in ./run Makes it so that you can use the lock button on
7+ the device without getting that nasty hwc crash
8+ * Remove AnimationControllerWithSignals.
9+ * Use the correct delegate base item for the Carousel test
10+ * Some simplification in DashContent Kill the ScopeDelegateMapper in
11+ favour of a simple if (that will eventually go away). Removal of all
12+ the fake scopes in the tests that added nothing of value to the
13+ tests. Removal of movementEnded signal that was unused. Removal of
14+ movementStarted and positionedAtBeginning signals that were being
15+ used as function calls. Rework DashContent tests so they what the
16+ function does what it is supposed to do instead of just making sure
17+ QML signals work .
18+ * Improve Card creation time by adding loaders that make sure only
19+ what's needed is loaded In my computer it goes from RESULT :
20+ qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotSummaryMode
21+ l": 3.217 msecs per iteration (total: 3,218, iterations: 1000)
22+ RESULT :
23+ qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotModel":
24+ 1.647 msecs per iteration (total: 1,648, iterations: 1000) RESULT :
25+ qmltestrunner::benchmark_time:"cardTitleArtSubtitleModel": 1.514
26+ msecs per iteration (total: 1,515, iterations: 1000) RESULT :
27+ qmltestrunner::benchmark_time:"cardTitleArtModel": 1.471 msecs per
28+ iteration (total: 1,471, iterations: 1000) RESULT :
29+ qmltestrunner::benchmark_time:"cardArtModel": 1.447 msecs per
30+ iteration (total: 1,448, iterations: 1000) RESULT :
31+ qmltestrunner::benchmark_time:"cardTitleModel": 1.276 msecs per
32+ iteration (total: 1,276, iterations: 1000) to RESULT :
33+ qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotSummaryMode
34+ l": 2.916 msecs per iteration (total: 2,917, iterations: 1000)
35+ RESULT :
36+ qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotModel":
37+ 1.504 msecs per iteration (total: 1,504, iterations: 1000) RESULT :
38+ qmltestrunner::benchmark_time:"cardTitleArtSubtitleModel": 1.060
39+ msecs per iteration (total: 1,061, iterations: 1000) RESULT :
40+ qmltestrunner::benchmark_time:"cardTitleArtModel": 1.052 msecs per
41+ iteration (total: 1,053, iterations: 1000) RESULT :
42+ qmltestrunner::benchmark_time:"cardArtModel": 0.727 msecs per
43+ iteration (total: 728, iterations: 1000) RESULT :
44+ qmltestrunner::benchmark_time:"cardTitleModel": 0.817 msecs per
45+ iteration (total: 818, iterations: 1000) (LP: #1297197)
46+
47+ [ Allan LeSage ]
48+ * DashApps emulator get_applications should return a list ordered by
49+ visible y, x.
50+
51+ [ Andrea Cimitan ]
52+ * Workaround for lp1301309 until fixes for palette in ui toolkit (LP:
53+ #1301309)
54+
55+ [ Leo Arias ]
56+ * Reverted the change that returns application cards instead of
57+ titles.
58+
59+ [ Nick Dedekind ]
60+ * Indicator services started by unity8 upstart configuration rather
61+ than manual emmision from indicator manager.
62+
63+ [ Mirco Müller ]
64+ * Fix notification ap-test assertions.
65+
66+ [ Michael Terry ]
67+ * Use new tablet and phone backgrounds from Design.
68+
69+ [ Michael Zanetti ]
70+ * workaround the QTestLogger assertion issue with make tryXyz and our
71+ custom uqmlscene
72+
73+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 16 Apr 2014 13:45:01 +0000
74+
175unity8 (7.85+14.04.20140415.2-0ubuntu1) trusty; urgency=low
276
377 [ Michael Terry ]
debian/control−3
@@ -13,13 +13,10 @@ Build-Depends: cmake,
1313 libgles2-mesa-dev[armhf],
1414 libgsettings-qt-dev,
1515 libhud-client2-dev,
16− libnih-dbus-dev,
17− libnih-dev,
1816 libpulse-dev,
1917 libqmenumodel-dev (>= 0.2.7),
2018 libunity-api-dev (>= 7.80.6),
2119 libunity-mir-dev,
22− libupstart-dev,
2320 libusermetricsoutput1-dev,
2421 libxcb1-dev,
2522 libglib2.0-dev,
plugins/Unity/Indicators/CMakeLists.txt−3
@@ -6,7 +6,6 @@ project(IndicatorsQml)
66pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
77pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
88pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
9−pkg_check_modules(LIBUPSTART REQUIRED libupstart libnih libnih-dbus dbus-1)
109
1110find_package(Qt5Core REQUIRED)
1211find_package(Qt5Quick REQUIRED)
@@ -19,7 +18,6 @@ include_directories(
1918 ${GLIB_INCLUDE_DIRS}
2019 ${GIO_INCLUDE_DIRS}
2120 ${QMENUMODEL_INCLUDE_DIRS}
22− ${LIBUPSTART_INCLUDE_DIRS}
2321)
2422
2523set(IndicatorsQML_SOURCES
@@ -54,7 +52,6 @@ target_link_libraries(IndicatorsQml
5452 ${GLIB_LIBRARIES}
5553 ${GIO_LIBRARIES}
5654 ${QMENUMODEL_LDFLAGS}
57− ${LIBUPSTART_LIBRARIES}
5855)
5956
6057qt5_use_modules(IndicatorsQml Core Qml Quick)
plugins/Unity/Indicators/indicatorsmanager.cpp−33
@@ -21,9 +21,6 @@
2121#include <QSettings>
2222#include <QDebug>
2323
24−#include <upstart.h>
25−#include <nih/alloc.h>
26−
2724#include <paths.h>
2825
2926
@@ -216,36 +213,6 @@ void IndicatorsManager::setLoaded(bool loaded)
216213 {
217214 m_loaded = loaded;
218215 Q_EMIT loadedChanged(m_loaded);
219−
220− auto upstartsession = qgetenv("UPSTART_SESSION");
221− NihDBusProxy * upstart = NULL;
222−
223− if (!upstartsession.isNull()) {
224− DBusConnection * conn = NULL;
225− conn = dbus_connection_open(upstartsession.constData(), NULL);
226− if (conn != NULL) {
227− upstart = nih_dbus_proxy_new(NULL, conn,
228− NULL,
229− DBUS_PATH_UPSTART,
230− NULL, NULL);
231− dbus_connection_unref(conn);
232− }
233− }
234−
235− if (upstart != NULL) {
236− int event_sent = 0;
237− if (m_loaded) {
238− event_sent = upstart_emit_event_sync(NULL, upstart, "indicator-services-start", NULL, 0);
239− } else {
240− event_sent = upstart_emit_event_sync(NULL, upstart, "indicator-services-end", NULL, 0);
241− }
242−
243− if (event_sent != 0) {
244− qWarning() << "Unable to send indicator event to Upstart";
245− }
246− nih_unref(upstart, NULL);
247− upstart = NULL;
248− }
249216 }
250217}
251218
plugins/Unity/Indicators/indicatorsmanager.h−2
@@ -28,8 +28,6 @@
2828#include <QHash>
2929#include <QSharedPointer>
3030
31−typedef struct nih_dbus_proxy NihDBusProxy;
32−
3331class UNITYINDICATORS_EXPORT IndicatorsManager : public QObject
3432{
3533 Q_OBJECT
qml/Components/AnimationControllerWithSignals.qmldeleted−64
@@ -1,64 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−AnimationController {
20− signal animationCompletedAtBeginning()
21− signal animationCompletedAtEnd()
22− readonly property bool completed: progress == 1.0 || progress == 0.0
23− property bool completing: false
24−
25− function __completeAtBeginning() {
26− completing = false;
27− animationCompletedAtBeginning();
28− }
29−
30− function __completeAtEnd() {
31− completing = false;
32− animationCompletedAtEnd();
33− }
34−
35− function completeToBeginningWithSignal() {
36− if (progress == 0.0) {
37− __completeAtBeginning()
38− } else {
39− completing = true;
40− completeToBeginning();
41− }
42− }
43−
44− function completeToEndWithSignal() {
45− if (progress == 1.0) {
46− __completeAtEnd()
47− } else {
48− completing = true;
49− completeToEnd();
50− }
51− }
52−
53− onProgressChanged: {
54− if (!completing) {
55− return;
56− }
57−
58− if (progress == 0.0) {
59− __completeAtBeginning()
60− } else if (progress == 1.0) {
61− __completeAtEnd()
62− }
63− }
64−}
qml/Components/Carousel.qml+13−19
@@ -75,6 +75,7 @@ Item {
7575 The scaling of the items is controlled by the variable continuousIndex, described below. */
7676 ListView {
7777 id: listView
78+ objectName: "listView"
7879
7980 property int highlightIndex: -1
8081 property real minimumTileWidth: 0
@@ -148,15 +149,19 @@ Item {
148149 maximumFlickVelocity: Math.max(2500 * Math.pow(realWidth / referenceWidth, 1.5), 2500) // 2500 is platform default
149150 orientation: ListView.Horizontal
150151
151− function itemClicked(index, delegateItem) {
152− listView.currentIndex = index
153− var x = CarouselJS.getXFromContinuousIndex(index,
152+ function getXFromContinuousIndex(index) {
153+ return CarouselJS.getXFromContinuousIndex(index,
154154 realWidth,
155− realContentWidth,
155+ footerItem.x,
156156 tileWidth,
157157 gapToMiddlePhase,
158158 gapToEndPhase,
159159 carousel.drawBuffer)
160+ }
161+
162+ function itemClicked(index, delegateItem) {
163+ listView.currentIndex = index
164+ var x = getXFromContinuousIndex(index);
160165
161166 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
162167 /* We're clicking the selected item and
@@ -174,13 +179,7 @@ Item {
174179 }
175180
176181 function itemPressAndHold(index, delegateItem) {
177− var x = CarouselJS.getXFromContinuousIndex(index,
178− realWidth,
179− realContentWidth,
180− tileWidth,
181− gapToMiddlePhase,
182− gapToEndPhase,
183− carousel.drawBuffer);
182+ var x = getXFromContinuousIndex(index);
184183
185184 if (Math.abs(x - contentX) < 1 && delegateItem !== undefined) {
186185 /* We're pressAndHold the selected item and
@@ -209,22 +208,17 @@ Item {
209208 newContentX = disabledNewContentX
210209 }
211210 onMovementEnded: {
212− if (realContentX > 0 && realContentX < realContentWidth - realWidth)
211+ if (realContentX > 0)
213212 stepAnimation.start()
214213 }
215214
216215 SmoothedAnimation {
217216 id: stepAnimation
217+ objectName: "stepAnimation"
218218
219219 target: listView
220220 property: "contentX"
221− to: CarouselJS.getXFromContinuousIndex(listView.selectedIndex,
222− listView.realWidth,
223− listView.realContentWidth,
224− listView.tileWidth,
225− listView.gapToMiddlePhase,
226− listView.gapToEndPhase,
227− carousel.drawBuffer)
221+ to: listView.getXFromContinuousIndex(listView.selectedIndex)
228222 duration: 450
229223 velocity: 200
230224 easing.type: Easing.InOutQuad
qml/Dash/DashContent.qml+5−10
@@ -27,13 +27,9 @@ Item {
2727 readonly property alias currentIndex: dashContentList.currentIndex
2828 property alias previewOpen: previewListView.open
2929
30− property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
3130 property ListModel searchHistory
3231
33− signal movementStarted()
34− signal movementEnded()
3532 signal scopeLoaded(string scopeId)
36− signal positionedAtBeginning()
3733 signal gotoScope(string scopeId)
3834 signal openScope(var scope)
3935
@@ -71,7 +67,7 @@ Item {
7167 dashContentList.currentIndex = index
7268
7369 if (reset) {
74− dashContent.positionedAtBeginning()
70+ dashContentList.currentItem.item.positionAtBeginning()
7571 }
7672 }
7773
@@ -114,8 +110,7 @@ Item {
114110 highlightRangeMode: ListView.StrictlyEnforceRange
115111 // TODO Investigate if we can switch to a smaller cache buffer when/if UbuntuShape gets more performant
116112 cacheBuffer: 1073741823
117− onMovementStarted: dashContent.movementStarted()
118− onMovementEnded: dashContent.movementEnded()
113+ onMovementStarted: currentItem.item.showHeader();
119114 clip: parent.x != 0
120115
121116 // If the number of items is less than the current index, then need to reset to another item.
@@ -135,7 +130,9 @@ Item {
135130 width: ListView.view.width
136131 height: ListView.view.height
137132 asynchronous: true
138− source: scopeMapper.map(scope.id)
133+ // TODO This if will eventually go away since we're killing DashApps.qml
134+ // once we move app closing to the spread
135+ source: (scope.id == "clickscope") ? "DashApps.qml" : "GenericScopeView.qml"
139136 objectName: scope.id + " loader"
140137
141138 readonly property bool moving: item ? item.moving : false
@@ -154,8 +151,6 @@ Item {
154151 item.scope = Qt.binding(function() { return scope })
155152 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
156153 item.tabBarHeight = dashPageHeader.implicitHeight;
157− dashContentList.movementStarted.connect(item.movementStarted)
158− dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
159154 dashContent.scopeLoaded(item.scope.id)
160155 }
161156 Connections {
qml/Dash/GenericScopeView.qml+8−7
@@ -33,9 +33,6 @@ FocusScope {
3333 property PageHeader pageHeader: null
3434 property Item previewListView: null
3535
36− signal movementStarted
37− signal positionedAtBeginning
38−
3936 property bool enableHeightBehaviorOnNextCreation: false
4037 property var categoryView: categoryView
4138
@@ -49,6 +46,14 @@ FocusScope {
4946 shell.activateApplication(appId);
5047 }
5148
49+ function positionAtBeginning() {
50+ categoryView.positionAtBeginning()
51+ }
52+
53+ function showHeader() {
54+ categoryView.showHeader()
55+ }
56+
5257 Binding {
5358 target: scope
5459 property: "isActive"
@@ -69,10 +74,6 @@ FocusScope {
6974 previewListView.open = false;
7075 }
7176
72− onMovementStarted: categoryView.showHeader()
73−
74− onPositionedAtBeginning: categoryView.positionAtBeginning()
75−
7677 Binding {
7778 target: scopeView.scope
7879 property: "searchQuery"
qml/Dash/Previews/PreviewRatingDisplay.qml+4−2
@@ -71,7 +71,8 @@ PreviewWidget {
7171 id: authorLabel
7272 objectName: "authorLabel"
7373 anchors { left: parent.left; right: parent.right }
74− color: Theme.palette.selected.backgroundText
74+ // TODO cimi: Yet another fix requiring Palette update.
75+ color: "grey" //Theme.palette.selected.backgroundText
7576 opacity: .8
7677 text: modelData["author"] || ""
7778 visible: text !== ""
@@ -82,7 +83,8 @@ PreviewWidget {
8283 id: reviewLabel
8384 objectName: "reviewLabel"
8485 anchors { left: parent.left; right: parent.right }
85− color: Theme.palette.selected.backgroundText
86+ // TODO cimi: Yet another fix requiring Palette update.
87+ color: "grey" //Theme.palette.selected.backgroundText
8688 opacity: .8
8789 text: modelData["review"] || ""
8890 visible: text !== ""
qml/Dash/Previews/PreviewRatingInput.qml+4−2
@@ -76,7 +76,8 @@ PreviewWidget {
7676 verticalCenter: parent.verticalCenter
7777 left: parent.left
7878 }
79− color: Theme.palette.selected.backgroundText
79+ // TODO cimi: Yet another fix requiring Palette update.
80+ color: "grey" //Theme.palette.selected.backgroundText
8081 opacity: .8
8182 text: widgetData["rating-label"] || i18n.tr("Rate this")
8283 }
@@ -121,7 +122,8 @@ PreviewWidget {
121122 left: parent.left
122123 right: parent.right
123124 }
124− color: Theme.palette.selected.backgroundText
125+ // TODO cimi: Yet another fix requiring Palette update.
126+ color: "grey" //Theme.palette.selected.backgroundText
125127 opacity: .8
126128 text: widgetData["review-label"] || i18n.tr("Add a review")
127129 }
qml/Dash/ScopeDelegateMapper.qmldeleted−30
@@ -1,30 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−QtObject {
20− property var scopeDelegateMapping: {"clickscope": "DashApps.qml"}
21− property string genericScope: "GenericScopeView.qml"
22−
23− function map(scopeId) {
24− var customScope = scopeDelegateMapping[scopeId]
25− if (customScope != undefined) {
26− return customScope
27− }
28− return genericScope
29− }
30−}
qml/graphics/phone_background.jpg

Binary file not shown.

qml/graphics/tablet_background.jpg

Binary file not shown.

run+15−1
@@ -68,8 +68,22 @@ if $MOUSE_TOUCH; then
6868 QML_PHONE_SHELL_ARGS="$QML_PHONE_SHELL_ARGS -mousetouch"
6969fi
7070
71+control_c()
72+{
73+ /sbin/initctl stop unity8
74+ exit $?
75+}
76+
77+trap control_c INT
78+
7179if $GDB; then
7280 gdb -ex run --args $QML_PHONE_SHELL_PATH $QML_PHONE_SHELL_ARGS $@
7381else
74− $QML_PHONE_SHELL_PATH $QML_PHONE_SHELL_ARGS $@
82+ status=`/sbin/initctl status unity8`
83+ if [ "$status" != "unity8 stop/waiting" ]; then
84+ echo "Unity8 is already running, please stop it first"
85+ exit 1
86+ fi
87+ /sbin/initctl start unity8 BINARY="`readlink -f $QML_PHONE_SHELL_PATH` $QML_PHONE_SHELL_ARGS $@"
88+ tailf -n 0 ~/.cache/upstart/unity8.log
7589fi
tests/autopilot/unity8/shell/emulators/dash.py+10−5
@@ -191,13 +191,18 @@ class DashApps(GenericScopeView):
191191
192192 """
193193 category_element = self._get_category_element(category)
194− application_tiles = category_element.select_many('Card')
195− # TODO return them on the same order they are displayed.
196− # --elopio - 2014-1-15
194+ application_cards = category_element.select_many('Card')
195+
196+ # sort by y, x
197+ application_cards = sorted(
198+ application_cards,
199+ key=lambda card: (card.globalRect.y, card.globalRect.x))
200+
197201 result = []
198− for card in application_tiles:
202+ for card in application_cards:
199203 if card.objectName != 'cardToolCard':
200− result.append(card)
204+ card_header = card.select_single('CardHeader')
205+ result.append(card_header.title)
201206 return result
202207
203208
tests/autopilot/unity8/shell/tests/test_emulators.py+3−11
@@ -166,7 +166,7 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
166166 available_applications = [
167167 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',
168168 'Title.2.5', 'Title.2.6', 'Title.2.7', 'Title.2.8', 'Title.2.9',
169− 'Title.2.9', 'Title.2.10', 'Title.2.11']
169+ 'Title.2.10', 'Title.2.11', 'Title.2.12']
170170
171171 def setUp(self):
172172 # Set up the fake scopes before launching unity.
@@ -183,21 +183,13 @@ class DashAppsEmulatorTestCase(DashBaseTestCase):
183183 self.assertEqual(
184184 'No category found with name unexisting category', str(exception))
185185
186− def test_get_applications_should_return_list_with_names(self):
186+ def test_get_applications_should_return_correct_applications(self):
187187 category = '2'
188188 expected_apps_count = self._get_number_of_application_slots(category)
189189 expected_applications = self.available_applications[
190190 :expected_apps_count]
191−
192191 applications = self.applications_scope.get_applications(category)
193− applications_titles = []
194− for application in applications:
195− cardHeader = application.select_single('CardHeader')
196− applications_titles.append(cardHeader.title)
197−
198− self.assertThat(applications, HasLength(expected_apps_count))
199− for expected in expected_applications:
200− self.assertThat(applications_titles, Contains(expected))
192+ self.assertEqual(expected_applications, applications)
201193
202194 def _get_number_of_application_slots(self, category):
203195 category_element = self.applications_scope._get_category_element(
tests/autopilot/unity8/shell/tests/test_notifications.py+3−4
@@ -196,7 +196,7 @@ class InteractiveNotificationBase(NotificationsBase):
196196 get_notification = lambda: notify_list.wait_select_single(
197197 'Notification', objectName='notification1')
198198 notification = get_notification()
199− self._assert_notification(notification, None, None, True, True, 1.0)
199+ self._assert_notification(notification, summary, body, True, True, 1.0)
200200 initial_height = notification.height
201201 self.touch.tap_object(notification.select_single(objectName="button1"))
202202 self.assertThat(
@@ -403,7 +403,6 @@ class EphemeralNotificationsTests(NotificationsBase):
403403
404404 notification = lambda: notify_list.wait_select_single(
405405 'Notification', objectName='notification1')
406−
407406 self._assert_notification(
408407 notification(),
409408 summary,
@@ -579,7 +578,7 @@ class EphemeralNotificationsTests(NotificationsBase):
579578 icon_path = self._get_icon_path('avatars/amanda.png')
580579 notification.update(summary, body, icon_path)
581580 notification.show()
582− self._assert_notification(get_notification(), summary, body)
581+ self._assert_notification(get_notification(), summary, body, True, False, 1.0)
583582
584583 def test_update_notification_layout_change(self):
585584 """Notification must allow updating its contents and layout while
@@ -626,7 +625,7 @@ class EphemeralNotificationsTests(NotificationsBase):
626625 notification.show()
627626
628627 self.assertThat(get_notification, Eventually(NotEquals(None)))
629− self._assert_notification(get_notification(), summary, body, False)
628+ self._assert_notification(get_notification(), summary, body, False, False, 1.0)
630629
631630 def test_append_hint(self):
632631 """Notification has to accumulate body-text using append-hint."""
tests/qmltests/CMakeLists.txt−1
@@ -11,7 +11,6 @@ set(qmltest_DEFAULT_IMPORT_PATHS
1111set(qmltest_DEFAULT_TARGETS qmlunittests)
1212set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
1313set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
14−add_qml_test(Components AnimationControllerWithSignals)
1514add_qml_test(Panel IndicatorItem)
1615add_qml_test(utils/Unity/Test UnityTest)
1716
tests/qmltests/Components/tst_AnimationControllerWithSignals.qmldeleted−142
@@ -1,142 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../qml/Components"
20−
21−TestCase {
22− id: testCase
23− name: "AnimationControllerWithSignals"
24−
25− property real someNumber: 0.0
26−
27− NumberAnimation {
28− id: someNumberAnimation
29− target: testCase
30− properties: "someNumber"
31− from: 1.0
32− to: 100.0
33− }
34−
35− Component {
36− id: testSubjectComponent
37− AnimationControllerWithSignals {}
38− }
39−
40− Loader {
41− id: loader
42− asynchronous: false
43− }
44−
45− SignalSpy {
46− id: signalSpy
47− }
48−
49− function test_completeToEndWithSignal() {
50− loader.sourceComponent = testSubjectComponent;
51− var testSubject = loader.item;
52−
53− testSubject.animation = someNumberAnimation;
54− testSubject.progress = 0;
55−
56− signalSpy.signalName = "animationCompletedAtEnd";
57− signalSpy.target = testSubject;
58− signalSpy.clear();
59−
60− compare(testSubject.completing, false)
61− compare(testSubject.completed, true)
62−
63− testSubject.completeToEndWithSignal();
64− compare(testSubject.completing, true)
65− compare(testSubject.completed, true)
66− compare(signalSpy.count, 0);
67−
68− testSubject.progress = 0.5;
69− compare(testSubject.completing, true)
70− compare(testSubject.completed, false)
71− compare(signalSpy.count, 0);
72−
73− testSubject.progress = 1.0;
74− compare(testSubject.completing, false)
75− compare(testSubject.completed, true)
76− compare(signalSpy.count, 1);
77−
78− testSubject.animation = null
79− loader.sourceComponent = undefined;
80− }
81−
82− function test_completeToBeginningWithSignal() {
83− loader.sourceComponent = testSubjectComponent;
84− var testSubject = loader.item;
85−
86− testSubject.animation = someNumberAnimation;
87− testSubject.progress = 1;
88−
89− signalSpy.signalName = "animationCompletedAtBeginning";
90− signalSpy.target = testSubject;
91− signalSpy.clear();
92−
93− compare(testSubject.completing, false)
94− compare(testSubject.completed, true)
95−
96− testSubject.completeToBeginningWithSignal();
97− compare(testSubject.completing, true)
98− compare(testSubject.completed, true)
99− compare(signalSpy.count, 0);
100−
101− testSubject.progress = 0.5;
102− compare(testSubject.completing, true)
103− compare(testSubject.completed, false)
104− compare(signalSpy.count, 0);
105−
106− testSubject.progress = 0;
107− compare(testSubject.completing, false)
108− compare(testSubject.completed, true)
109− compare(signalSpy.count, 1);
110−
111− testSubject.animation = null
112− loader.sourceComponent = undefined;
113− }
114−
115− function test_settingProgressWithoutCallingCompleteWithSignal() {
116− loader.sourceComponent = testSubjectComponent;
117− var testSubject = loader.item;
118−
119− testSubject.animation = someNumberAnimation;
120− testSubject.progress = 0;
121−
122− signalSpy.signalName = "animationCompletedAtEnd";
123− signalSpy.target = testSubject;
124− signalSpy.clear();
125−
126− compare(testSubject.completing, false)
127− compare(testSubject.completed, true)
128−
129− testSubject.progress = 0.5;
130− compare(testSubject.completing, false)
131− compare(testSubject.completed, false)
132− compare(signalSpy.count, 0);
133−
134− testSubject.progress = 1;
135− compare(testSubject.completing, false)
136− compare(testSubject.completed, true)
137− compare(signalSpy.count, 0);
138−
139− testSubject.animation = null
140− loader.sourceComponent = undefined;
141− }
142−}
tests/qmltests/Components/tst_Carousel.qml+34−7
@@ -18,6 +18,7 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import "../../../qml/Components/"
2020import "../../../qml/Components/carousel.js" as Carousel
21+import Unity.Test 0.1 as UT
2122
2223Item {
2324 width: 700
@@ -31,13 +32,17 @@ Item {
3132 property int createdDelegates: 0
3233 property int destroyedDelegates: 0
3334
34− itemComponent: Rectangle {
35− color: "red"
36− Component.onCompleted: carousel.createdDelegates++
37− Component.onDestruction: carousel.destroyedDelegates++
35+ itemComponent: BaseCarouselDelegate {
36+ Rectangle {
37+ anchors.fill: parent
38+ border.color: "black"
39+ color: "red"
40+ Component.onCompleted: carousel.createdDelegates++
41+ Component.onDestruction: carousel.destroyedDelegates++
42+ }
3843 }
3944 }
40− TestCase {
45+ UT.UnityTestCase {
4146 id: root
4247 name: "Carousel"
4348 when: windowShown
@@ -55,8 +60,11 @@ Item {
5560 property real kGapEnd: kMiddleIndex * (1 - gapToEndPhase / gapToMiddlePhase)
5661 property real kXBeginningEnd: 1 / tileWidth + kMiddleIndex / gapToMiddlePhase
5762
58− function test_onlyNeededItemsCreated() {
59− compare(carousel.createdDelegates, 10);
63+ // This test needs to run first since it tests a corner case condition
64+ // to where the carousel is just being created
65+ // That is why it has a 1 in the name
66+ function test_1onlyNeededItemsCreated() {
67+ tryCompare(carousel, "createdDelegates", 10);
6068 compare(carousel.destroyedDelegates, 0);
6169 }
6270
@@ -216,5 +224,24 @@ Item {
216224 data.maxTranslation)
217225 compare(scale, data.result)
218226 }
227+
228+ function test_lastItemXPosition() {
229+ var carouselList = findChild(carousel, "listView");
230+ var stepAnimation = findInvisibleChild(carouselList, "stepAnimation");
231+ var stepDiff = 0;
232+ stepAnimation.onRunningChanged.connect(function() { if (stepAnimation.running) stepDiff = Math.abs(carouselList.contentX - stepAnimation.to); })
233+ var overshootOnce = false;
234+ while (!overshootOnce) {
235+ overshootOnce = carouselList.realContentX > carouselList.realContentWidth - carouselList.realWidth;
236+ mouseFlick(carousel, carousel.width - units.gu(1),
237+ carousel.height / 2,
238+ units.gu(2),
239+ carousel.height / 2);
240+ tryCompare(carouselList, "moving", false);
241+ }
242+ verify(stepDiff < 1);
243+ var x = carouselList.getXFromContinuousIndex(carousel.model - 1);
244+ verify(Math.abs(x - carouselList.contentX) < 1);
245+ }
219246 }
220247}
tests/qmltests/Dash/qml/FakeScopeView.qmldeleted−45
@@ -1,45 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Unity 0.2
19−
20−import "../../../../qml/Dash"
21−
22−GenericScopeView {
23− id: fakeScopeView
24−
25− property alias backColor : back.color
26− property var categoryView: null
27−
28− onMovementStarted: {
29− if (shell != undefined && shell.scopeStatus != undefined) {
30− shell.scopeStatus[scope.id].movementStarted++;
31− }
32− }
33− onPositionedAtBeginning: {
34− if (shell != undefined && shell.scopeStatus != undefined) {
35− shell.scopeStatus[scope.id].positionedAtBeginning++;
36− }
37− }
38−
39− Rectangle {
40− id: back
41− anchors.fill: parent
42− color: "grey"
43− z: -1
44− }
45−}
tests/qmltests/Dash/qml/fake_generic_scopeView.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−FakeScopeView {
20− id: fake_generic_scopeView
21− objectName: "fake_generic_scopeView"
22−
23− backColor: "#D0D0D0"
24−}
tests/qmltests/Dash/qml/fake_scopeView1.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−FakeScopeView {
20− id: fake_scopeView1
21− objectName: "fake_scopeView1"
22−
23− backColor: "#90E090"
24−}
tests/qmltests/Dash/qml/fake_scopeView2.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−FakeScopeView {
20− id: fake_scopeView2
21− objectName: "fake_scopeView2"
22−
23− backColor: "#A0D0A0"
24−}
tests/qmltests/Dash/qml/fake_scopeView3.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−FakeScopeView {
20− id: fake_scopeView3
21− objectName: "fake_scopeView3"
22−
23− backColor: "#B0C0B0"
24−}
tests/qmltests/Dash/qml/fake_scopeView4.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−FakeScopeView {
20− id: fake_scopeView4
21− objectName: "fake_scopeView4"
22−
23− backColor: "#C0C0C0"
24−}
tests/qmltests/Dash/tst_Dash.qml−11
@@ -41,16 +41,6 @@ Item {
4141 showScopeOnLoaded: "MockScope2"
4242 }
4343
44− ScopeDelegateMapper {
45− id: scopeDelegateMapper
46− scopeDelegateMapping: {
47− "MockScope1": Qt.resolvedUrl("qml/fake_scopeView1.qml"),
48− "MockScope2": Qt.resolvedUrl("qml/fake_scopeView2.qml"),
49− "clickscope": Qt.resolvedUrl("qml/fake_scopeView3.qml")
50− }
51− genericScope: Qt.resolvedUrl("qml/fake_generic_scopeView.qml")
52− }
53−
5444 UT.UnityTestCase {
5545 name: "Dash"
5646 when: windowShown
@@ -59,7 +49,6 @@ Item {
5949
6050 Component.onCompleted: {
6151 var dashContent = findChild(dash, "dashContent");
62− dashContent.scopeMapper = scopeDelegateMapper;
6352 scopes = dashContent.scopes;
6453 }
6554
tests/qmltests/Dash/tst_DashContent.qml+27−51
@@ -35,13 +35,6 @@ Item {
3535 property var panel: null
3636 // BEGIN To reduce warnings
3737
38− property var scopeStatus: {
39− 'MockScope1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
40− 'MockScope2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
41− 'clickscope': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
42− 'MockScope5': { 'movementStarted': 0, 'positionedAtBeginning': 0 }
43− }
44−
4538 Scopes {
4639 id: scopesModel
4740 }
@@ -55,34 +48,9 @@ Item {
5548 }
5649 scopes : scopesModel
5750
58− scopeMapper : scopeDelegateMapper
5951 searchHistory: SearchHistoryModel {}
6052 }
6153
62− ScopeDelegateMapper {
63− id: scopeDelegateMapper
64− scopeDelegateMapping: {
65− "MockScope1": Qt.resolvedUrl("qml/fake_scopeView1.qml"),
66− "MockScope2": Qt.resolvedUrl("qml/fake_scopeView2.qml"),
67− "clickscope": Qt.resolvedUrl("qml/fake_scopeView3.qml"),
68− }
69− genericScope: Qt.resolvedUrl("qml/fake_generic_scopeView.qml")
70− }
71−
72− function clear_scope_status() {
73− scopeStatus["MockScope1"].movementStarted = 0;
74− scopeStatus["MockScope1"].positionedAtBeginning = 0;
75−
76− scopeStatus["MockScope2"].movementStarted = 0;
77− scopeStatus["MockScope2"].positionedAtBeginning = 0;
78−
79− scopeStatus["clickscope"].movementStarted = 0;
80− scopeStatus["clickscope"].positionedAtBeginning = 0;
81−
82− scopeStatus["MockScope5"].movementStarted = 0;
83− scopeStatus["MockScope5"].positionedAtBeginning = 0;
84− }
85−
8654 SignalSpy {
8755 id: scopeLoadedSpy
8856 target: dashContent
@@ -97,7 +65,7 @@ Item {
9765
9866 UT.UnityTestCase {
9967 name: "DashContent"
100− when: scopesModel.loaded
68+ when: scopesModel.loaded && windowShown
10169
10270 function init() {
10371 scopesModel.clear();
@@ -108,7 +76,6 @@ Item {
10876
10977 function cleanup() {
11078 movementStartedSpy.clear();
111− clear_scope_status();
11279 dashContent.visible = true;
11380
11481 var dashContentList = findChild(dashContent, "dashContentList");
@@ -149,29 +116,38 @@ Item {
149116 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < 5);
150117 }
151118
152− function test_movement_started_signal() {
153− dashContent.setCurrentScopeAtIndex(3, true, false);
154−
119+ function test_show_header_on_list_movement() {
155120 var dashContentList = findChild(dashContent, "dashContentList");
156− verify(dashContentList != undefined)
121+ verify(dashContentList != undefined);
122+ var categoryListView = findChild(dashContentList, "categoryListView");
123+ verify(categoryListView != undefined);
124+
125+ waitForRendering(categoryListView);
157126
158− dashContentList.movementStarted();
127+ categoryListView.contentY = units.gu(11);
128+ console.log("contentY", categoryListView.contentY);
159129
160− compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
161− compare(scopeStatus["MockScope1"].movementStarted, 1, "MockScope1 should have emitted movementStarted signal when content list did.");
162− compare(scopeStatus["MockScope2"].movementStarted, 1, "MockScope2 should have emitted movementStarted signal when content list did.");
163− compare(scopeStatus["clickscope"].movementStarted, 1, "clickscope should have emitted movementStarted signal when content list did.");
164− compare(scopeStatus["MockScope5"].movementStarted, 1, "MockScope5 should have emitted movementStarted signal when content list did.");
130+ var startX = dashContentList.width/2;
131+ var startY = dashContentList.height/2;
132+ touchFlick(dashContentList, startX - units.gu(2), startY, startX, startY);
133+ tryCompare(categoryListView, "contentY", units.gu(11) - categoryListView.pageHeader.height);
165134 }
166135
167− function test_positioned_at_beginning_signal() {
168− dashContent.setCurrentScopeAtIndex(3, true, false);
136+ function test_set_current_scope_reset() {
137+ var dashContentList = findChild(dashContent, "dashContentList");
138+ verify(dashContentList != undefined);
139+ var categoryListView = findChild(dashContentList, "categoryListView");
140+ verify(categoryListView != undefined);
141+
142+ categoryListView.contentY = units.gu(10);
143+
144+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
145+ compare(categoryListView.contentY, units.gu(10));
146+
147+ dashContent.setCurrentScopeAtIndex(0, false, true);
169148
170− dashContent.positionedAtBeginning();
171− compare(scopeStatus["MockScope1"].positionedAtBeginning, 1, "MockScope1 should have emitted positionedAtBeginning signal when DashContent did.");
172− compare(scopeStatus["MockScope2"].positionedAtBeginning, 1, "MockScope2 should have emitted positionedAtBeginning signal when DashContent did.");
173− compare(scopeStatus["clickscope"].positionedAtBeginning, 1, "clickscope should have emitted positionedAtBeginning signal when DashContent did.");
174− compare(scopeStatus["MockScope5"].positionedAtBeginning, 1, "MockScope5 should have emitted positionedAtBeginning signal when DashContent did.");
149+ compare(dashContentList.currentItem.item.objectName, "MockScope1")
150+ compare(categoryListView.contentY, 0);
175151 }
176152
177153 // This tests that setting the current scope index will end up at the correct index even if
tests/qmltests/Dash/tst_GenericScopeView.qml+1−1
@@ -64,7 +64,7 @@ Item {
6464
6565 UT.UnityTestCase {
6666 name: "GenericScopeView"
67− when: scopes.loaded
67+ when: scopes.loaded && windowShown
6868
6969 function init() {
7070 genericScopeView.scope = scopes.get(2)
tests/qmltests/Launcher/tst_Launcher.qml+1
@@ -66,6 +66,7 @@ Item {
6666
6767 UT.UnityTestCase {
6868 id: revealer
69+ when: windowShown
6970
7071 function dragLauncherIntoView() {
7172 var startX = launcher.dragAreaWidth/2;
tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+1
@@ -44,6 +44,7 @@ Item {
4444
4545 UT.UnityTestCase {
4646 name: "MenuItemFactory"
47+ when: windowShown
4748
4849 property QtObject menuData: QtObject {
4950 property string label: "root"
tests/qmltests/Panel/Indicators/tst_MessageMenuItemFactory.qml+1
@@ -39,6 +39,7 @@ Item {
3939
4040 UT.UnityTestCase {
4141 name: "MessageMenuItemFactory"
42+ when: windowShown
4243
4344 property QtObject menuData: QtObject {
4445 property string label: "root"