on xenial help sign in
Merge trunk.
ecc1779Michał Sawicz
debian/changelog+12
@@ -1,3 +1,15 @@
1+unity8 (7.84+14.04.20140221-0ubuntu1) trusty; urgency=low
2+
3+ [ Michał Sawicz ]
4+ * Add card background support.
5+ * Increase the sidestage threshold.
6+
7+ [ Jussi Pakkanen ]
8+ * Move downloads to their own threads so they don't muck about with
9+ the parent thread's event loop. (LP: #1240408)
10+
11+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 21 Feb 2014 09:06:04 +0000
12+
1unity8 (7.84+14.04.20140218-0ubuntu1) trusty; urgency=low
13unity8 (7.84+14.04.20140218-0ubuntu1) trusty; urgency=low
2
14
3 [ Michał Sawicz ]
15 [ Michał Sawicz ]
plugins/Utils/CMakeLists.txt+1−1
@@ -33,7 +33,7 @@ target_link_libraries(Utils-qml ${GIO_LDFLAGS})
33# files directly in targets.
33# files directly in targets.
34set_target_properties(Utils-qml PROPERTIES COMPILE_FLAGS -fvisibility=default)
34set_target_properties(Utils-qml PROPERTIES COMPILE_FLAGS -fvisibility=default)
35
35
36−qt5_use_modules(Utils-qml Qml Quick DBus Network XmlPatterns)
36+qt5_use_modules(Utils-qml Qml Quick DBus Network XmlPatterns Concurrent)
37
37
38# export the qmldir qmltypes and plugin files
38# export the qmldir qmltypes and plugin files
39export_qmlfiles(Utils Utils)
39export_qmlfiles(Utils Utils)
plugins/Utils/albumartprovider.cpp+23−21
@@ -33,12 +33,27 @@
33#include <QImage>
33#include <QImage>
34#include <QUrl>
34#include <QUrl>
35#include <QUrlQuery>
35#include <QUrlQuery>
36+#include <QtConcurrent>
36
37
37using namespace std;
38using namespace std;
38
39
39const std::string AlbumArtProvider::DEFAULT_ALBUM_ART = "/usr/share/unity/icons/album_missing.png";
40const std::string AlbumArtProvider::DEFAULT_ALBUM_ART = "/usr/share/unity/icons/album_missing.png";
40const std::string AlbumArtProvider::UNITY_LENS_SCHEMA = "com.canonical.Unity.Lenses";
41const std::string AlbumArtProvider::UNITY_LENS_SCHEMA = "com.canonical.Unity.Lenses";
41
42
43+static QByteArray download(QString url) {
44+ QScopedPointer<QNetworkAccessManager> am(new QNetworkAccessManager);
45+ QNetworkReply *reply = am->get(QNetworkRequest(QUrl(url)));
46+ QEventLoop loop;
47+ QObject::connect(am.data(), &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
48+ loop.exec();
49+
50+ if (reply->error() != QNetworkReply::NoError) {
51+ qWarning() << "Error downloading from the network:" << reply->errorString();
52+ return QByteArray();
53+ }
54+ return reply->readAll();
55+}
56+
42AlbumArtProvider::AlbumArtProvider()
57AlbumArtProvider::AlbumArtProvider()
43 : QQuickImageProvider(QQmlImageProviderBase::Image, QQmlImageProviderBase::ForceAsynchronousImageLoading),
58 : QQuickImageProvider(QQmlImageProviderBase::Image, QQmlImageProviderBase::ForceAsynchronousImageLoading),
44 m_settings(nullptr)
59 m_settings(nullptr)
@@ -76,20 +91,14 @@ std::string AlbumArtProvider::get_lastfm_url(const albuminfo &ai) {
76 QString request = QString("http://ws.audioscrobbler.com/1.0/album/%1/%2/info.xml").arg(artist)
91 QString request = QString("http://ws.audioscrobbler.com/1.0/album/%1/%2/info.xml").arg(artist)
77 .arg(album)
92 .arg(album)
78 .toHtmlEscaped();
93 .toHtmlEscaped();
79− QScopedPointer<QNetworkAccessManager> am(new QNetworkAccessManager);
94+ QFuture<QByteArray> future = QtConcurrent::run(download, request);
80− QNetworkReply *reply = am->get(QNetworkRequest(QUrl(request)));
95+ QByteArray arr = future.result();
81− QEventLoop loop;
96+ if(arr.size() == 0) {
82− QObject::connect(am.data(), &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
83− loop.exec();
84−
85− if (reply->error() != QNetworkReply::NoError) {
86− qWarning() << "Error getting the XML:" << reply->errorString();
87 return "";
97 return "";
88 }
98 }
89−
90 QXmlQuery query;
99 QXmlQuery query;
91 QBuffer tmp;
100 QBuffer tmp;
92− tmp.setData(reply->readAll());
101+ tmp.setData(arr);
93 tmp.open(QIODevice::ReadOnly);
102 tmp.open(QIODevice::ReadOnly);
94 query.bindVariable("reply", &tmp);
103 query.bindVariable("reply", &tmp);
95 query.setQuery("doc($reply)/album/coverart/large[1]/text()");
104 query.setQuery("doc($reply)/album/coverart/large[1]/text()");
@@ -109,24 +118,17 @@ std::string AlbumArtProvider::get_lastfm_url(const albuminfo &ai) {
109bool AlbumArtProvider::download_and_store(const std::string &image_url, const std::string &output_file) {
118bool AlbumArtProvider::download_and_store(const std::string &image_url, const std::string &output_file) {
110 QString url = QString::fromStdString(image_url);
119 QString url = QString::fromStdString(image_url);
111 QString fileName = QString::fromStdString(output_file);
120 QString fileName = QString::fromStdString(output_file);
112−
121+ QFuture<QByteArray> future = QtConcurrent::run(download, url);
113− QScopedPointer<QNetworkAccessManager> am(new QNetworkAccessManager);
122+ QByteArray arr = future.result();
114− QNetworkReply *reply = am->get(QNetworkRequest(QUrl(url)));
123+ if (arr.size() == 0) {
115− QEventLoop loop;
116− QObject::connect(am.data(), &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
117− loop.exec();
118−
119− if (reply->error() != QNetworkReply::NoError) {
120− qWarning() << "Error getting the image:" << reply->errorString();
121 return false;
124 return false;
122 }
125 }
123−
124 QFile file(fileName);
126 QFile file(fileName);
125 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
127 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
126 qWarning() << "Could not open file for writing:" << file.errorString();
128 qWarning() << "Could not open file for writing:" << file.errorString();
127 return false;
129 return false;
128 }
130 }
129− if (file.write(reply->readAll()) == -1){
131+ if (file.write(arr) == -1){
130 qWarning() << "Could not write the image:" << file.error();
132 qWarning() << "Could not write the image:" << file.error();
131 return false;
133 return false;
132 }
134 }
po/ar.po+6−6
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
11−"PO-Revision-Date: 2014-02-16 09:56+0000\n"
11+"PO-Revision-Date: 2014-02-21 11:19+0000\n"
12"Last-Translator: Ibrahim Saed <ibraheem5000@gmail.com>\n"
12"Last-Translator: Ibrahim Saed <ibraheem5000@gmail.com>\n"
13"Language-Team: Arabic <ar@li.org>\n"
13"Language-Team: Arabic <ar@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
@@ -16,8 +16,8 @@ msgstr ""
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n % 100 >= "
17"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n % 100 >= "
18"3 && n % 100 <= 10 ? 3 : n % 100 >= 11 && n % 100 <= 99 ? 4 : 5;\n"
18"3 && n % 100 <= 10 ? 3 : n % 100 >= 11 && n % 100 <= 99 ? 4 : 5;\n"
19−"X-Launchpad-Export-Date: 2014-02-19 05:44+0000\n"
19+"X-Launchpad-Export-Date: 2014-02-22 07:40+0000\n"
20−"X-Generator: Launchpad (build 16916)\n"
20+"X-Generator: Launchpad (build 16926)\n"
21
21
22#: plugins/Unity/Launcher/launcheritem.cpp:43
22#: plugins/Unity/Launcher/launcheritem.cpp:43
23#: plugins/Unity/Launcher/launcheritem.cpp:73
23#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -113,11 +113,11 @@ msgstr[5] "%1 تعليق"
113
113
114#: qml/Dash/Previews/PreviewActionCombo.qml:34
114#: qml/Dash/Previews/PreviewActionCombo.qml:34
115msgid "More..."
115msgid "More..."
116−msgstr ""
116+msgstr "المزيد..."
117
117
118#: qml/Dash/Previews/PreviewActionCombo.qml:34
118#: qml/Dash/Previews/PreviewActionCombo.qml:34
119msgid "Less..."
119msgid "Less..."
120−msgstr ""
120+msgstr "أقل..."
121
121
122#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
122#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
123msgid "Add a review"
123msgid "Add a review"
@@ -174,7 +174,7 @@ msgstr "عرض كلمة السر"
174
174
175#: qml/Notifications/NotificationMenuItemFactory.qml:103
175#: qml/Notifications/NotificationMenuItemFactory.qml:103
176msgid "Please enter SIM PIN"
176msgid "Please enter SIM PIN"
177−msgstr ""
177+msgstr "من فضلك أدخِل رقم التعريف الشخصي لبطاقة SIM"
178
178
179#: qml/Panel/SearchIndicator.qml:27
179#: qml/Panel/SearchIndicator.qml:27
180msgid "Search"
180msgid "Search"
po/fi.po+4−4
@@ -8,15 +8,15 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
11−"PO-Revision-Date: 2014-02-14 13:28+0000\n"
11+"PO-Revision-Date: 2014-02-21 19:36+0000\n"
12"Last-Translator: Jiri Grönroos <Unknown>\n"
12"Last-Translator: Jiri Grönroos <Unknown>\n"
13"Language-Team: Finnish <fi@li.org>\n"
13"Language-Team: Finnish <fi@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2014-02-19 05:44+0000\n"
18+"X-Launchpad-Export-Date: 2014-02-22 07:40+0000\n"
19−"X-Generator: Launchpad (build 16916)\n"
19+"X-Generator: Launchpad (build 16926)\n"
20
20
21#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:43
22#: plugins/Unity/Launcher/launcheritem.cpp:73
22#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -105,7 +105,7 @@ msgstr[1] "%1 arvostelua"
105
105
106#: qml/Dash/Previews/PreviewActionCombo.qml:34
106#: qml/Dash/Previews/PreviewActionCombo.qml:34
107msgid "More..."
107msgid "More..."
108−msgstr ""
108+msgstr "Lisää..."
109
109
110#: qml/Dash/Previews/PreviewActionCombo.qml:34
110#: qml/Dash/Previews/PreviewActionCombo.qml:34
111msgid "Less..."
111msgid "Less..."
po/sl.po+10−8
@@ -8,7 +8,7 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
11−"PO-Revision-Date: 2013-11-30 08:20+0000\n"
11+"PO-Revision-Date: 2014-02-21 16:38+0000\n"
12"Last-Translator: Damir Jerovšek <Unknown>\n"
12"Last-Translator: Damir Jerovšek <Unknown>\n"
13"Language-Team: Slovenian <sl@li.org>\n"
13"Language-Team: Slovenian <sl@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
@@ -16,8 +16,8 @@ msgstr ""
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || "
17"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || "
18"n%100==4 ? 3 : 0);\n"
18"n%100==4 ? 3 : 0);\n"
19−"X-Launchpad-Export-Date: 2014-02-19 05:44+0000\n"
19+"X-Launchpad-Export-Date: 2014-02-22 07:40+0000\n"
20−"X-Generator: Launchpad (build 16916)\n"
20+"X-Generator: Launchpad (build 16926)\n"
21
21
22#: plugins/Unity/Launcher/launcheritem.cpp:43
22#: plugins/Unity/Launcher/launcheritem.cpp:43
23#: plugins/Unity/Launcher/launcheritem.cpp:73
23#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -75,6 +75,8 @@ msgid ""
75"You have now mastered the edge gestures and can start using the "
75"You have now mastered the edge gestures and can start using the "
76"phone<br><br>Tap on the screen to start"
76"phone<br><br>Tap on the screen to start"
77msgstr ""
77msgstr ""
78+"Sedaj, ko ste osvojili poteze robov, lahko začnete uporabljati "
79+"telefon<br><br>Tapnite na zaslon za začetek"
78
80
79#: qml/Components/PageHeader.qml:340
81#: qml/Components/PageHeader.qml:340
80msgid "Recent searches"
82msgid "Recent searches"
@@ -82,11 +84,11 @@ msgstr "Nedavna iskanja"
82
84
83#: qml/Components/SeeMore.qml:35
85#: qml/Components/SeeMore.qml:35
84msgid "See more"
86msgid "See more"
85−msgstr ""
87+msgstr "Pokaži več"
86
88
87#: qml/Components/SeeMore.qml:57
89#: qml/Components/SeeMore.qml:57
88msgid "See less"
90msgid "See less"
89−msgstr ""
91+msgstr "Pokaži manj"
90
92
91#: qml/Dash/Apps/AppPreview.qml:136 qml/Dash/Previews/PreviewRating.qml:70
93#: qml/Dash/Apps/AppPreview.qml:136 qml/Dash/Previews/PreviewRating.qml:70
92msgid "Rate this"
94msgid "Rate this"
@@ -110,11 +112,11 @@ msgstr[3] "%1 ocene"
110
112
111#: qml/Dash/Previews/PreviewActionCombo.qml:34
113#: qml/Dash/Previews/PreviewActionCombo.qml:34
112msgid "More..."
114msgid "More..."
113−msgstr ""
115+msgstr "Več ..."
114
116
115#: qml/Dash/Previews/PreviewActionCombo.qml:34
117#: qml/Dash/Previews/PreviewActionCombo.qml:34
116msgid "Less..."
118msgid "Less..."
117−msgstr ""
119+msgstr "Manj ..."
118
120
119#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
121#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
120msgid "Add a review"
122msgid "Add a review"
@@ -171,7 +173,7 @@ msgstr "Pokaži geslo"
171
173
172#: qml/Notifications/NotificationMenuItemFactory.qml:103
174#: qml/Notifications/NotificationMenuItemFactory.qml:103
173msgid "Please enter SIM PIN"
175msgid "Please enter SIM PIN"
174−msgstr ""
176+msgstr "Vnesite PIN kartice SIM"
175
177
176#: qml/Panel/SearchIndicator.qml:27
178#: qml/Panel/SearchIndicator.qml:27
177msgid "Search"
179msgid "Search"
qml/Dash/Card.qml+40−2
@@ -30,7 +30,39 @@ Item {
30 property bool showHeader: true
30 property bool showHeader: true
31
31
32 implicitWidth: childrenRect.width
32 implicitWidth: childrenRect.width
33− implicitHeight: summary.y + summary.height
33+ implicitHeight: summary.y + summary.height + (summary.text && background.visible ? units.gu(1) : 0)
34+
35+ UbuntuShape {
36+ id: background
37+ objectName: "background"
38+ radius: "medium"
39+ visible: template["card-layout"] !== "horizontal" && (template["card-background"] || components["background"]
40+ || artAndSummary)
41+ property bool artAndSummary: components["art"]["field"] && components["summary"] || false
42+ color: getColor(0) || "white"
43+ gradientColor: getColor(1) || color
44+ anchors.fill: parent
45+ image: backgroundImage.source ? backgroundImage : null
46+
47+ property Image backgroundImage: Image {
48+ objectName: "backgroundImage"
49+ source: {
50+ if (cardData && typeof cardData["background"] === "string") return cardData["background"]
51+ else if (template && typeof template["card-background"] === "string") return template["card-background"]
52+ else return ""
53+ }
54+ }
55+
56+ function getColor(index) {
57+ if (cardData && typeof cardData["background"] === "object"
58+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
59+ return cardData["background"]["elements"][index];
60+ } else if (template && typeof template["card-background"] === "object"
61+ && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
62+ return template["card-background"]["elements"][index];
63+ } else return undefined;
64+ }
65+ }
34
66
35 UbuntuShape {
67 UbuntuShape {
36 id: artShape
68 id: artShape
@@ -138,7 +170,13 @@ Item {
138 Label {
170 Label {
139 id: summary
171 id: summary
140 objectName: "summaryLabel"
172 objectName: "summaryLabel"
173+ anchors {
141− anchors { top: header.visible ? header.bottom : artShape.bottom; left: parent.left; right: parent.right }
174+ top: header.visible ? header.bottom : artShape.bottom
175+ left: parent.left
176+ right: parent.right
177+ margins: background.visible ? units.gu(1) : 0
178+ topMargin: 0
179+ }
142 wrapMode: Text.Wrap
180 wrapMode: Text.Wrap
143 maximumLineCount: 5
181 maximumLineCount: 5
144 elide: Text.ElideRight
182 elide: Text.ElideRight
qml/Greeter/Greeter.qml+1−1
@@ -37,7 +37,7 @@ Showable {
37 property alias model: greeterContentLoader.model
37 property alias model: greeterContentLoader.model
38 property bool locked: shown && !LightDM.Greeter.promptless
38 property bool locked: shown && !LightDM.Greeter.promptless
39
39
40− readonly property bool narrowMode: !multiUser && width <= units.gu(60)
40+ readonly property bool narrowMode: !multiUser && height > width
41 readonly property bool multiUser: LightDM.Users.count > 1
41 readonly property bool multiUser: LightDM.Users.count > 1
42
42
43 readonly property bool leftTeaserPressed: greeterContentLoader.status == Loader.Ready &&
43 readonly property bool leftTeaserPressed: greeterContentLoader.status == Loader.Ready &&
qml/Shell.qml+1−1
@@ -340,7 +340,7 @@ FocusScope {
340 }
340 }
341 }
341 }
342
342
343− enabled: shell.width >= units.gu(60)
343+ enabled: shell.width >= units.gu(100)
344 visible: enabled
344 visible: enabled
345 fullyShown: stages.fullyShown && shown
345 fullyShown: stages.fullyShown && shown
346 && sideStage[sideStageRevealer.boundProperty] == sideStageRevealer.openedValue
346 && sideStage[sideStageRevealer.boundProperty] == sideStageRevealer.openedValue
tests/qmltests/Dash/artwork/checkers.pngnew file

Binary file not shown.

tests/qmltests/Dash/tst_Card.qml+59
@@ -79,6 +79,21 @@ Rectangle {
79 "layout": { "template": { "overlay": true },
79 "layout": { "template": { "overlay": true },
80 "components": JSON.parse(Helpers.fullMapping) }
80 "components": JSON.parse(Helpers.fullMapping) }
81 },
81 },
82+ {
83+ "name": "Art, header - grey background",
84+ "layout": { "template": { "card-background": { "type": "color", "elements": ["grey"] } },
85+ "components": JSON.parse(Helpers.fullMapping) }
86+ },
87+ {
88+ "name": "Art, header - gradient background",
89+ "layout": { "template": { "card-background": { "type": "gradient", "elements": ["grey", "white"] } },
90+ "components": JSON.parse(Helpers.fullMapping) }
91+ },
92+ {
93+ "name": "Art, header - image background",
94+ "layout": { "template": { "card-background": Qt.resolvedUrl("artwork/checkers.png") },
95+ "components": JSON.parse(Helpers.fullMapping) }
96+ },
82 ]
97 ]
83
98
84 CardTool {
99 CardTool {
@@ -171,12 +186,16 @@ Rectangle {
171 property Item art: findChild(card, "artShape")
186 property Item art: findChild(card, "artShape")
172 property Item artImage: findChild(card, "artImage")
187 property Item artImage: findChild(card, "artImage")
173 property Item summary: findChild(card, "summaryLabel")
188 property Item summary: findChild(card, "summaryLabel")
189+ property Item background: findChild(card, "background")
190+ property Item backgroundImage: findChild(card, "backgroundImage")
174
191
175 function initTestCase() {
192 function initTestCase() {
176 verify(typeof testCase.header === "object", "Couldn't find header object.");
193 verify(typeof testCase.header === "object", "Couldn't find header object.");
177 verify(typeof testCase.art === "object", "Couldn't find art object.");
194 verify(typeof testCase.art === "object", "Couldn't find art object.");
178 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
195 verify(typeof testCase.artImage === "object", "Couldn't find artImage object.");
179 verify(typeof testCase.summary === "object", "Couldn't find summary object.");
196 verify(typeof testCase.summary === "object", "Couldn't find summary object.");
197+ verify(typeof testCase.artImage === "object", "Couldn't find background object.");
198+ verify(typeof testCase.summary === "object", "Couldn't find backgroundImage object.");
180 }
199 }
181
200
182 function cleanup() {
201 function cleanup() {
@@ -356,6 +375,46 @@ Rectangle {
356 compare(testCase.art.width, 0);
375 compare(testCase.art.width, 0);
357 }
376 }
358
377
378+ function test_background_data() {
379+ return [
380+ { tag: "Art and summary", visible: true, color: "#ffffff", index: 0 },
381+ { tag: "No Summary", visible: false, index: 6 },
382+ { tag: "Horizontal", visible: false, index: 5 },
383+ { tag: "Grey background", visible: true, color: "#808080", index: 10 },
384+ { tag: "Overriden Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff",
385+ background: {type: "color", elements: ["grey", "white"]}, index: 10 },
386+ { tag: "Overriden Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"),
387+ background: Qt.resolvedUrl("artwork/checkers.png"), index: 10 },
388+ { tag: "Gradient background", visible: true, color: "#808080", gradientColor: "#ffffff", index: 11 },
389+ { tag: "Image background", visible: true, image: Qt.resolvedUrl("artwork/checkers.png"), index: 12 },
390+ ];
391+ }
392+
393+ function test_background(data) {
394+ selector.selectedIndex = data.index;
395+
396+ if (data.hasOwnProperty("background")) {
397+ card.cardData["background"] = data.background;
398+ card.cardDataChanged();
399+ }
400+
401+ waitForRendering(card);
402+
403+ tryCompare(background, "visible", data.visible);
404+
405+ if (data.hasOwnProperty("color")) {
406+ tryCompare(background, "color", data.color);
407+ }
408+
409+ if (data.hasOwnProperty("gradientColor")) {
410+ tryCompare(background, "gradientColor", data.gradientColor);
411+ }
412+
413+ if (data.hasOwnProperty("image")) {
414+ tryCompare(backgroundImage, "source", data.image);
415+ }
416+ }
417+
359 function test_font_weights_data() {
418 function test_font_weights_data() {
360 return [
419 return [
361 { tag: "Title only", index: 8, weight: Font.Normal },
420 { tag: "Title only", index: 8, weight: Font.Normal },