on 5ea3c69 help sign in
debian/control+1
since splitsnapshots
unifiedsplit
@@ -32,6 +32,7 @@ Build-Depends: cmake,
32 libqmenumodel-dev (>= 0.2.12),
32 libqmenumodel-dev (>= 0.2.12),
33 libqtdbusmock1-dev (>= 0.7),
33 libqtdbusmock1-dev (>= 0.7),
34 libqtdbustest1-dev,
34 libqtdbustest1-dev,
35+ libqt5sql5-sqlite,
35 libqt5svg5-dev,
36 libqt5svg5-dev,
36 libqt5xmlpatterns5-dev,
37 libqt5xmlpatterns5-dev,
37 libsystemsettings-dev,
38 libsystemsettings-dev,
plugins/Utils/windowstatestorage.cpp+13−31
@@ -18,7 +18,6 @@
18
18
19#include <QtConcurrent>
19#include <QtConcurrent>
20#include <QDebug>
20#include <QDebug>
21−#include <QFutureSynchronizer>
22#include <QSqlQuery>
21#include <QSqlQuery>
23#include <QSqlError>
22#include <QSqlError>
24#include <QSqlResult>
23#include <QSqlResult>
@@ -33,24 +32,23 @@ inline QString sanitiseString(QString string) {
33 .remove(QLatin1Char('\\'));
32 .remove(QLatin1Char('\\'));
34}
33}
35
34
36−WindowStateStorage::WindowStateStorage(QObject *parent):
35+WindowStateStorage::WindowStateStorage(const QString& dbName, QObject *parent):
37 QObject(parent)
36 QObject(parent)
38{
37{
39 const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/");
38 const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/");
40 m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
39 m_db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"));
41 QDir dir;
40 QDir dir;
42 dir.mkpath(dbPath);
41 dir.mkpath(dbPath);
42+ if (dbName != nullptr) {
43+ m_db.setDatabaseName(dbName);
44+ } else {
43− m_db.setDatabaseName(dbPath + "windowstatestorage.sqlite");
45+ m_db.setDatabaseName(dbPath + "windowstatestorage.sqlite");
46+ }
44 initdb();
47 initdb();
45}
48}
46
49
47WindowStateStorage::~WindowStateStorage()
50WindowStateStorage::~WindowStateStorage()
48{
51{
49− QFutureSynchronizer<void> futureSync;
50− for (int i = 0; i < m_asyncQueries.count(); ++i) {
51− futureSync.addFuture(m_asyncQueries[i]);
52− }
53− futureSync.waitForFinished();
54 m_db.close();
52 m_db.close();
55}
53}
56
54
@@ -110,19 +108,6 @@ int WindowStateStorage::getStage(const QString &appId, int defaultValue) const
110 return query.value("stage").toInt();
108 return query.value("stage").toInt();
111}
109}
112
110
113−void WindowStateStorage::executeAsyncQuery(const QString &queryString)
114−{
115− QMutexLocker l(&s_mutex);
116− QSqlQuery query;
117−
118− bool ok = query.exec(queryString);
119− if (!ok) {
120− qWarning() << "Error executing query" << queryString
121− << "Driver error:" << query.lastError().driverText()
122− << "Database error:" << query.lastError().databaseText();
123− }
124−}
125−
126QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defaultValue) const
111QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defaultValue) const
127{
112{
128 QString queryString = QStringLiteral("SELECT * FROM geometry WHERE windowId = '%1';")
113 QString queryString = QStringLiteral("SELECT * FROM geometry WHERE windowId = '%1';")
@@ -171,16 +156,13 @@ void WindowStateStorage::initdb()
171void WindowStateStorage::saveValue(const QString &queryString)
156void WindowStateStorage::saveValue(const QString &queryString)
172{
157{
173 QMutexLocker mutexLocker(&s_mutex);
158 QMutexLocker mutexLocker(&s_mutex);
174−
159+ QSqlQuery query;
175− QFuture<void> future = QtConcurrent::run(&m_threadPool, executeAsyncQuery, queryString);
160+ auto ok = query.exec(queryString);
176− m_asyncQueries.append(future);
161+ if (!ok) {
177−
162+ qWarning() << "Error executing query" << queryString
178− QFutureWatcher<void> *futureWatcher = new QFutureWatcher<void>();
163+ << "Driver error:" << query.lastError().driverText()
179− futureWatcher->setFuture(future);
164+ << "Database error:" << query.lastError().databaseText();
180− connect(futureWatcher, &QFutureWatcher<void>::finished,
165+ }
181− this,
182− [=](){ m_asyncQueries.removeAll(futureWatcher->future());
183− futureWatcher->deleteLater(); });
184}
166}
185
167
186QSqlQuery WindowStateStorage::getValue(const QString &queryString) const
168QSqlQuery WindowStateStorage::getValue(const QString &queryString) const
plugins/Utils/windowstatestorage.h+1−7
@@ -17,8 +17,6 @@
17#include <QObject>
17#include <QObject>
18#include <QSqlDatabase>
18#include <QSqlDatabase>
19#include <QMutex>
19#include <QMutex>
20−#include <QFuture>
21−#include <QThreadPool>
22
20
23// unity-api
21// unity-api
24#include <unity/shell/application/Mir.h>
22#include <unity/shell/application/Mir.h>
@@ -46,7 +44,7 @@ public:
46 Q_DECLARE_FLAGS(WindowStates, WindowState)
44 Q_DECLARE_FLAGS(WindowStates, WindowState)
47 Q_FLAG(WindowStates)
45 Q_FLAG(WindowStates)
48
46
49− WindowStateStorage(QObject *parent = nullptr);
47+ WindowStateStorage(const QString& dbName = nullptr, QObject *parent = nullptr);
50 virtual ~WindowStateStorage();
48 virtual ~WindowStateStorage();
51
49
52 Q_INVOKABLE void saveState(const QString &windowId, WindowState state);
50 Q_INVOKABLE void saveState(const QString &windowId, WindowState state);
@@ -66,12 +64,8 @@ private:
66 void saveValue(const QString &queryString);
64 void saveValue(const QString &queryString);
67 QSqlQuery getValue(const QString &queryString) const;
65 QSqlQuery getValue(const QString &queryString) const;
68
66
69− static void executeAsyncQuery(const QString &queryString);
70 static QMutex s_mutex;
67 static QMutex s_mutex;
71
68
72 // NB: This is accessed from threads. Make sure to mutex it.
69 // NB: This is accessed from threads. Make sure to mutex it.
73 QSqlDatabase m_db;
70 QSqlDatabase m_db;
74−
75− QList<QFuture<void>> m_asyncQueries;
76− QThreadPool m_threadPool;
77};
71};
qml/ApplicationMenus/ApplicationMenuItemFactory.qml+6−6
@@ -45,7 +45,7 @@ Object {
45
45
46 Action {
46 Action {
47 id: action
47 id: action
48− text: menuData.label.replace("_", "&")
48+ text: menuData ? menuData.label.replace("_", "&") : ""
49 }
49 }
50
50
51 ListItemLayout {
51 ListItemLayout {
@@ -53,14 +53,14 @@ Object {
53 title.text: action.text
53 title.text: action.text
54
54
55 Icon {
55 Icon {
56− source: menuData && menuData.icon || ""
56+ source: menuData ? menuData.icon : ""
57 SlotsLayout.position: SlotsLayout.Leading
57 SlotsLayout.position: SlotsLayout.Leading
58 height: units.gu(3)
58 height: units.gu(3)
59 }
59 }
60
60
61 Label {
61 Label {
62− text: menuData.shortcut
62+ text: menuData ? menuData.shortcut : ""
63− visible: menuData.shortcut && QuickUtils.keyboardAttached
63+ visible: menuData && menuData.shortcut && QuickUtils.keyboardAttached
64 SlotsLayout.position: SlotsLayout.Trailing
64 SlotsLayout.position: SlotsLayout.Trailing
65 color: enabled ? theme.palette.normal.backgroundSecondaryText :
65 color: enabled ? theme.palette.normal.backgroundSecondaryText :
66 theme.palette.disabled.backgroundSecondaryText
66 theme.palette.disabled.backgroundSecondaryText
@@ -86,7 +86,7 @@ Object {
86
86
87 Action {
87 Action {
88 id: action
88 id: action
89− text: menuData.label.replace("_", "&")
89+ text: menuData ? menuData.label.replace("_", "&") : ""
90 }
90 }
91
91
92 ListItemLayout {
92 ListItemLayout {
@@ -94,7 +94,7 @@ Object {
94 title.text: action.text
94 title.text: action.text
95
95
96 Icon {
96 Icon {
97− source: menuData && menuData.icon || ""
97+ source: menuData ? menuData.icon : ""
98 SlotsLayout.position: SlotsLayout.Leading
98 SlotsLayout.position: SlotsLayout.Leading
99 height: units.gu(3)
99 height: units.gu(3)
100 }
100 }
qml/Components/ResponsiveGridView.qmldeleted−98
@@ -1,98 +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.4
18−import Ubuntu.Components 1.3
19−import "."
20−
21−/*
22− Essentially a GridView
23− */
24−Item {
25− property int minimumHorizontalSpacing: units.gu(0.5)
26− readonly property int columns: gridView.columns
27− property alias verticalSpacing: gridView.verticalSpacing
28− readonly property alias margins: gridView.margin
29− property int delegateWidth
30− property int delegateHeight
31− property alias model: gridView.model
32− property alias delegate: gridView.delegate
33− readonly property int cellWidth: gridView.cellWidth
34− readonly property int cellHeight: gridView.cellHeight
35− readonly property int totalContentHeight: {
36− if (gridView.model) {
37− return contentHeightForRows(Math.ceil(gridView.model.count / columns), cellHeight)
38− } else {
39− return 0;
40− }
41− }
42− property alias interactive: gridView.interactive
43− readonly property alias flicking: gridView.flicking
44− readonly property alias moving: gridView.moving
45− readonly property alias pressDelay: gridView.pressDelay
46− readonly property alias originY: gridView.originY
47− property alias displayMarginBeginning: gridView.displayMarginBeginning
48− property alias displayMarginEnd: gridView.displayMarginEnd
49− property alias highlightIndex: gridView.highlightIndex
50− property alias cacheBuffer: gridView.cacheBuffer
51− readonly property alias currentItem: gridView.currentItem
52−
53− function contentHeightForRows(rows, height) {
54− return rows * height
55− }
56−
57− GridView {
58− id: gridView
59− objectName: "responsiveGridViewGrid"
60− anchors {
61− fill: parent
62− leftMargin: margin/2
63− rightMargin: margin/2
64− }
65− clip: parent.height != totalContentHeight
66−
67− function pixelToGU(value) {
68− return Math.floor(value / units.gu(1));
69− }
70−
71− function spacingForColumns(columns) {
72− // spacing between columns as an integer number of GU, the remainder goes in the margins
73− var spacingGU = pixelToGU(allocatableHorizontalSpace / columns);
74− return units.gu(spacingGU);
75− }
76−
77− function columnsForSpacing(spacing) {
78− // minimum margin is half of the spacing
79− return Math.max(1, Math.floor(parent.width / (delegateWidth + spacing)));
80− }
81−
82− property real allocatableHorizontalSpace: parent.width - columns * delegateWidth
83− property int columns: columnsForSpacing(minimumHorizontalSpacing)
84− property real horizontalSpacing: spacingForColumns(columns)
85− property real verticalSpacing: horizontalSpacing
86− property int margin: allocatableHorizontalSpace - columns * horizontalSpacing
87− property int highlightIndex: -1
88−
89− cellWidth: delegateWidth + horizontalSpacing
90− cellHeight: delegateHeight + verticalSpacing
91−
92− onHighlightIndexChanged: {
93− if (highlightIndex != -1) {
94− currentIndex = highlightIndex
95− }
96− }
97− }
98−}
qml/Launcher/LauncherDelegate.qml+1−1
@@ -37,7 +37,7 @@ Item {
37
37
38 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
38 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
39 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
39 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
40− readonly property alias wiggling: wiggleAnim.running
40+ readonly property alias wiggling: root.alerting
41
41
42 property int itemWidth
42 property int itemWidth
43 property int itemHeight
43 property int itemHeight
qml/Launcher/LauncherPanel.qml+1−1
@@ -556,7 +556,7 @@ Rectangle {
556
556
557 function processPositionChanged(mouse) {
557 function processPositionChanged(mouse) {
558 if (draggedIndex >= 0) {
558 if (draggedIndex >= 0) {
559− if (!selectedItem.dragging) {
559+ if (selectedItem && !selectedItem.dragging) {
560 var distance = Math.max(Math.abs(mouse.x - startX), Math.abs(mouse.y - startY))
560 var distance = Math.max(Math.abs(mouse.x - startX), Math.abs(mouse.y - startY))
561 if (!preDragging && distance > units.gu(1.5)) {
561 if (!preDragging && distance > units.gu(1.5)) {
562 preDragging = true;
562 preDragging = true;
qml/Panel/Indicators/IndicatorsLight.qml+2−2
@@ -204,11 +204,11 @@ console.log("no support for Multicolor LED. " + indicatorState)
204 property variant deviceState: action("device-state").state
204 property variant deviceState: action("device-state").state
205 Component.onCompleted: start()
205 Component.onCompleted: start()
206 onBatteryLevelChanged: {
206 onBatteryLevelChanged: {
207− root.batteryLevel = batteryLevel
207+ root.batteryLevel = batteryLevel ? batteryLevel : 0.00
208 updateLightState("onBatteryLevelChanged")
208 updateLightState("onBatteryLevelChanged")
209 }
209 }
210 onDeviceStateChanged: {
210 onDeviceStateChanged: {
211− root.deviceState = deviceState
211+ root.deviceState = deviceState ? deviceState : "unknown"
212 updateLightState("onDeviceStateChanged")
212 updateLightState("onDeviceStateChanged")
213 }
213 }
214 }
214 }
qml/Shell.qml+1−1
@@ -90,7 +90,7 @@ StyledItem {
90 } else if (showingGreeter || notifications.topmostIsFullscreen) {
90 } else if (showingGreeter || notifications.topmostIsFullscreen) {
91 return Qt.PrimaryOrientation;
91 return Qt.PrimaryOrientation;
92 } else {
92 } else {
93− return shell.orientations.map(stage.supportedOrientations);
93+ return shell.orientations ? shell.orientations.map(stage.supportedOrientations) : Qt.PrimaryOrientation;
94 }
94 }
95 }
95 }
96
96
qml/Stage/Stage.qml+2−2
@@ -2207,8 +2207,8 @@ FocusScope {
2207 consumesInput: false
2207 consumesInput: false
2208 interactive: false
2208 interactive: false
2209 focus: false
2209 focus: false
2210− requestedWidth: appDelegate.requestedWidth
2210+ requestedWidth: appDelegate ? appDelegate.requestedWidth : 0
2211− requestedHeight: appDelegate.requestedHeight
2211+ requestedHeight: appDelegate ? appDelegate.requestedHeight : 0
2212
2212
2213 width: units.gu(40)
2213 width: units.gu(40)
2214 height: units.gu(40)
2214 height: units.gu(40)
qml/Stage/WindowDecoration.qml+5−6
@@ -99,13 +99,12 @@ MouseArea {
99 spacing: units.gu(3)
99 spacing: units.gu(3)
100
100
101 WindowControlButtons {
101 WindowControlButtons {
102+ Layout.fillHeight: true
103+ Layout.fillWidth: false
104+ Layout.topMargin: units.gu(0.5)
105+ Layout.bottomMargin: units.gu(0.5)
106+
102 id: buttons
107 id: buttons
103− anchors {
104− top: parent.top
105− bottom: parent.bottom
106− topMargin: units.gu(0.5)
107− bottomMargin: units.gu(0.5)
108− }
109 active: root.active
108 active: root.active
110 onCloseClicked: root.closeClicked();
109 onCloseClicked: root.closeClicked();
111 onMinimizeClicked: root.minimizeClicked();
110 onMinimizeClicked: root.minimizeClicked();
qml/Wizard/Pages/50-timezone.qml+9−11
@@ -174,10 +174,9 @@ LocalComponents.Page {
174 width: Math.min(parent.width, units.gu(34))
174 width: Math.min(parent.width, units.gu(34))
175
175
176 LocalComponents.WizardTextField {
176 LocalComponents.WizardTextField {
177+ Layout.fillWidth: true
177 id: searchField
178 id: searchField
178 objectName: "tzFilter"
179 objectName: "tzFilter"
179− anchors.left: parent.left
180− anchors.right: parent.right
181 anchors.leftMargin: !showingMap && !wideMode ? staticMargin : undefined
180 anchors.leftMargin: !showingMap && !wideMode ? staticMargin : undefined
182 anchors.rightMargin: !showingMap && !wideMode ? staticMargin : undefined
181 anchors.rightMargin: !showingMap && !wideMode ? staticMargin : undefined
183 placeholderText: i18n.tr("Enter your city")
182 placeholderText: i18n.tr("Enter your city")
@@ -186,12 +185,11 @@ LocalComponents.Page {
186 }
185 }
187
186
188 ListView {
187 ListView {
188+ Layout.fillWidth: true
189 Layout.fillHeight: true
189 Layout.fillHeight: true
190 id: tzList
190 id: tzList
191 objectName: "tzList"
191 objectName: "tzList"
192 clip: true
192 clip: true
193− anchors.left: parent.left
194− anchors.right: parent.right
195 currentIndex: -1
193 currentIndex: -1
196 model: TimeZoneModel {
194 model: TimeZoneModel {
197 id: timeZoneModel
195 id: timeZoneModel
@@ -199,14 +197,14 @@ LocalComponents.Page {
199 country: i18n.language.split('_')[1].split('.')[0]
197 country: i18n.language.split('_')[1].split('.')[0]
200 }
198 }
201 delegate: tzComponent
199 delegate: tzComponent
202− }
203
200
204− ActivityIndicator {
201+ ActivityIndicator {
205− anchors.centerIn: tzList
202+ anchors.centerIn: parent
206− running: tzList.count == 0 &&
203+ running: tzList.count == 0 &&
207− searchField.length > 0 &&
204+ searchField.length > 0 &&
208− timeZoneModel.listUpdating
205+ timeZoneModel.listUpdating
209− visible: running
206+ visible: running
207+ }
210 }
208 }
211 }
209 }
212
210
tests/mocks/Unity/ApplicationMenu/mockapplicationmenuregistry.cpp+2−2
@@ -41,7 +41,7 @@ void MockApplicationMenuRegistry::RegisterSurfaceMenu(const QString &surface,
41 service);
41 service);
42}
42}
43
43
44−void MockApplicationMenuRegistry::UnregisterSurfaceMenu(const QString &surfaceId, const QDBusObjectPath &menuObjectPath)
44+void MockApplicationMenuRegistry::UnregisterSurfaceMenu(const QString &surfaceId, const QString &menuObjectPath)
45{
45{
46− ApplicationMenuRegistry::UnregisterSurfaceMenu(surfaceId, menuObjectPath);
46+ ApplicationMenuRegistry::UnregisterSurfaceMenu(surfaceId, QDBusObjectPath(menuObjectPath));
47}
47}
tests/mocks/Unity/ApplicationMenu/mockapplicationmenuregistry.h+1−1
@@ -32,7 +32,7 @@ public:
32 const QString &service);
32 const QString &service);
33
33
34 Q_INVOKABLE void UnregisterSurfaceMenu(const QString &surfaceId,
34 Q_INVOKABLE void UnregisterSurfaceMenu(const QString &surfaceId,
35− const QDBusObjectPath &menuObjectPath);
35+ const QString &menuObjectPath);
36
36
37private:
37private:
38 MockApplicationMenuRegistry(QObject *parent = 0);
38 MockApplicationMenuRegistry(QObject *parent = 0);
tests/plugins/Utils/WindowStateStorageTest.cpp+1−1
@@ -30,7 +30,7 @@ private Q_SLOTS:
30
30
31 void init()
31 void init()
32 {
32 {
33− storage = new WindowStateStorage(this);
33+ storage = new WindowStateStorage(":memory:", this);
34 }
34 }
35
35
36 void cleanup()
36 void cleanup()
tests/qmltests/CMakeLists.txt−1
@@ -20,7 +20,6 @@ add_unity8_qmltest(Components MediaServices)
20add_unity8_qmltest(Components ModeSwitchWarningDialog)
20add_unity8_qmltest(Components ModeSwitchWarningDialog)
21add_unity8_qmltest(Components PhysicalKeysMapper)
21add_unity8_qmltest(Components PhysicalKeysMapper)
22add_unity8_qmltest(Components Rating)
22add_unity8_qmltest(Components Rating)
23−add_unity8_qmltest(Components ResponsiveGridView)
24add_unity8_qmltest(Components SharingPicker)
23add_unity8_qmltest(Components SharingPicker)
25add_unity8_qmltest(Components Showable)
24add_unity8_qmltest(Components Showable)
26add_unity8_qmltest(Components VirtualTouchPad)
25add_unity8_qmltest(Components VirtualTouchPad)
tests/qmltests/Components/tst_ResponsiveGridView.qmldeleted−157
@@ -1,157 +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.4
18−import QtTest 1.0
19−import ".."
20−import "../../../qml/Components"
21−import Ubuntu.Components.ListItems 1.3 as ListItem
22−import Ubuntu.Components 1.3
23−import Unity.Test 0.1 as UT
24−
25−Item {
26− width: gridRect.width + controls.width
27− height: units.gu(80)
28−
29− Column {
30− id: controls
31− width: units.gu(40)
32− height: parent.height
33− anchors.top: parent.top
34− anchors.right: parent.right
35− ListItem.ValueSelector {
36− id: minHSpacingSelector
37− text: "minHorizontalSpacing"
38− values: [0,units.gu(2),units.gu(8),units.gu(25)]
39− selectedIndex: 0
40− }
41− }
42−
43− ListModel {
44− id: fakeModel
45− ListElement { name: "A" }
46− ListElement { name: "B" }
47− ListElement { name: "C" }
48− ListElement { name: "D" }
49− ListElement { name: "E" }
50− ListElement { name: "F" }
51− ListElement { name: "G" }
52− ListElement { name: "H" }
53− ListElement { name: "I" }
54− ListElement { name: "J" }
55− ListElement { name: "K" }
56− ListElement { name: "L" }
57− ListElement { name: "M" }
58− ListElement { name: "N" }
59− ListElement { name: "O" }
60− ListElement { name: "P" }
61− ListElement { name: "Q" }
62− ListElement { name: "R" }
63− ListElement { name: "S" }
64− ListElement { name: "T" }
65− ListElement { name: "U" }
66− }
67−
68− Rectangle {
69− id: gridRect
70− width: units.gu(80)
71− height: parent.height
72− color: "grey"
73− anchors.top: parent.top
74− anchors.left: parent.left
75−
76− ResponsiveGridView {
77− id: grid
78− anchors.fill: parent
79− model: fakeModel
80− minimumHorizontalSpacing:
81− minHSpacingSelector.values[minHSpacingSelector.selectedIndex]
82− verticalSpacing: units.gu(2)
83− delegateWidth: units.gu(6)
84− delegateHeight: units.gu(6)
85−
86− delegate: Rectangle {
87− // So that it can be identified by test code
88− property bool isGridDelegate: true
89− color: "grey"
90− border.color: "red"
91− border.width: 1
92−
93− // IMPORTANT: always use grid's cellWidth and cellHeight here to get
94− // ResponsiveGridView's intended result
95− width: grid.cellWidth
96− height: grid.cellHeight
97−
98− Rectangle {
99− color: "green"
100− anchors.centerIn: parent
101− width: units.gu(6)
102− height: units.gu(6)
103− Text {
104− anchors.centerIn: parent
105− text: name
106− }
107− }
108−
109− Text { x:0; y:0; text:"(" + parent.x + ", " + parent.y + ")"}
110− }
111− }
112− }
113−
114− UT.UnityTestCase {
115− name: "ResponsiveGridView"
116− when: windowShown
117−
118− function test_minimumHorizontalSpacing_data() {
119− var data = new Array()
120−
121− data.push({selectedIndex: 0, minHSpacing:0, columnCount: 13})
122− data.push({selectedIndex: 1, minHSpacing:units.gu(2), columnCount: 10})
123− data.push({selectedIndex: 2, minHSpacing:units.gu(8), columnCount: 5})
124− data.push({selectedIndex: 3, minHSpacing:units.gu(25), columnCount: 2})
125−
126− return data
127− }
128−
129− /* Change ResponsiveGridView's minimumHorizontalSpacing property and check
130− that the resulting number of columns matches expectations */
131− function test_minimumHorizontalSpacing(data) {
132− // sanity checks
133− compare(minHSpacingSelector.values[data.selectedIndex], data.minHSpacing)
134−
135− minHSpacingSelector.selectedIndex = data.selectedIndex
136− tryCompareFunction(countGridDelegatesOnFirstRow, data.columnCount);
137− compare(grid.columns, data.columnCount)
138− }
139−
140−
141− function countGridDelegatesOnFirstRow() {
142− return __countGridDelegatesOnFirstRow(grid.visibleChildren, 0)
143− }
144−
145− function __countGridDelegatesOnFirstRow(objList, total) {
146− for (var i = 0; i < objList.length; ++i) {
147− var child = objList[i];
148− if (child.isGridDelegate !== undefined && child.y === 0) {
149− ++total;
150− } else {
151− total = __countGridDelegatesOnFirstRow(child.visibleChildren, total)
152− }
153− }
154− return total
155− }
156− }
157−}
tests/qmltests/Launcher/tst_Launcher.qml+4−4
@@ -1015,7 +1015,7 @@ Rectangle {
1015 // Doing longpress
1015 // Doing longpress
1016 mousePress(clickedItem)
1016 mousePress(clickedItem)
1017 tryCompare(clickedItem, "itemOpacity", 0) // Wait for longpress to happen
1017 tryCompare(clickedItem, "itemOpacity", 0) // Wait for longpress to happen
1018− verify(quickList, "state", "open")
1018+ tryCompare(quickList, "state", "open")
1019
1019
1020 launcher.hide();
1020 launcher.hide();
1021
1021
@@ -1035,13 +1035,13 @@ Rectangle {
1035 // Doing RMB click
1035 // Doing RMB click
1036 mouseClick(clickedItem, clickedItem.width / 2, clickedItem.height / 2, Qt.RightButton)
1036 mouseClick(clickedItem, clickedItem.width / 2, clickedItem.height / 2, Qt.RightButton)
1037 tryCompare(quickListShape, "visible", true)
1037 tryCompare(quickListShape, "visible", true)
1038− verify(quickList, "state", "open")
1038+ tryCompare(quickList, "state", "open")
1039− verify(dndArea, "dragging", false)
1039+ tryCompare(dndArea, "dragging", false)
1040
1040
1041 // Click somewhere in the empty space to dismiss the quicklist
1041 // Click somewhere in the empty space to dismiss the quicklist
1042 mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
1042 mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
1043 tryCompare(quickListShape, "visible", false);
1043 tryCompare(quickListShape, "visible", false);
1044− verify(quickList, "state", "")
1044+ tryCompare(quickList, "state", "")
1045 }
1045 }
1046
1046
1047 function test_revealByEdgePush() {
1047 function test_revealByEdgePush() {
tests/qmltests/Stage/ApplicationCheckBox.qml+6−6
@@ -95,11 +95,12 @@ Column {
95 }
95 }
96 }
96 }
97 Label {
97 Label {
98+ Layout.alignment: Qt.AlignVCenter
98 id: appIdLabel
99 id: appIdLabel
99 text: root.appId
100 text: root.appId
100− anchors.verticalCenter: parent.verticalCenter
101 }
101 }
102 Rectangle {
102 Rectangle {
103+ Layout.alignment: Qt.AlignVCenter
103 color: {
104 color: {
104 if (d.application) {
105 if (d.application) {
105 if (d.application.state === ApplicationInfoInterface.Starting) {
106 if (d.application.state === ApplicationInfoInterface.Starting) {
@@ -117,13 +118,12 @@ Column {
117 }
118 }
118 width: height
119 width: height
119 height: appIdLabel.height * 0.7
120 height: appIdLabel.height * 0.7
120− anchors.verticalCenter: parent.verticalCenter
121 }
121 }
122
122
123 MouseArea {
123 MouseArea {
124+ Layout.alignment: Qt.AlignVCenter
124 width: height
125 width: height
125 height: appIdLabel.height * 0.7
126 height: appIdLabel.height * 0.7
126− anchors.verticalCenter: parent.verticalCenter
127 onClicked: root.createSurface()
127 onClicked: root.createSurface()
128 enabled: d.application && d.application.state === ApplicationInfoInterface.Running
128 enabled: d.application && d.application.state === ApplicationInfoInterface.Running
129 visible: enabled
129 visible: enabled
@@ -146,16 +146,16 @@ Column {
146 text: promptCount + " prompts"
146 text: promptCount + " prompts"
147 }
147 }
148 MouseArea {
148 MouseArea {
149+ Layout.alignment: Qt.AlignVCenter
149 width: height
150 width: height
150 height: promptsLabel.height * 0.7
151 height: promptsLabel.height * 0.7
151− anchors.verticalCenter: parent.verticalCenter
152 onClicked: d.application.createPromptSurface()
152 onClicked: d.application.createPromptSurface()
153 Label { text: "➕"; anchors.centerIn: parent }
153 Label { text: "➕"; anchors.centerIn: parent }
154 }
154 }
155 MouseArea {
155 MouseArea {
156+ Layout.alignment: Qt.AlignVCenter
156 width: height
157 width: height
157 height: promptsLabel.height * 0.7
158 height: promptsLabel.height * 0.7
158− anchors.verticalCenter: parent.verticalCenter
159 onClicked: d.application.promptSurfaceList.get(0).close()
159 onClicked: d.application.promptSurfaceList.get(0).close()
160 enabled: d.application && d.application.promptSurfaceList.count > 0
160 enabled: d.application && d.application.promptSurfaceList.count > 0
161 Label { text: "➖"; anchors.centerIn: parent; enabled: parent.enabled }
161 Label { text: "➖"; anchors.centerIn: parent; enabled: parent.enabled }
@@ -173,9 +173,9 @@ Column {
173 text: "- " + model.surface.name
173 text: "- " + model.surface.name
174 }
174 }
175 MouseArea {
175 MouseArea {
176+ Layout.alignment: Qt.AlignVCenter
176 width: height
177 width: height
177 height: appIdLabel.height * 0.7
178 height: appIdLabel.height * 0.7
178− anchors.verticalCenter: parent.verticalCenter
179 enabled: model.surface.live
179 enabled: model.surface.live
180 visible: enabled
180 visible: enabled
181 onClicked: model.surface.setLive(false);
181 onClicked: model.surface.setLive(false);
tests/qmltests/Stage/tst_PhoneStage.qml+5−4
@@ -251,10 +251,11 @@ Item {
251 var appsToTest = 6;
251 var appsToTest = 6;
252 var apps = new Array();
252 var apps = new Array();
253 for (var i = 0; i < appsToTest; i++) {
253 for (var i = 0; i < appsToTest; i++) {
254− var item = new Object();
254+ var item = {
255− item.tag = "App " + i;
255+ tag: "App " + i,
256− item.index = i;
256+ index: i,
257− item.total = appsToTest;
257+ total: appsToTest
258+ };
258 apps.push(item)
259 apps.push(item)
259 }
260 }
260 return apps;
261 return apps;
tests/qmltests/tst_OrientedShell.qml+1−1
@@ -914,7 +914,7 @@ Rectangle {
914 compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
914 compare(twitterApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
915 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
915 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
916
916
917− tryCompare(twitterDelegate, "orientationChangesEnabled", true);
917+ tryCompare(twitterDelegate, "orientationChangesEnabled", false);
918
918
919 var decoratedWindow = findChild(twitterDelegate, "decoratedWindow");
919 var decoratedWindow = findChild(twitterDelegate, "decoratedWindow");
920 verify(decoratedWindow);
920 verify(decoratedWindow);
tests/utils/modules/Unity/Test/MouseTouchEmulationCheckbox.qml+1−1
@@ -37,9 +37,9 @@ RowLayout {
37 activeFocusOnPress: false
37 activeFocusOnPress: false
38 }
38 }
39 Label {
39 Label {
40+ Layout.alignment: Qt.AlignVCenter
40 id: label
41 id: label
41 text: "Mouse emulates touch"
42 text: "Mouse emulates touch"
42− anchors.verticalCenter: parent.verticalCenter
43 AbstractButton {
43 AbstractButton {
44 anchors.fill: parent
44 anchors.fill: parent
45 onClicked: checkbox.checked = !checkbox.checked
45 onClicked: checkbox.checked = !checkbox.checked