on xenial help sign in
Merge trunk
b9bc8a3Michał Sawicz
debian/changelog+36
@@ -1,3 +1,39 @@
1+unity8 (7.84+14.04.20140314-0ubuntu1) trusty; urgency=low
2+
3+ [ Michał Sawicz ]
4+ * Fix tests under Qt 5.2.
5+ * CardHeader improvements depending on background. Also drop prices,
6+ they need to be reworked into attributes.
7+ * Bring Cards closer to design
8+ * Add back the workaround for not being able scroll the image gallery
9+ Taken from AppPreview.qml (LP: #1281709)
10+ * Only allow searching when preview isn't open. (LP: #1282475)
11+ * Adds carousel dynamic switch
12+
13+ [ Leo Arias ]
14+ * Update the url dispatcher test to use the fake app fixture from the
15+ toolkit.
16+
17+ [ Albert Astals ]
18+ * Fix tests under Qt 5.2.
19+ * Workaround compiz/unity7 behaviour change/bug
20+
21+ [ Michael Zanetti ]
22+ * Fix tests under Qt 5.2.
23+ * Disable HUD from the bottom edge.
24+
25+ [ Andrea Cimitan ]
26+ * Adds carousel dynamic switch
27+
28+ [ CI bot ]
29+ * Resync trunk
30+
31+ [ Michał Karnicki ]
32+ * CardHeader improvements depending on background. Also drop prices,
33+ they need to be reworked into attributes.
34+
35+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 14 Mar 2014 15:46:10 +0000
36+
1unity8 (7.84+14.04.20140307-0ubuntu1) trusty; urgency=low
37unity8 (7.84+14.04.20140307-0ubuntu1) trusty; urgency=low
2
38
3 * New rebuild forced
39 * New rebuild forced
plugins/DashViews/listviewwithpageheader.cpp+33−10
@@ -91,6 +91,7 @@
91
91
92#include "listviewwithpageheader.h"
92#include "listviewwithpageheader.h"
93
93
94+#include <QCoreApplication>
94#include <QDebug>
95#include <QDebug>
95#include <qqmlinfo.h>
96#include <qqmlinfo.h>
96#include <qqmlengine.h>
97#include <qqmlengine.h>
@@ -477,6 +478,11 @@ void ListViewWithPageHeader::componentComplete()
477 polish();
478 polish();
478}
479}
479
480
481+static inline bool uFuzzyCompare(qreal r1, qreal r2)
482+{
483+ return qFuzzyCompare(r1, r2) || (qFuzzyIsNull(r1) && qFuzzyIsNull(r2));
484+}
485+
480void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
486void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
481{
487{
482 // Check we are not being taken down and don't paint anything
488 // Check we are not being taken down and don't paint anything
@@ -491,11 +497,7 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
491 const bool showHeaderAnimationRunning = m_contentYAnimation->isRunning() && contentYAnimationType == ContentYAnimationShowHeader;
497 const bool showHeaderAnimationRunning = m_contentYAnimation->isRunning() && contentYAnimationType == ContentYAnimationShowHeader;
492 if (m_headerItem) {
498 if (m_headerItem) {
493 const auto oldHeaderItemShownHeight = m_headerItemShownHeight;
499 const auto oldHeaderItemShownHeight = m_headerItemShownHeight;
494− if (contentY() < -m_minYExtent) {
500+ if (uFuzzyCompare(contentY(), -m_minYExtent) || contentY() > -m_minYExtent) {
495− // Stick the header item to the top when dragging down
496− m_headerItem->setY(contentY());
497− m_headerItem->setHeight(m_headerItem->implicitHeight() + (-m_minYExtent - contentY()));
498− } else {
499 m_headerItem->setHeight(m_headerItem->implicitHeight());
501 m_headerItem->setHeight(m_headerItem->implicitHeight());
500 // We are going down (but it's not because of the rebound at the end)
502 // We are going down (but it's not because of the rebound at the end)
501 // (but the header was not shown by it's own position)
503 // (but the header was not shown by it's own position)
@@ -509,21 +511,32 @@ void ListViewWithPageHeader::viewportMoved(Qt::Orientations orient)
509 m_headerItemShownHeight = 0;
511 m_headerItemShownHeight = 0;
510 m_headerItem->setY(-m_minYExtent);
512 m_headerItem->setY(-m_minYExtent);
511 } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0) || m_inContentHeightKeepHeaderShown) {
513 } else if ((scrolledUp && notRebounding && notShownByItsOwn && !maximizeVisibleAreaRunning) || (m_headerItemShownHeight > 0) || m_inContentHeightKeepHeaderShown) {
514+ if (maximizeVisibleAreaRunning && diff > 0) {
512− if (maximizeVisibleAreaRunning && diff > 0) // If we are maximizing and the header was shown, make sure we hide it
515+ // If we are maximizing and the header was shown, make sure we hide it
513 m_headerItemShownHeight -= diff;
516 m_headerItemShownHeight -= diff;
514− else
517+ } else {
515 m_headerItemShownHeight += diff;
518 m_headerItemShownHeight += diff;
519+ }
516− if (contentY() == -m_minYExtent) {
520+ if (uFuzzyCompare(contentY(), -m_minYExtent)) {
517 m_headerItemShownHeight = 0;
521 m_headerItemShownHeight = 0;
518 } else {
522 } else {
519 m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, m_headerItem->height());
523 m_headerItemShownHeight = qBound(static_cast<qreal>(0.), m_headerItemShownHeight, m_headerItem->height());
520 }
524 }
521 if (m_headerItemShownHeight > 0) {
525 if (m_headerItemShownHeight > 0) {
526+ if (uFuzzyCompare(m_headerItem->height(), m_headerItemShownHeight)) {
527+ m_headerItem->setY(contentY());
528+ m_headerItemShownHeight = m_headerItem->height();
529+ } else {
522− m_headerItem->setY(contentY() - m_headerItem->height() + m_headerItemShownHeight);
530+ m_headerItem->setY(contentY() - m_headerItem->height() + m_headerItemShownHeight);
531+ }
523 } else {
532 } else {
524 m_headerItem->setY(-m_minYExtent);
533 m_headerItem->setY(-m_minYExtent);
525 }
534 }
526 }
535 }
536+ } else {
537+ // Stick the header item to the top when dragging down
538+ m_headerItem->setY(contentY());
539+ m_headerItem->setHeight(m_headerItem->implicitHeight() + (-m_minYExtent - contentY()));
527 }
540 }
528 // We will be changing the clip item, need to accomadate for it
541 // We will be changing the clip item, need to accomadate for it
529 // otherwise we move the firstItem down/up twice (unless the
542 // otherwise we move the firstItem down/up twice (unless the
@@ -1128,7 +1141,12 @@ void ListViewWithPageHeader::adjustMinYExtent()
1128 nonCreatedHeight = m_firstVisibleIndex * visibleItemsHeight / visibleItems;
1141 nonCreatedHeight = m_firstVisibleIndex * visibleItemsHeight / visibleItems;
1129// qDebug() << m_firstVisibleIndex << visibleItemsHeight << visibleItems << nonCreatedHeight;
1142// qDebug() << m_firstVisibleIndex << visibleItemsHeight << visibleItems << nonCreatedHeight;
1130 }
1143 }
1131− m_minYExtent = nonCreatedHeight - m_visibleItems.first()->y() - m_clipItem->y() + (m_headerItem ? m_headerItem->implicitHeight() : 0);
1144+ const qreal headerHeight = (m_headerItem ? m_headerItem->implicitHeight() : 0);
1145+ m_minYExtent = nonCreatedHeight - m_visibleItems.first()->y() - m_clipItem->y() + headerHeight;
1146+ if (m_minYExtent != 0 && qFuzzyIsNull(m_minYExtent)) {
1147+ m_minYExtent = 0;
1148+ m_visibleItems.first()->setY(nonCreatedHeight - m_clipItem->y() + headerHeight);
1149+ }
1132 }
1150 }
1133}
1151}
1134
1152
@@ -1264,6 +1282,11 @@ void ListViewWithPageHeader::updatePolish()
1264 refill();
1282 refill();
1265
1283
1266 if (m_contentHeightDirty) {
1284 if (m_contentHeightDirty) {
1285+ // We need to make sure all bindings have updated otherwise
1286+ // we may end up with bindings updating when we call setContentHeight
1287+ // and then everything gets out of sync, i.e. testHeaderPositionBug1240118
1288+ QCoreApplication::instance()->processEvents();
1289+
1267 qreal contentHeight;
1290 qreal contentHeight;
1268 if (m_visibleItems.isEmpty()) {
1291 if (m_visibleItems.isEmpty()) {
1269 contentHeight = m_headerItem ? m_headerItem->height() : 0;
1292 contentHeight = m_headerItem ? m_headerItem->height() : 0;
plugins/Utils/CMakeLists.txt−1
@@ -12,7 +12,6 @@ include_directories(
12
12
13set(QMLPLUGIN_SRC
13set(QMLPLUGIN_SRC
14 albumartprovider.cpp
14 albumartprovider.cpp
15− bottombarvisibilitycommunicatorshell.cpp
16 mediaartcache.cpp
15 mediaartcache.cpp
17 qlimitproxymodelqml.cpp
16 qlimitproxymodelqml.cpp
18 qsortfilterproxymodelqml.cpp
17 qsortfilterproxymodelqml.cpp
plugins/Utils/bottombarvisibilitycommunicatorshell.cppdeleted−49
@@ -1,49 +0,0 @@
1−/*
2− * Copyright (C) 2012 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−#include "bottombarvisibilitycommunicatorshell.h"
18−
19−BottomBarVisibilityCommunicatorShell::BottomBarVisibilityCommunicatorShell()
20− : m_forceHidden(false),
21− m_position(0)
22−{
23−}
24−
25−bool BottomBarVisibilityCommunicatorShell::forceHidden() const
26−{
27− return m_forceHidden;
28−}
29−
30−double BottomBarVisibilityCommunicatorShell::position() const
31−{
32− return m_position;
33−}
34−
35−void BottomBarVisibilityCommunicatorShell::setForceHidden(bool forceHidden)
36−{
37− if (forceHidden != m_forceHidden) {
38− m_forceHidden = forceHidden;
39− Q_EMIT forceHiddenChanged(forceHidden);
40− }
41−}
42−
43−void BottomBarVisibilityCommunicatorShell::setPosition(double position)
44−{
45− if (position != m_position) {
46− m_position = position;
47− Q_EMIT positionChanged(position);
48− }
49−}
plugins/Utils/bottombarvisibilitycommunicatorshell.hdeleted−59
@@ -1,59 +0,0 @@
1−/*
2− * Copyright (C) 2012 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−#ifndef BOTTOMBARVISIBILITYCOMMUNICATORSHELL_H
18−#define BOTTOMBARVISIBILITYCOMMUNICATORSHELL_H
19−
20−#include <QObject>
21−
22−class QDBusInterface;
23−
24−/** This is an internal class used to talk with the bottom bar used by either
25− * applications or the SDK.
26− * There is a method to force the bottom bar to be hidden or otherwise behave as usual
27− */
28−
29−class BottomBarVisibilityCommunicatorShell : public QObject
30−{
31− Q_OBJECT
32− Q_PROPERTY(bool forceHidden READ forceHidden WRITE setForceHidden NOTIFY forceHiddenChanged)
33− Q_PROPERTY(double position READ position WRITE setPosition NOTIFY positionChanged)
34−
35− Q_CLASSINFO("D-Bus Interface", "com.canonical.Shell.BottomBarVisibilityCommunicator")
36−public:
37− static BottomBarVisibilityCommunicatorShell& instance() {
38− static BottomBarVisibilityCommunicatorShell instance;
39− return instance;
40− }
41−
42− bool forceHidden() const;
43− void setForceHidden(bool forceHidden);
44−
45− double position() const;
46− void setPosition(double position);
47−
48−Q_SIGNALS:
49− void forceHiddenChanged(bool forceHidden);
50− void positionChanged(double position);
51−
52−private:
53− BottomBarVisibilityCommunicatorShell();
54−
55− bool m_forceHidden;
56− double m_position;
57−};
58−
59−#endif
plugins/Utils/plugin.cpp−10
@@ -27,15 +27,11 @@
27
27
28// local
28// local
29#include "albumartprovider.h"
29#include "albumartprovider.h"
30−#include "bottombarvisibilitycommunicatorshell.h"
31#include "qlimitproxymodelqml.h"
30#include "qlimitproxymodelqml.h"
32#include "qsortfilterproxymodelqml.h"
31#include "qsortfilterproxymodelqml.h"
33#include "timeformatter.h"
32#include "timeformatter.h"
34#include "unitymenumodelpaths.h"
33#include "unitymenumodelpaths.h"
35
34
36−static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
37−static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommunicator";
38−
39void UtilsPlugin::registerTypes(const char *uri)
35void UtilsPlugin::registerTypes(const char *uri)
40{
36{
41 Q_ASSERT(uri == QLatin1String("Utils"));
37 Q_ASSERT(uri == QLatin1String("Utils"));
@@ -45,7 +41,6 @@ void UtilsPlugin::registerTypes(const char *uri)
45 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
41 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
46 qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
42 qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
47 qmlRegisterType<GDateTimeFormatter>(uri, 0, 1, "GDateTimeFormatter");
43 qmlRegisterType<GDateTimeFormatter>(uri, 0, 1, "GDateTimeFormatter");
48− qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
49}
44}
50
45
51void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
46void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -64,9 +59,4 @@ void UtilsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
64 {
59 {
65 qWarning() << "Failed to register image provider for albumart (unknown error)";
60 qWarning() << "Failed to register image provider for albumart (unknown error)";
66 }
61 }
67−
68− QDBusConnection::sessionBus().registerService(DBUS_SERVICE);
69− BottomBarVisibilityCommunicatorShell *bottomBarVisibilityCommunicator = &BottomBarVisibilityCommunicatorShell::instance();
70− QDBusConnection::sessionBus().registerObject(BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH, bottomBarVisibilityCommunicator, QDBusConnection::ExportAllContents);
71− engine->rootContext()->setContextProperty("bottomBarVisibilityCommunicatorShell", bottomBarVisibilityCommunicator);
72}
62}
qml/Components/Stage.qml+4−6
@@ -329,13 +329,11 @@ Showable {
329
329
330 ScriptAction {
330 ScriptAction {
331 script: {
331 script: {
332− if (!stage.focusedApplicationWhenUsingScreenshots) {
333− // FIXME: only here to support case where application does
332+ // FIXME: only here to support case where application does
334− // not exist yet but is about to
333+ // not exist yet but is about to
335− return;
334+ if (stage.focusedApplicationWhenUsingScreenshots) {
335+ stage.__focusApplication(stage.focusedApplicationWhenUsingScreenshots);
336 }
336 }
337−
338− stage.__focusApplication(stage.focusedApplicationWhenUsingScreenshots);
339 }
337 }
340 }
338 }
341 }
339 }
qml/Dash/Card.qml+7
@@ -44,6 +44,8 @@ Item {
44 anchors.fill: parent
44 anchors.fill: parent
45 image: backgroundImage.source ? backgroundImage : null
45 image: backgroundImage.source ? backgroundImage : null
46
46
47+ property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b
48+
47 property Image backgroundImage: Image {
49 property Image backgroundImage: Image {
48 objectName: "backgroundImage"
50 objectName: "backgroundImage"
49 source: {
51 source: {
@@ -163,6 +165,9 @@ Item {
163 titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
165 titleWeight: components && components["subtitle"] ? Font.DemiBold : Font.Normal
164
166
165 opacity: showHeader ? 1 : 0
167 opacity: showHeader ? 1 : 0
168+ inOverlay: template["overlay"] === true
169+ fontColor: inOverlay ? "white" : summary.color
170+ useMascotShape: !background.visible && !inOverlay
166
171
167 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
172 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
168 }
173 }
@@ -183,5 +188,7 @@ Item {
183 text: cardData && cardData["summary"] || ""
188 text: cardData && cardData["summary"] || ""
184 height: text ? implicitHeight : 0
189 height: text ? implicitHeight : 0
185 fontSize: "small"
190 fontSize: "small"
191+ // TODO karni: Change "grey" to Ubuntu.Components.Palette color once updated.
192+ color: background.visible && background.luminance < 0.7 ? "white" : "grey"
186 }
193 }
187}
194}
qml/Dash/CardHeader.qml+31−59
@@ -22,18 +22,20 @@ Item {
22 property alias mascot: mascotImage.source
22 property alias mascot: mascotImage.source
23 property alias title: titleLabel.text
23 property alias title: titleLabel.text
24 property alias subtitle: subtitleLabel.text
24 property alias subtitle: subtitleLabel.text
25− property alias price: priceLabel.text
26− property alias oldPrice: oldPriceLabel.text
27− property alias altPrice: altPriceLabel.text
28
25
29 property alias titleWeight: titleLabel.font.weight
26 property alias titleWeight: titleLabel.font.weight
27+ property alias titleSize: titleLabel.fontSize
30
28
31 // FIXME: Saviq, used to scale fonts down in Carousel
29 // FIXME: Saviq, used to scale fonts down in Carousel
32 property real fontScale: 1.0
30 property real fontScale: 1.0
33
31
34 property alias headerAlignment: titleLabel.horizontalAlignment
32 property alias headerAlignment: titleLabel.horizontalAlignment
35
33
34+ property bool inOverlay: false
35+ property bool useMascotShape: true
36+ property color fontColor: Theme.palette.selected.backgroundText
37+
36− visible: mascotImage.status === Image.Ready || title || price
38+ visible: mascotImage.status === Image.Ready || title
37 height: row.height > 0 ? row.height + row.margins * 2 : 0
39 height: row.height > 0 ? row.height + row.margins * 2 : 0
38
40
39 Row {
41 Row {
@@ -42,13 +44,13 @@ Item {
42
44
43 property real margins: units.gu(1)
45 property real margins: units.gu(1)
44
46
47+ spacing: mascotShape.visible || mascotImage.visible || inOverlay ? margins : 0
45 anchors {
48 anchors {
46 top: parent.top; left: parent.left; right: parent.right
49 top: parent.top; left: parent.left; right: parent.right
47 margins: margins
50 margins: margins
48 leftMargin: spacing
51 leftMargin: spacing
49 rightMargin: spacing
52 rightMargin: spacing
50 }
53 }
51− spacing: mascotShape.visible || (template && template["overlay"]) ? margins : 0
52
54
53 UbuntuShape {
55 UbuntuShape {
54 id: mascotShape
56 id: mascotShape
@@ -57,35 +59,45 @@ Item {
57 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
59 // TODO karni: Icon aspect-ratio is 8:7.5. Revisit these values to avoid fraction of pixels.
58 width: units.gu(6)
60 width: units.gu(6)
59 height: units.gu(5.625)
61 height: units.gu(5.625)
62+ anchors.verticalCenter: parent.verticalCenter
60− visible: image.status === Image.Ready
63+ visible: useMascotShape && image && image.status === Image.Ready
61 readonly property int maxSize: Math.max(width, height)
64 readonly property int maxSize: Math.max(width, height)
62
65
63− image: Image {
64− id: mascotImage
66+ image: useMascotShape ? mascotImage : null
67+ }
65
68
69+ Image {
70+ id: mascotImage
71+ objectName: "mascotImage"
72+
73+ width: source ? mascotShape.width : 0
74+ height: mascotShape.height
75+ anchors.verticalCenter: parent.verticalCenter
76+ visible: !useMascotShape && status === Image.Ready
77+
66− sourceSize { width: mascotShape.maxSize; height: mascotShape.maxSize }
78+ sourceSize { width: mascotShape.maxSize; height: mascotShape.maxSize }
67− fillMode: Image.PreserveAspectCrop
79+ fillMode: Image.PreserveAspectCrop
68− horizontalAlignment: Image.AlignHCenter
80+ horizontalAlignment: Image.AlignHCenter
69− verticalAlignment: Image.AlignVCenter
81+ verticalAlignment: Image.AlignVCenter
70− }
71 }
82 }
72
83
73 Column {
84 Column {
74 objectName: "column"
85 objectName: "column"
75 width: parent.width - x
86 width: parent.width - x
76− spacing: units.gu(0.5)
87+ spacing: units.gu(0.25)
88+ anchors.verticalCenter: parent.verticalCenter
77
89
78 Label {
90 Label {
79 id: titleLabel
91 id: titleLabel
80 objectName: "titleLabel"
92 objectName: "titleLabel"
81 anchors { left: parent.left; right: parent.right }
93 anchors { left: parent.left; right: parent.right }
82 elide: Text.ElideRight
94 elide: Text.ElideRight
83− font.weight: Font.DemiBold
95+ font.weight: Font.Normal
96+ fontSize: "small"
84 wrapMode: Text.Wrap
97 wrapMode: Text.Wrap
85 maximumLineCount: 2
98 maximumLineCount: 2
86− fontSize: "small"
87 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
99 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
88− color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
100+ color: fontColor
89 }
101 }
90
102
91 Label {
103 Label {
@@ -93,51 +105,11 @@ Item {
93 objectName: "subtitleLabel"
105 objectName: "subtitleLabel"
94 anchors { left: parent.left; right: parent.right }
106 anchors { left: parent.left; right: parent.right }
95 elide: Text.ElideRight
107 elide: Text.ElideRight
108+ fontSize: "small"
96 font.weight: Font.Light
109 font.weight: Font.Light
97 visible: titleLabel.text && text
110 visible: titleLabel.text && text
98− fontSize: "x-small"
99 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
111 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
100− color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
112+ color: fontColor
101− }
102−
103− Row {
104− id: prices
105− objectName: "prices"
106− anchors { left: parent.left; right: parent.right }
107−
108− property int labels: {
109− var labels = 1; // price always visible
110− if (oldPriceLabel.text !== "") labels += 1;
111− if (altPriceLabel.text !== "") labels += 1;
112− return labels;
113− }
114− property real labelWidth: width / labels
115−
116− Label {
117− id: priceLabel
118− width: parent.labelWidth
119− elide: Text.ElideRight
120− font.weight: Font.DemiBold
121− color: Theme.palette.selected.foreground
122− visible: text
123− }
124−
125− Label {
126− id: oldPriceLabel
127− objectName: "oldPriceLabel"
128− width: parent.labelWidth
129− elide: Text.ElideRight
130− horizontalAlignment: parent.labels === 3 ? Text.AlignHCenter : Text.AlignRight
131− visible: text
132− }
133−
134− Label {
135− id: altPriceLabel
136− width: parent.labelWidth
137− elide: Text.ElideRight
138− horizontalAlignment: Text.AlignRight
139− visible: text
140− }
141 }
113 }
142 }
114 }
143 }
115 }
qml/Dash/CardTool.qml+46−8
@@ -28,6 +28,22 @@ import QtQuick 2.0
28
28
29Item {
29Item {
30 id: cardTool
30 id: cardTool
31+
32+ /*!
33+ \brief Number of cards.
34+ */
35+ property int count
36+
37+ /*!
38+ \brief Width of the category view.
39+ */
40+ property real viewWidth
41+
42+ /*!
43+ \brief Scaling factor of selected Carousel item.
44+ */
45+ readonly property real carouselSelectedItemScaleFactor: 1.38 // XXX assuming 1.38 carousel scaling factor for cards
46+
31 /*!
47 /*!
32 \brief Template supplied for the category.
48 \brief Template supplied for the category.
33 */
49 */
@@ -39,9 +55,15 @@ Item {
39 property var components
55 property var components
40
56
41 /*!
57 /*!
42− \brief Width of the view, based on which carousel width is calculated.
58+ \brief The category layout for this card tool.
43 */
59 */
44− property var viewWidth
60+ property string categoryLayout: {
61+ var layout = template["category-layout"];
62+
63+ // carousel fallback mode to grid
64+ if (layout === "carousel" && count <= Math.ceil(carouselTool.realPathItemCount)) layout = "grid";
65+ return layout;
66+ }
45
67
46 // FIXME: Saviq
68 // FIXME: Saviq
47 // Only way for the card below to actually be laid out completely.
69 // Only way for the card below to actually be laid out completely.
@@ -56,7 +78,7 @@ Item {
56 If undefined, should use implicit width of the actual card.
78 If undefined, should use implicit width of the actual card.
57 */
79 */
58 readonly property var cardWidth: {
80 readonly property var cardWidth: {
59− switch (template !== undefined && template["category-layout"]) {
81+ switch (categoryLayout) {
60 case "grid":
82 case "grid":
61 case "vertical-journal":
83 case "vertical-journal":
62 if (template["card-layout"] === "horizontal") return units.gu(38);
84 if (template["card-layout"] === "horizontal") return units.gu(38);
@@ -66,10 +88,7 @@ Item {
66 }
88 }
67 return units.gu(18.5);
89 return units.gu(18.5);
68 case "carousel":
90 case "carousel":
69− if (viewWidth === undefined) return undefined
91+ return carouselTool.minimumTileWidth;
70− if (viewWidth <= units.gu(40)) return units.gu(18)
71− if (viewWidth >= units.gu(128)) return units.gu(26)
72− return units.gu(18 + Math.round((viewWidth - units.gu(40))/ units.gu(11)))
73 case undefined:
92 case undefined:
74 case "organic-grid":
93 case "organic-grid":
75 case "journal":
94 case "journal":
@@ -84,7 +103,7 @@ Item {
84 If undefined, should use implicit height of the actual card.
103 If undefined, should use implicit height of the actual card.
85 */
104 */
86 readonly property var cardHeight: {
105 readonly property var cardHeight: {
87− switch (template !== undefined && template["category-layout"]) {
106+ switch (categoryLayout) {
88 case "journal":
107 case "journal":
89 if (template["card-size"] >= 12 && template["card-size"] <= 38) return units.gu(template["card-size"]);
108 if (template["card-size"] >= 12 && template["card-size"] <= 38) return units.gu(template["card-size"]);
90 return units.gu(18.5);
109 return units.gu(18.5);
@@ -123,6 +142,25 @@ Item {
123 return (template["card-layout"] === "horizontal") ? Text.AlignLeft : Text.AlignHCenter;
142 return (template["card-layout"] === "horizontal") ? Text.AlignLeft : Text.AlignHCenter;
124 }
143 }
125
144
145+ QtObject {
146+ id: carouselTool
147+
148+ property real minimumTileWidth: {
149+ if (cardTool.viewWidth === undefined) return undefined;
150+ if (cardTool.viewWidth <= units.gu(40)) return units.gu(18);
151+ if (cardTool.viewWidth >= units.gu(128)) return units.gu(26);
152+ return units.gu(18 + Math.round((cardTool.viewWidth - units.gu(40)) / units.gu(11)));
153+ }
154+
155+ readonly property real pathItemCount: 4.8457 /// (848 / 175) reference values
156+
157+ property real realPathItemCount: {
158+ var scaledMinimumTileWidth = minimumTileWidth / cardTool.carouselSelectedItemScaleFactor;
159+ var tileWidth = Math.max(cardTool.viewWidth / pathItemCount, scaledMinimumTileWidth);
160+ return Math.min(cardTool.viewWidth / tileWidth, pathItemCount);
161+ }
162+ }
163+
126 Card {
164 Card {
127 id: card
165 id: card
128 objectName: "card"
166 objectName: "card"
qml/Dash/Dash.qml+1
@@ -27,6 +27,7 @@ Showable {
27 visible: shown
27 visible: shown
28
28
29 property ListModel searchHistory: SearchHistoryModel {}
29 property ListModel searchHistory: SearchHistoryModel {}
30+ property bool searchable: !dashContent.previewOpen
30
31
31 property string showScopeOnLoaded: "home.scope"
32 property string showScopeOnLoaded: "home.scope"
32 property real contentScale: 1.0
33 property real contentScale: 1.0
qml/Dash/DashContent.qml+1
@@ -25,6 +25,7 @@ Item {
25 property var model: null
25 property var model: null
26 property var scopes: null
26 property var scopes: null
27 property alias currentIndex: dashContentList.currentIndex
27 property alias currentIndex: dashContentList.currentIndex
28+ property alias previewOpen: previewListView.open
28
29
29 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
30 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
30 property ListModel searchHistory
31 property ListModel searchHistory
qml/Dash/Previews/PreviewActions.qml+1−1
@@ -24,7 +24,7 @@ import QtQuick 2.1
24PreviewWidget {
24PreviewWidget {
25 id: root
25 id: root
26
26
27− height: row.height
27+ height: row.height + units.gu(1)
28
28
29 Row {
29 Row {
30 id: row
30 id: row
qml/Dash/Previews/PreviewHeader.qml+3−1
@@ -34,5 +34,7 @@ PreviewWidget {
34 title: root.widgetData["title"] || ""
34 title: root.widgetData["title"] || ""
35 subtitle: root.widgetData["subtitle"] || ""
35 subtitle: root.widgetData["subtitle"] || ""
36 width: parent.width
36 width: parent.width
37+
38+ titleSize: "large"
37 }
39 }
38−}
40+}
qml/Dash/Previews/PreviewImageGallery.qml+9
@@ -33,6 +33,15 @@ PreviewWidget {
33 cacheBuffer: width * 3
33 cacheBuffer: width * 3
34 model: root.widgetData["sources"]
34 model: root.widgetData["sources"]
35
35
36+ // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
37+ // we finally reached the point where this ListView doesn't correctly get swipe input any more but
38+ // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
39+ // layer to make sure this ListView can be swiped, regardless of what's behind it.
40+ MouseArea {
41+ anchors.fill: parent
42+ enabled: parent.contentWidth > parent.width
43+ }
44+
36 LazyImage {
45 LazyImage {
37 objectName: "placeholderScreenshot"
46 objectName: "placeholderScreenshot"
38 anchors {
47 anchors {
qml/Dash/Previews/PreviewTextSummary.qml+2−1
@@ -58,7 +58,8 @@ PreviewWidget {
58 }
58 }
59 height: (!seeMore.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2)
59 height: (!seeMore.visible || seeMore.more) ? contentHeight : contentHeight / lineCount * (maximumCollapsedLineCount - 2)
60 clip: true
60 clip: true
61− fontSize: "medium"
61+ fontSize: "small"
62+ lineHeight: 1.2
62 color: Theme.palette.selected.backgroundText
63 color: Theme.palette.selected.backgroundText
63 opacity: .8
64 opacity: .8
64 text: widgetData["text"]
65 text: widgetData["text"]
qml/Shell.qml+4−50
@@ -28,9 +28,7 @@ import "Dash"
28import "Greeter"
28import "Greeter"
29import "Launcher"
29import "Launcher"
30import "Panel"
30import "Panel"
31−import "Hud"
32import "Components"
31import "Components"
33−import "Bottombar"
34import "SideStage"
32import "SideStage"
35import "Notifications"
33import "Notifications"
36import Unity.Notifications 1.0 as NotificationBackend
34import Unity.Notifications 1.0 as NotificationBackend
@@ -403,7 +401,7 @@ FocusScope {
403
401
404 readonly property int backgroundTopMargin: -panel.panelHeight
402 readonly property int backgroundTopMargin: -panel.panelHeight
405
403
406− hides: [launcher, panel.indicators, hud]
404+ hides: [launcher, panel.indicators]
407 shown: false
405 shown: false
408 enabled: true
406 enabled: true
409 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
407 showAnimation: StandardAnimation { property: "opacity"; to: 1 }
@@ -458,7 +456,7 @@ FocusScope {
458 objectName: "greeter"
456 objectName: "greeter"
459
457
460 available: true
458 available: true
461− hides: [launcher, panel.indicators, hud]
459+ hides: [launcher, panel.indicators]
462 shown: true
460 shown: true
463
461
464 defaultBackground: shell.background
462 defaultBackground: shell.background
@@ -545,7 +543,7 @@ FocusScope {
545 InputFilterArea {
543 InputFilterArea {
546 anchors.fill: parent
544 anchors.fill: parent
547 blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
545 blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
548− || panel.indicators.shown || hud.shown
546+ || panel.indicators.shown
549 }
547 }
550
548
551 Connections {
549 Connections {
@@ -594,7 +592,7 @@ FocusScope {
594 contentEnabled: edgeDemo.panelContentEnabled
592 contentEnabled: edgeDemo.panelContentEnabled
595 }
593 }
596 fullscreenMode: shell.fullscreenMode
594 fullscreenMode: shell.fullscreenMode
597− searchVisible: !greeter.shown && !lockscreen.shown && dash.shown
595+ searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
598
596
599 InputFilterArea {
597 InputFilterArea {
600 anchors {
598 anchors {
@@ -607,48 +605,6 @@ FocusScope {
607 }
605 }
608 }
606 }
609
607
610− Hud {
611− id: hud
612−
613− width: parent.width > units.gu(60) ? units.gu(40) : parent.width
614− height: parent.height
615−
616− available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
617− shown: false
618− showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
619− hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
620−
621− Connections {
622− target: shell.applicationManager
623− onMainStageFocusedApplicationChanged: hud.hide()
624− onSideStageFocusedApplicationChanged: hud.hide()
625− }
626− }
627−
628− Revealer {
629− id: hudRevealer
630−
631− enabled: hud.shown
632− width: hud.width
633− anchors.left: hud.left
634− height: parent.height
635− target: hud.revealerTarget
636− closedValue: height
637− openedValue: 0
638− direction: Qt.RightToLeft
639− orientation: Qt.Vertical
640− handleSize: hud.handleHeight
641− onCloseClicked: target.hide()
642− }
643−
644− Bottombar {
645− id: bottombar
646− theHud: hud
647− anchors.fill: parent
648− enabled: hud.available
649− applicationIsOnForeground: applicationFocused
650− }
651−
652 InputFilterArea {
608 InputFilterArea {
653 blockInput: launcher.shown
609 blockInput: launcher.shown
654 anchors {
610 anchors {
@@ -693,8 +649,6 @@ FocusScope {
693 onShownChanged: {
649 onShownChanged: {
694 if (shown) {
650 if (shown) {
695 panel.indicators.hide()
651 panel.indicators.hide()
696− hud.hide()
697− bottombar.hide()
698 }
652 }
699 }
653 }
700 }
654 }
tests/autopilot/unity8/application_lifecycle/tests/test_url_dispatcher.py+5−40
@@ -20,12 +20,11 @@
20"""Test the integration with the URL dispatcher service."""
20"""Test the integration with the URL dispatcher service."""
21
21
22import os
22import os
23−import tempfile
24
23
25from autopilot import platform
24from autopilot import platform
26from autopilot.matchers import Eventually
25from autopilot.matchers import Eventually
27from testtools.matchers import Equals
26from testtools.matchers import Equals
28−from ubuntuuitoolkit import base as toolkit_base
27+from ubuntuuitoolkit import fixture_setup
29
28
30from unity8 import process_helpers
29from unity8 import process_helpers
31from unity8.shell import tests
30from unity8.shell import tests
@@ -47,13 +46,6 @@ MainView {
47 text: 'Test application.'
46 text: 'Test application.'
48 }
47 }
49}
48}
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""")
49""")
58
50
59 def setUp(self):
51 def setUp(self):
@@ -66,37 +58,10 @@ Icon=Not important
66 process_helpers.unlock_unity(unity_proxy)
58 process_helpers.unlock_unity(unity_proxy)
67
59
68 def create_test_application(self):
60 def create_test_application(self):
69− # FIXME most of this code is duplicated in the toolkit. We should
61+ fake_application = fixture_setup.FakeApplication(self.test_qml)
70− # create a fixture on the toolkit for other projects to use.
62+ self.useFixture(fake_application)
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(
63+ return (
99− os.environ.get('HOME'), '.local', 'share', 'applications')
64+ fake_application.qml_file_path, fake_application.desktop_file_path)
100
65
101 def test_swipe_out_application_started_by_url_dispatcher(self):
66 def test_swipe_out_application_started_by_url_dispatcher(self):
102 _, desktop_file_path = self.create_test_application()
67 _, desktop_file_path = self.create_test_application()
tests/plugins/DashViews/listviewwithpageheadertest.cpp−6
@@ -1281,9 +1281,6 @@ private Q_SLOTS:
1281
1281
1282 void testShowHeaderHalfShown()
1282 void testShowHeaderHalfShown()
1283 {
1283 {
1284−#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
1285− QSKIP("This test is extremely unstable in 5.0.x");
1286−#endif
1287 changeContentY(20);
1284 changeContentY(20);
1288
1285
1289 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
1286 QTRY_COMPARE(lvwph->m_visibleItems.count(), 4);
@@ -1860,9 +1857,6 @@ private Q_SLOTS:
1860 model->setProperty(4, "size", 10);
1857 model->setProperty(4, "size", 10);
1861 model->setProperty(5, "size", 10);
1858 model->setProperty(5, "size", 10);
1862 model->setProperty(6, "size", 10);
1859 model->setProperty(6, "size", 10);
1863−#if (QT_VERSION > QT_VERSION_CHECK(5, 0, 3))
1864− QTRY_COMPARE(lvwph->m_minYExtent, 210.);
1865−#endif
1866 QTRY_COMPARE(lvwph->m_headerItem->y(), -lvwph->m_minYExtent);
1860 QTRY_COMPARE(lvwph->m_headerItem->y(), -lvwph->m_minYExtent);
1867 }
1861 }
1868
1862
tests/plugins/DashViews/listviewwithpageheadertestsection.cpp−3
@@ -1486,9 +1486,6 @@ private Q_SLOTS:
1486
1486
1487 void testShowHeaderHalfShown()
1487 void testShowHeaderHalfShown()
1488 {
1488 {
1489−#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
1490− QSKIP("This test is extremely unstable in 5.0.x");
1491−#endif
1492 changeContentY(20);
1489 changeContentY(20);
1493
1490
1494 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
1491 QTRY_COMPARE(lvwph->m_visibleItems.count(), 3);
tests/plugins/DashViews/organicgridtest.cpp+2−1
@@ -134,11 +134,12 @@ private Q_SLOTS:
134 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtest.qml"));
134 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtest.qml"));
135
135
136 view->show();
136 view->show();
137− view->resize(470, 400);
138 QTest::qWaitForWindowExposed(view);
137 QTest::qWaitForWindowExposed(view);
138+ view->resize(470, 400);
139
139
140 grid = dynamic_cast<OrganicGrid*>(view->rootObject()->findChild<QObject*>("grid"));
140 grid = dynamic_cast<OrganicGrid*>(view->rootObject()->findChild<QObject*>("grid"));
141 grid->setModel(model);
141 grid->setModel(model);
142+ QTRY_COMPARE(grid->width(), 470.);
142
143
143 checkInitialPositions();
144 checkInitialPositions();
144 }
145 }
tests/plugins/DashViews/verticaljournaltest.cpp+2−1
@@ -135,11 +135,12 @@ private Q_SLOTS:
135 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
135 view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
136
136
137 view->show();
137 view->show();
138− view->resize(470, 400);
139 QTest::qWaitForWindowExposed(view);
138 QTest::qWaitForWindowExposed(view);
139+ view->resize(470, 400);
140
140
141 vj = dynamic_cast<VerticalJournal*>(view->rootObject()->findChild<QObject*>("vj"));
141 vj = dynamic_cast<VerticalJournal*>(view->rootObject()->findChild<QObject*>("vj"));
142 vj->setModel(model);
142 vj->setModel(model);
143+ QTRY_COMPARE(vj->width(), 470.);
143
144
144 checkInitialPositions();
145 checkInitialPositions();
145 }
146 }
tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp+8
@@ -103,6 +103,14 @@ void tst_DirectionalDragArea::init()
103{
103{
104 GestureTest::init();
104 GestureTest::init();
105
105
106+ // We shouldn't need the three lines below, but a compiz/unity7
107+ // regression means we don't pass the test without them because
108+ // the window doesn't have the proper size. Can be removed in the
109+ // future if the regression is fixed and tests pass again
110+ m_view->resize(m_view->rootObject()->width(), m_view->rootObject()->height());
111+ QTRY_COMPARE(m_view->width(), (int)m_view->rootObject()->width());
112+ QTRY_COMPARE(m_view->height(), (int)m_view->rootObject()->height());
113+
106 fakeTimeSource.reset(new FakeTimeSource);
114 fakeTimeSource.reset(new FakeTimeSource);
107 fakeTimer = new FakeTimer(fakeTimeSource);
115 fakeTimer = new FakeTimer(fakeTimeSource);
108}
116}
tests/qmltests/Components/tst_DragHandle.cpp−1
@@ -126,7 +126,6 @@ QQuickView *tst_DragHandle::createView()
126{
126{
127 QQuickView *window = new QQuickView(0);
127 QQuickView *window = new QQuickView(0);
128 window->setResizeMode(QQuickView::SizeRootObjectToView);
128 window->setResizeMode(QQuickView::SizeRootObjectToView);
129− window->resize(600, 600);
130 window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
129 window->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
131 window->engine()->addImportPath(QLatin1String(TEST_DIR));
130 window->engine()->addImportPath(QLatin1String(TEST_DIR));
132
131
tests/qmltests/Components/tst_LazyImage.qml+1−1
@@ -155,7 +155,7 @@ Rectangle {
155
155
156 if (data.transition) {
156 if (data.transition) {
157 // wait for the transition to complete
157 // wait for the transition to complete
158− var transition = findInvisibleChild(data.image, data.transition);
158+ var transition = findChildIn(data.image, "transitions", data.transition);
159 tryCompare(transition, "running", true);
159 tryCompare(transition, "running", true);
160 tryCompare(transition, "running", false);
160 tryCompare(transition, "running", false);
161 }
161 }
tests/qmltests/Dash/Previews/tst_PreviewVideoPlayback.qml−6
@@ -53,12 +53,6 @@ Rectangle {
53 function test_loadScreenshot() {
53 function test_loadScreenshot() {
54 var screenshot = findChild(videoPlayback, "screenshot");
54 var screenshot = findChild(videoPlayback, "screenshot");
55
55
56− videoPlayback.widgetData = widgetData0;
57− tryCompare(screenshot.visible, false);
58−
59− videoPlayback.widgetData = widgetData1;
60− tryCompare(screenshot.visible, true);
61−
62 videoPlayback.widgetData = widgetData2;
56 videoPlayback.widgetData = widgetData2;
63 var screenshotSource = screenshot.source
57 var screenshotSource = screenshot.source
64 verify(screenshotSource.toString().indexOf("image://thumbnailer/") === 0)
58 verify(screenshotSource.toString().indexOf("image://thumbnailer/") === 0)
tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml+3−4
@@ -30,14 +30,13 @@ Rectangle {
30 }
30 }
31
31
32 property var widgetData1: {
32 property var widgetData1: {
33− "source": "../../graphics/phone_background.jpg",
33+ "source": Qt.resolvedUrl("../artwork/checkers.png"),
34 "zoomable": false
34 "zoomable": false
35 }
35 }
36
36
37 PreviewZoomableImage {
37 PreviewZoomableImage {
38 id: zoomableImage
38 id: zoomableImage
39 width: parent.width
39 width: parent.width
40− widgetData: widgetData1
41 }
40 }
42
41
43 UT.UnityTestCase {
42 UT.UnityTestCase {
@@ -48,10 +47,10 @@ Rectangle {
48 var image = findChild(zoomableImage, "image");
47 var image = findChild(zoomableImage, "image");
49
48
50 zoomableImage.widgetData = widgetData0;
49 zoomableImage.widgetData = widgetData0;
51− tryCompare(image.state, "default");
50+ tryCompare(image, "state", "default");
52
51
53 zoomableImage.widgetData = widgetData1;
52 zoomableImage.widgetData = widgetData1;
54− tryCompare(image.state, "ready");
53+ tryCompare(image, "state", "ready");
55 }
54 }
56 }
55 }
57}
56}
tests/qmltests/Dash/tst_Card.qml+49
@@ -427,5 +427,54 @@ Rectangle {
427
427
428 tryCompare(testCase.title.font, "weight", data.weight);
428 tryCompare(testCase.title.font, "weight", data.weight);
429 }
429 }
430+
431+ function test_fontColor_data() {
432+ return [
433+ { tag: "#ffffff", dark: true },
434+ { tag: "#fdfdfd", dark: true },
435+ { tag: "#f9f9f9", dark: true },
436+ { tag: "#000000", dark: false },
437+ { tag: "#ef814c", dark: false },
438+ { tag: "#312f2c", dark: false },
439+ { tag: "#be332d", dark: false },
440+ { tag: "#52ace4", dark: false },
441+ { tag: "#3a5897", dark: false },
442+ { tag: "#1caeeb", dark: false },
443+ { tag: "#87c341", dark: false },
444+ { tag: "#50893b", dark: false },
445+ ];
446+ }
447+
448+ function test_fontColor(data) {
449+ selector.selectedIndex = 10;
450+
451+ background.color = data.tag;
452+
453+ var fontColor = data.dark ? "grey" : "white";
454+
455+ tryCompareFunction(function() { return Qt.colorEqual(summary.color, fontColor); }, true);
456+ tryCompareFunction(function() { return Qt.colorEqual(header.fontColor, fontColor); }, true);
457+ }
458+
459+ function test_mascotShape_data() {
460+ return [
461+ { tag: "Art and summary", shape: false, index: 0 },
462+ { tag: "No Summary", shape: true, index: 6 },
463+ { tag: "With background", shape: false, index: 10 },
464+ ];
465+ }
466+
467+ function test_mascotShape(data) {
468+ selector.selectedIndex = data.index;
469+
470+ var shape = findChild(card, "mascotShape");
471+ var image = findChild(card, "mascotImage");
472+
473+ verify(shape, "Could not find shape.");
474+ verify(image, "Could not find image.");
475+
476+ tryCompare(shape, "visible", data.shape);
477+ tryCompare(image, "visible", !data.shape);
478+ }
430 }
479 }
431}
480}
tests/qmltests/Dash/tst_CardHeader.qml+1−28
@@ -46,7 +46,6 @@ Rectangle {
46 property Item mascot: findChild(cardHeader, "mascotShape")
46 property Item mascot: findChild(cardHeader, "mascotShape")
47 property Item titleLabel: findChild(cardHeader, "titleLabel")
47 property Item titleLabel: findChild(cardHeader, "titleLabel")
48 property Item subtitleLabel: findChild(cardHeader, "subtitleLabel")
48 property Item subtitleLabel: findChild(cardHeader, "subtitleLabel")
49− property Item prices: findChild(cardHeader, "prices")
50 property Item oldPriceLabel: findChild(cardHeader, "oldPriceLabel")
49 property Item oldPriceLabel: findChild(cardHeader, "oldPriceLabel")
51 property Item outerRow: findChild(cardHeader, "outerRow")
50 property Item outerRow: findChild(cardHeader, "outerRow")
52 property Item column: findChild(cardHeader, "column")
51 property Item column: findChild(cardHeader, "column")
@@ -55,7 +54,6 @@ Rectangle {
55 verify(typeof testCase.mascot === "object", "Couldn't find mascot object.");
54 verify(typeof testCase.mascot === "object", "Couldn't find mascot object.");
56 verify(typeof testCase.titleLabel === "object", "Couldn't find titleLabel object.");
55 verify(typeof testCase.titleLabel === "object", "Couldn't find titleLabel object.");
57 verify(typeof testCase.subtitleLabel === "object", "Couldn't find subtitleLabel object.");
56 verify(typeof testCase.subtitleLabel === "object", "Couldn't find subtitleLabel object.");
58− verify(typeof testCase.prices === "object", "Couldn't find prices object.");
59 verify(typeof testCase.oldPriceLabel === "object", "Couldn't find oldPriceLabel object.");
57 verify(typeof testCase.oldPriceLabel === "object", "Couldn't find oldPriceLabel object.");
60 }
58 }
61
59
@@ -63,9 +61,6 @@ Rectangle {
63 cardHeader.mascot = "";
61 cardHeader.mascot = "";
64 cardHeader.title = "";
62 cardHeader.title = "";
65 cardHeader.subtitle = "";
63 cardHeader.subtitle = "";
66− cardHeader.price = "";
67− cardHeader.oldPrice = "";
68− cardHeader.altPrice = "";
69 }
64 }
70
65
71 function test_mascot_data() {
66 function test_mascot_data() {
@@ -96,33 +91,11 @@ Rectangle {
96 tryCompare(cardHeader, "visible", data.visible);
91 tryCompare(cardHeader, "visible", data.visible);
97 }
92 }
98
93
99− function test_prices_data() {
100− return [
101− { tag: "Main", main: "$1.25", visible: true },
102− { tag: "Alt", alt: "€1.00", visible: false },
103− { tag: "Old", old: "€2.00", visible: false },
104− { tag: "Main and Alt", main: "$1.25", alt: "€1.00", visible: true },
105− { tag: "Main and Old", main: "$1.25", old: "$2.00", visible: true, oldAlign: Text.AlignRight },
106− { tag: "Alt and Old", alt: "€1.00", old: "$2.00", visible: false },
107− { tag: "All", main: "$1.25", alt: "€1.00", old: "$2.00", visible: true, oldAlign: Text.AlignHCenter },
108− ]
109− }
110−
111− function test_prices(data) {
112− cardHeader.price = data.main !== undefined ? data.main : "";
113− cardHeader.oldPrice = data.old !== undefined ? data.old : "";
114− cardHeader.altPrice = data.alt !== undefined ? data.alt : "";
115− tryCompare(cardHeader, "visible", data.visible);
116− if (data.hasOwnProperty("oldAlign")) {
117− compare(testCase.oldPriceLabel.horizontalAlignment, data.oldAlign, "Old price label is aligned wrong.")
118− }
119− }
120−
121 function test_dimensions_data() {
94 function test_dimensions_data() {
122 return [
95 return [
123 { tag: "Column width", object: column, width: cardHeader.width },
96 { tag: "Column width", object: column, width: cardHeader.width },
124 { tag: "Column width with mascot", object: column, width: cardHeader.width - mascot.width - outerRow.margins * 3, mascot: "artwork/avatar.png" },
97 { tag: "Column width with mascot", object: column, width: cardHeader.width - mascot.width - outerRow.margins * 3, mascot: "artwork/avatar.png" },
125− { tag: "Header height", object: cardHeader, height: function() { return subtitleLabel.y + subtitleLabel.height + outerRow.margins * 2 } },
98+ { tag: "Header height", object: cardHeader, height: function() { return outerRow.height + outerRow.margins * 2 } },
126 ]
99 ]
127 }
100 }
128
101
tests/qmltests/Dash/tst_CardTool.qml+20
@@ -93,6 +93,7 @@ Rectangle {
93 CardTool {
93 CardTool {
94 id: cardTool
94 id: cardTool
95
95
96+ count: 8
96 template: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['template'];
97 template: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['template'];
97 components: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['components'];
98 components: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['components'];
98 viewWidth: units.gu(Math.round(widthSlider.value))
99 viewWidth: units.gu(Math.round(widthSlider.value))
@@ -343,5 +344,24 @@ Rectangle {
343 tryCompare(cardTool, data.property, data.value);
344 tryCompare(cardTool, data.property, data.value);
344 }
345 }
345 }
346 }
347+
348+ function test_categoryLayout_data() {
349+ return [
350+ { tag: "Default Grid", layout_index: 0, count: 2, viewWidth: units.gu(40), layout: "grid" },
351+ { tag: "Long carousel", layout_index: 4, count: 6, viewWidth: units.gu(140), layout: "carousel" },
352+ { tag: "Long carousel fallback", layout_index: 4, count: 5, viewWidth: units.gu(140), layout: "grid" },
353+ { tag: "Short carousel", layout_index: 4, count: 4, viewWidth: units.gu(30), layout: "carousel" },
354+ { tag: "Short carousel fallback", layout_index: 4, count: 3, viewWidth: units.gu(30), layout: "grid" },
355+ { tag: "Journal", layout_index: 2, count: 8, viewWidth: units.gu(30), layout: "journal" }
356+ ]
357+ }
358+
359+ function test_categoryLayout(data) {
360+ selector.selectedIndex = 0;
361+ layoutSelector.selectedIndex = data.layout_index;
362+ cardTool.viewWidth = data.viewWidth;
363+ cardTool.count = data.count;
364+ compare(cardTool.categoryLayout, data.layout);
365+ }
346 }
366 }
347}
367}
tests/qmltests/Dash/tst_DashContent.qml+1−1
@@ -284,7 +284,7 @@ Item {
284 tryCompare(scopesModel, "loaded", true);
284 tryCompare(scopesModel, "loaded", true);
285 var tabbar = findChild(dashContent, "tabbar");
285 var tabbar = findChild(dashContent, "tabbar");
286
286
287− compare(dashContent.currentIndex, 0);
287+ tryCompare(dashContent, "currentIndex", 0);
288 tryCompare(tabbar, "selectedIndex", 0);
288 tryCompare(tabbar, "selectedIndex", 0);
289 tryCompare(tabbar, "selectionMode", false);
289 tryCompare(tabbar, "selectionMode", false);
290
290
tests/qmltests/Dash/tst_GenericPreview.qml+2−2
@@ -22,7 +22,7 @@ import Unity.Test 0.1 as UT
22Item {
22Item {
23 id: root
23 id: root
24 width: units.gu(60)
24 width: units.gu(60)
25− height: units.gu(80)
25+ height: units.gu(90)
26
26
27 property var calls: []
27 property var calls: []
28 property int counter: 0
28 property int counter: 0
@@ -81,7 +81,7 @@ Item {
81
81
82 var actions = get_actions_data();
82 var actions = get_actions_data();
83 for(var i = 0; i < actions.length; i++) {
83 for(var i = 0; i < actions.length; i++) {
84− compare(root.calls[i], actions[i].id);
84+ tryCompare(root.calls, i, actions[i].id);
85 }
85 }
86 }
86 }
87
87
tests/qmltests/Dash/tst_GenericScopeView.qml+3−3
@@ -67,7 +67,7 @@ Item {
67 function init() {
67 function init() {
68 shell.width = units.gu(120)
68 shell.width = units.gu(120)
69 genericScopeView.categoryView.positionAtBeginning();
69 genericScopeView.categoryView.positionAtBeginning();
70− tryCompare(genericScopeView.categoryView.contentY, 0)
70+ tryCompare(genericScopeView.categoryView, "contentY", 0)
71 }
71 }
72
72
73 function test_isCurrent() {
73 function test_isCurrent() {
@@ -184,13 +184,13 @@ Item {
184 categoryListView.positionAtBeginning();
184 categoryListView.positionAtBeginning();
185 waitForRendering(categoryListView);
185 waitForRendering(categoryListView);
186 categoryListView.flick(0, -units.gu(60));
186 categoryListView.flick(0, -units.gu(60));
187− tryCompare(categoryListView.flicking, false);
187+ tryCompare(categoryListView, "flicking", false);
188
188
189 var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
189 var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
190 mouseClick(tile, tile.width / 2, tile.height - 1);
190 mouseClick(tile, tile.width / 2, tile.height - 1);
191 tryCompare(openEffect, "gap", 1);
191 tryCompare(openEffect, "gap", 1);
192
192
193− verify(openEffect.positionPx >= pageHeader.height + categoryListView.stickyHeaderHeight);
193+ verify(openEffect.positionPx >= Math.round(pageHeader.height + categoryListView.stickyHeaderHeight));
194 }
194 }
195
195
196 function test_previewCycle() {
196 function test_previewCycle() {
tests/qmltests/Launcher/tst_Launcher.qml+6−4
@@ -121,8 +121,7 @@ Item {
121 revealer.dragLauncherIntoView()
121 revealer.dragLauncherIntoView()
122
122
123 var listView = findChild(launcher, "launcherListView");
123 var listView = findChild(launcher, "launcherListView");
124− listView.flick(0, units.gu(500));
124+ listView.positionViewAtEnd();
125− tryCompare(listView, "flicking", false);
126
125
127 var appIcon = findChild(launcher, "launcherDelegate0")
126 var appIcon = findChild(launcher, "launcherDelegate0")
128
127
@@ -397,8 +396,11 @@ Item {
397
396
398 // Position launcher to where we need it
397 // Position launcher to where we need it
399 var listView = findChild(launcher, "launcherListView");
398 var listView = findChild(launcher, "launcherListView");
400− listView.flick(0, units.gu(200) * (data.flickTo === "top" ? 1 : -1));
399+ if (data.flickTo == "top") {
401− tryCompare(listView, "flicking", false);
400+ listView.positionViewAtEnd();
401+ } else {
402+ listView.positionViewAtBeginning();
403+ }
402
404
403 // Doing longpress
405 // Doing longpress
404 mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
406 mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2)
tests/qmltests/tst_Shell.qml+18−2
@@ -110,6 +110,9 @@ Item {
110 swipeUntilScopeViewIsReached(dashHome);
110 swipeUntilScopeViewIsReached(dashHome);
111
111
112 hideIndicators();
112 hideIndicators();
113+
114+ var dashContent = findChild(shell, "dashContent");
115+ dashContent.previewOpen = false;
113 }
116 }
114
117
115 function killApps(apps) {
118 function killApps(apps) {
@@ -235,8 +238,8 @@ Item {
235
238
236 var dash = findChild(shell, "dash");
239 var dash = findChild(shell, "dash");
237 // check that dash has normal scale and opacity
240 // check that dash has normal scale and opacity
238− tryCompare(dash.contentScale, 1.0);
241+ tryCompare(dash, "contentScale", 1.0);
239− tryCompare(dash.opacity, 1.0);
242+ tryCompare(dash, "opacity", 1.0);
240
243
241 touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
244 touchFlick(shell, touchX, touchY, shell.width * 0.1, touchY,
242 true /* beginTouch */, false /* endTouch */);
245 true /* beginTouch */, false /* endTouch */);
@@ -549,5 +552,18 @@ Item {
549 tryCompare(greeter, "shown", true)
552 tryCompare(greeter, "shown", true)
550 tryCompare(searchIndicator, "opacity", 0)
553 tryCompare(searchIndicator, "opacity", 0)
551 }
554 }
555+
556+ function test_searchIndicatorHideOnPreviewShown() {
557+ var searchIndicator = findChild(shell, "container");
558+ var dashContent = findChild(shell, "dashContent");
559+
560+ verify(dashContent != null);
561+
562+ tryCompare(searchIndicator, "opacity", 1);
563+
564+ dashContent.previewOpen = true;
565+
566+ tryCompare(searchIndicator, "opacity", 0);
567+ }
552 }
568 }
553}
569}
tests/utils/modules/Unity/Test/UnityTestCase.qml+10−16
@@ -71,19 +71,8 @@ TestCase {
71
71
72
72
73 // Find an object with the given name in the children tree of "obj"
73 // Find an object with the given name in the children tree of "obj"
74− function findChild(obj,objectName) {
74+ function findChild(obj, objectName) {
75− var childs = new Array(0);
75+ return findChildIn(obj, "children", objectName);
76− childs.push(obj)
77− while (childs.length > 0) {
78− if (childs[0].objectName == objectName) {
79− return childs[0]
80− }
81− for (var i in childs[0].children) {
82− childs.push(childs[0].children[i])
83− }
84− childs.splice(0, 1);
85− }
86− return null;
87 }
76 }
88
77
89 // Find an object with the given name in the children tree of "obj"
78 // Find an object with the given name in the children tree of "obj"
@@ -91,15 +80,20 @@ TestCase {
91 // Note: you should use findChild if you're not sure you need this
80 // Note: you should use findChild if you're not sure you need this
92 // as this tree is much bigger and might contain stuff that goes
81 // as this tree is much bigger and might contain stuff that goes
93 // away randomly.
82 // away randomly.
94− function findInvisibleChild(obj,objectName) {
83+ function findInvisibleChild(obj, objectName) {
84+ return findChildIn(obj, "data", objectName);
85+ }
86+
87+ // Find a child in the named property
88+ function findChildIn(obj, prop, objectName) {
95 var childs = new Array(0);
89 var childs = new Array(0);
96 childs.push(obj)
90 childs.push(obj)
97 while (childs.length > 0) {
91 while (childs.length > 0) {
98 if (childs[0].objectName == objectName) {
92 if (childs[0].objectName == objectName) {
99 return childs[0]
93 return childs[0]
100 }
94 }
101− for (var i in childs[0].data) {
95+ for (var i in childs[0][prop]) {
102− childs.push(childs[0].data[i])
96+ childs.push(childs[0][prop][i])
103 }
97 }
104 childs.splice(0, 1);
98 childs.splice(0, 1);
105 }
99 }