Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk-fix-icon-svg-image-loading into lp:ubuntu-ui-toolkit/staging
- trunk-fix-icon-svg-image-loading
- Merge into staging
Status: | Rejected | ||||||||
---|---|---|---|---|---|---|---|---|---|
Rejected by: | Michał Sawicz | ||||||||
Proposed branch: | lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk-fix-icon-svg-image-loading | ||||||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||||||
Diff against target: |
280 lines (+77/-66) 3 files modified
src/Ubuntu/Components/plugin/unitythemeiconprovider.cpp (+61/-51) src/Ubuntu/Components/plugin/unitythemeiconprovider.h (+1/-1) tests/unit_x11/tst_iconprovider/tst_iconprovider.cpp (+15/-14) |
||||||||
To merge this branch: | bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/trunk-fix-icon-svg-image-loading | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Sawicz | Disapprove | ||
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Review via email: mp+292509@code.launchpad.net |
Commit message
Adjust the UnityThemeIconP
Description of the change
The Pixmap->Image thing might be unnecessary, but
1) I wanted to duplicate exactly Qt's behaviour and
2) Qt converts the QPixmap to a QImage internally before uploading to texture
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1282
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1282
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1282
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1282
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 1283. By Michał Sawicz
-
Make tst_IconProvider talk in QImage
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1283
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1283
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1283
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1283
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:1283
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 1284. By Lukáš Tinkl
-
fix loading & scaling SVGs
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1284
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1284
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1284
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1284
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1284
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 1285. By Lukáš Tinkl
-
add a test with wrong aspect ratio that returns a correct one
- 1286. By Lukáš Tinkl
-
add a test that passes here and fails with trunk
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1286
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1286
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1286
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1286
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:1286
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
Preview Diff
1 | === modified file 'src/Ubuntu/Components/plugin/unitythemeiconprovider.cpp' | |||
2 | --- src/Ubuntu/Components/plugin/unitythemeiconprovider.cpp 2016-03-16 14:24:15 +0000 | |||
3 | +++ src/Ubuntu/Components/plugin/unitythemeiconprovider.cpp 2016-04-27 16:15:41 +0000 | |||
4 | @@ -21,8 +21,7 @@ | |||
5 | 21 | #include <QDir> | 21 | #include <QDir> |
6 | 22 | #include <QFileInfo> | 22 | #include <QFileInfo> |
7 | 23 | #include <QSettings> | 23 | #include <QSettings> |
10 | 24 | #include <QSvgRenderer> | 24 | #include <QImageReader> |
9 | 25 | #include <QPainter> | ||
11 | 26 | #include <QStandardPaths> | 25 | #include <QStandardPaths> |
12 | 27 | #include <QtDebug> | 26 | #include <QtDebug> |
13 | 28 | 27 | ||
14 | @@ -48,27 +47,27 @@ | |||
15 | 48 | // Does a breadth-first search for an icon with any name in @names. Parent | 47 | // Does a breadth-first search for an icon with any name in @names. Parent |
16 | 49 | // themes are only looked at if the current theme doesn't contain any icon | 48 | // themes are only looked at if the current theme doesn't contain any icon |
17 | 50 | // in @names. | 49 | // in @names. |
19 | 51 | QPixmap findBestIcon(const QStringList &names, const QSize &size, QSet<QString> *alreadySearchedThemes) | 50 | QImage findBestIcon(const QStringList &names, QSize *impsize, const QSize &size, QSet<QString> *alreadySearchedThemes) |
20 | 52 | { | 51 | { |
21 | 53 | if (alreadySearchedThemes) { | 52 | if (alreadySearchedThemes) { |
22 | 54 | if (alreadySearchedThemes->contains(name)) | 53 | if (alreadySearchedThemes->contains(name)) |
24 | 55 | return QPixmap(); | 54 | return QImage(); |
25 | 56 | alreadySearchedThemes->insert(name); | 55 | alreadySearchedThemes->insert(name); |
26 | 57 | } | 56 | } |
27 | 58 | 57 | ||
28 | 59 | Q_FOREACH(const QString &name, names) { | 58 | Q_FOREACH(const QString &name, names) { |
32 | 60 | QPixmap pixmap = lookupIcon(name, size); | 59 | QImage image = lookupIcon(name, impsize, size); |
33 | 61 | if (!pixmap.isNull()) | 60 | if (!image.isNull()) |
34 | 62 | return pixmap; | 61 | return image; |
35 | 63 | } | 62 | } |
36 | 64 | 63 | ||
37 | 65 | Q_FOREACH(IconThemePointer theme, parents) { | 64 | Q_FOREACH(IconThemePointer theme, parents) { |
41 | 66 | QPixmap pixmap = theme->findBestIcon(names, size, alreadySearchedThemes); | 65 | QImage image = theme->findBestIcon(names, impsize, size, alreadySearchedThemes); |
42 | 67 | if (!pixmap.isNull()) | 66 | if (!image.isNull()) |
43 | 68 | return pixmap; | 67 | return image; |
44 | 69 | } | 68 | } |
45 | 70 | 69 | ||
47 | 71 | return QPixmap(); | 70 | return QImage(); |
48 | 72 | } | 71 | } |
49 | 73 | 72 | ||
50 | 74 | private: | 73 | private: |
51 | @@ -82,7 +81,7 @@ | |||
52 | 82 | 81 | ||
53 | 83 | IconTheme(const QString &name): name(name) | 82 | IconTheme(const QString &name): name(name) |
54 | 84 | { | 83 | { |
56 | 85 | QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); | 84 | const QStringList paths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); |
57 | 86 | 85 | ||
58 | 87 | Q_FOREACH(const QString &path, paths) { | 86 | Q_FOREACH(const QString &path, paths) { |
59 | 88 | QDir dir(path + "/icons/" + name); | 87 | QDir dir(path + "/icons/" + name); |
60 | @@ -130,30 +129,42 @@ | |||
61 | 130 | return Fixed; | 129 | return Fixed; |
62 | 131 | } | 130 | } |
63 | 132 | 131 | ||
65 | 133 | static QPixmap loadIcon(const QString &filename, const QSize &size) | 132 | static QImage loadIcon(const QString &filename, QSize *impsize, const QSize &requestSize) |
66 | 134 | { | 133 | { |
89 | 135 | QPixmap pixmap; | 134 | QImage image; |
90 | 136 | 135 | QImageReader imgio(filename); | |
91 | 137 | const bool anyZero = size.width() <= 0 || size.height() <= 0; | 136 | |
92 | 138 | const Qt::AspectRatioMode scaleMode = anyZero ? Qt::KeepAspectRatioByExpanding : Qt::KeepAspectRatio; | 137 | const bool force_scale = imgio.format() == QStringLiteral("svg") |
93 | 139 | 138 | || imgio.format() == QStringLiteral("svgz"); | |
94 | 140 | if (filename.endsWith(QLatin1String(".png"))) { | 139 | |
95 | 141 | pixmap = QPixmap(filename); | 140 | if (requestSize.width() > 0 || requestSize.height() > 0) { |
96 | 142 | if (!pixmap.isNull() && !size.isNull() && (pixmap.width() != size.width() || pixmap.height() != size.height())) { | 141 | QSize s = imgio.size(); |
97 | 143 | const QSize newSize = pixmap.size().scaled(size.width(), size.height(), scaleMode); | 142 | qreal ratio = 0.0; |
98 | 144 | pixmap = pixmap.scaled(newSize); | 143 | if (requestSize.width() > 0 && (force_scale || requestSize.width() < s.width())) { |
99 | 145 | } | 144 | ratio = qreal(requestSize.width())/s.width(); |
100 | 146 | } | 145 | } |
101 | 147 | else if (filename.endsWith(QLatin1String(".svg"))) { | 146 | if (requestSize.height() > 0 && (force_scale || requestSize.height() < s.height())) { |
102 | 148 | QSvgRenderer renderer(filename); | 147 | qreal hr = qreal(requestSize.height())/s.height(); |
103 | 149 | pixmap = QPixmap(renderer.defaultSize().scaled(size.width(), size.height(), scaleMode)); | 148 | if (ratio == 0.0 || hr < ratio) |
104 | 150 | pixmap.fill(Qt::transparent); | 149 | ratio = hr; |
105 | 151 | QPainter painter(&pixmap); | 150 | } |
106 | 152 | renderer.render(&painter); | 151 | if (ratio > 0.0) { |
107 | 153 | painter.end(); | 152 | s.setHeight(qRound(s.height() * ratio)); |
108 | 154 | } | 153 | s.setWidth(qRound(s.width() * ratio)); |
109 | 155 | 154 | imgio.setScaledSize(s); | |
110 | 156 | return pixmap; | 155 | } |
111 | 156 | } | ||
112 | 157 | |||
113 | 158 | if (impsize) | ||
114 | 159 | *impsize = imgio.scaledSize(); | ||
115 | 160 | |||
116 | 161 | if (imgio.read(&image)) { | ||
117 | 162 | if (impsize) | ||
118 | 163 | *impsize = image.size(); | ||
119 | 164 | return image; | ||
120 | 165 | } else { | ||
121 | 166 | return QImage(); | ||
122 | 167 | } | ||
123 | 157 | } | 168 | } |
124 | 158 | 169 | ||
125 | 159 | QString lookupIconFile(const QString &dir, const QString &name) | 170 | QString lookupIconFile(const QString &dir, const QString &name) |
126 | @@ -174,16 +185,16 @@ | |||
127 | 174 | return QString(); | 185 | return QString(); |
128 | 175 | } | 186 | } |
129 | 176 | 187 | ||
131 | 177 | QPixmap lookupIcon(const QString &iconName, const QSize &size) | 188 | QImage lookupIcon(const QString &iconName, QSize *impsize, const QSize &size) |
132 | 178 | { | 189 | { |
133 | 179 | const int iconSize = qMax(size.width(), size.height()); | 190 | const int iconSize = qMax(size.width(), size.height()); |
134 | 180 | if (iconSize > 0) | 191 | if (iconSize > 0) |
136 | 181 | return lookupBestMatchingIcon(iconName, size); | 192 | return lookupBestMatchingIcon(iconName, impsize, size); |
137 | 182 | else | 193 | else |
139 | 183 | return lookupLargestIcon(iconName); | 194 | return lookupLargestIcon(iconName, impsize); |
140 | 184 | } | 195 | } |
141 | 185 | 196 | ||
143 | 186 | QPixmap lookupBestMatchingIcon(const QString &iconName, const QSize &size) | 197 | QImage lookupBestMatchingIcon(const QString &iconName, QSize *impsize, const QSize &size) |
144 | 187 | { | 198 | { |
145 | 188 | int minDistance = 10000; | 199 | int minDistance = 10000; |
146 | 189 | QString bestFilename; | 200 | QString bestFilename; |
147 | @@ -205,12 +216,12 @@ | |||
148 | 205 | } | 216 | } |
149 | 206 | 217 | ||
150 | 207 | if (!bestFilename.isNull()) | 218 | if (!bestFilename.isNull()) |
152 | 208 | return loadIcon(bestFilename, size); | 219 | return loadIcon(bestFilename, impsize, size); |
153 | 209 | 220 | ||
155 | 210 | return QPixmap(); | 221 | return QImage(); |
156 | 211 | } | 222 | } |
157 | 212 | 223 | ||
159 | 213 | QPixmap lookupLargestIcon(const QString &iconName) | 224 | QImage lookupLargestIcon(const QString &iconName, QSize *impsize) |
160 | 214 | { | 225 | { |
161 | 215 | int maxSize = 0; | 226 | int maxSize = 0; |
162 | 216 | QString bestFilename; | 227 | QString bestFilename; |
163 | @@ -228,9 +239,9 @@ | |||
164 | 228 | } | 239 | } |
165 | 229 | 240 | ||
166 | 230 | if (!bestFilename.isNull()) | 241 | if (!bestFilename.isNull()) |
168 | 231 | return loadIcon(bestFilename, QSize(maxSize, maxSize)); | 242 | return loadIcon(bestFilename, impsize, QSize(maxSize, maxSize)); |
169 | 232 | 243 | ||
171 | 233 | return QPixmap(); | 244 | return QImage(); |
172 | 234 | } | 245 | } |
173 | 235 | 246 | ||
174 | 236 | int directorySizeDistance(const Directory &dir, const QSize &iconSize) | 247 | int directorySizeDistance(const Directory &dir, const QSize &iconSize) |
175 | @@ -258,24 +269,23 @@ | |||
176 | 258 | }; | 269 | }; |
177 | 259 | 270 | ||
178 | 260 | UnityThemeIconProvider::UnityThemeIconProvider(const QString &themeName): | 271 | UnityThemeIconProvider::UnityThemeIconProvider(const QString &themeName): |
180 | 261 | QQuickImageProvider(QQuickImageProvider::Pixmap) | 272 | QQuickImageProvider(QQuickImageProvider::Image) |
181 | 262 | { | 273 | { |
182 | 263 | theme = IconTheme::get(themeName); | 274 | theme = IconTheme::get(themeName); |
183 | 264 | } | 275 | } |
184 | 265 | 276 | ||
186 | 266 | QPixmap UnityThemeIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) | 277 | QImage UnityThemeIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) |
187 | 267 | { | 278 | { |
188 | 268 | // The hicolor theme will be searched last as per | 279 | // The hicolor theme will be searched last as per |
189 | 269 | // https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html | 280 | // https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html |
190 | 270 | QSet<QString> alreadySearchedThemes; | 281 | QSet<QString> alreadySearchedThemes; |
191 | 271 | const QStringList names = id.split(QLatin1Char(','), QString::SkipEmptyParts); | 282 | const QStringList names = id.split(QLatin1Char(','), QString::SkipEmptyParts); |
193 | 272 | QPixmap pixmap = theme->findBestIcon(names, requestedSize, &alreadySearchedThemes); | 283 | QImage image = theme->findBestIcon(names, size, requestedSize, &alreadySearchedThemes); |
194 | 273 | 284 | ||
196 | 274 | if (pixmap.isNull()) { | 285 | if (image.isNull()) { |
197 | 275 | IconTheme::IconThemePointer theme = IconTheme::get(QStringLiteral("hicolor")); | 286 | IconTheme::IconThemePointer theme = IconTheme::get(QStringLiteral("hicolor")); |
199 | 276 | return theme->findBestIcon(names, requestedSize, nullptr); | 287 | return theme->findBestIcon(names, size, requestedSize, nullptr); |
200 | 277 | } | 288 | } |
201 | 278 | 289 | ||
204 | 279 | *size = pixmap.size(); | 290 | return image; |
203 | 280 | return pixmap; | ||
205 | 281 | } | 291 | } |
206 | 282 | 292 | ||
207 | === modified file 'src/Ubuntu/Components/plugin/unitythemeiconprovider.h' | |||
208 | --- src/Ubuntu/Components/plugin/unitythemeiconprovider.h 2016-03-16 14:24:15 +0000 | |||
209 | +++ src/Ubuntu/Components/plugin/unitythemeiconprovider.h 2016-04-27 16:15:41 +0000 | |||
210 | @@ -25,7 +25,7 @@ | |||
211 | 25 | { | 25 | { |
212 | 26 | public: | 26 | public: |
213 | 27 | UnityThemeIconProvider(const QString &themeName = QStringLiteral("suru")); | 27 | UnityThemeIconProvider(const QString &themeName = QStringLiteral("suru")); |
215 | 28 | QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize); | 28 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); |
216 | 29 | 29 | ||
217 | 30 | private: | 30 | private: |
218 | 31 | QSharedPointer<class IconTheme> theme; | 31 | QSharedPointer<class IconTheme> theme; |
219 | 32 | 32 | ||
220 | === modified file 'tests/unit_x11/tst_iconprovider/tst_iconprovider.cpp' | |||
221 | --- tests/unit_x11/tst_iconprovider/tst_iconprovider.cpp 2016-03-16 15:02:35 +0000 | |||
222 | +++ tests/unit_x11/tst_iconprovider/tst_iconprovider.cpp 2016-04-27 16:15:41 +0000 | |||
223 | @@ -39,14 +39,15 @@ | |||
224 | 39 | QTest::addColumn<QSize>("requestSize"); | 39 | QTest::addColumn<QSize>("requestSize"); |
225 | 40 | QTest::addColumn<QSize>("resultSize"); | 40 | QTest::addColumn<QSize>("resultSize"); |
226 | 41 | 41 | ||
229 | 42 | QTest::newRow("battery0") << "battery-100-charging" << QSize(-1, -1) << QSize(256, 165); | 42 | QTest::newRow("battery0") << "battery-100-charging" << QSize(-1, -1) << QSize(256, 166); |
230 | 43 | QTest::newRow("battery1") << "battery-100-charging" << QSize(-1, 16) << QSize(24, 16); | 43 | QTest::newRow("battery1") << "battery-100-charging" << QSize(-1, 16) << QSize(25, 16); |
231 | 44 | QTest::newRow("battery2") << "battery-100-charging" << QSize(16, -1) << QSize(16, 10); | 44 | QTest::newRow("battery2") << "battery-100-charging" << QSize(16, -1) << QSize(16, 10); |
233 | 45 | QTest::newRow("battery3") << "battery-100-charging" << QSize(0, 16) << QSize(24, 16); | 45 | QTest::newRow("battery3") << "battery-100-charging" << QSize(0, 16) << QSize(25, 16); |
234 | 46 | QTest::newRow("battery4") << "battery-100-charging" << QSize(16, 0) << QSize(16, 10); | 46 | QTest::newRow("battery4") << "battery-100-charging" << QSize(16, 0) << QSize(16, 10); |
235 | 47 | QTest::newRow("battery5") << "battery-100-charging" << QSize(24, 16) << QSize(24, 16); | 47 | QTest::newRow("battery5") << "battery-100-charging" << QSize(24, 16) << QSize(24, 16); |
237 | 48 | QTest::newRow("battery6") << "battery-100-charging" << QSize(24, 24) << QSize(24, 15); | 48 | QTest::newRow("battery6") << "battery-100-charging" << QSize(24, 24) << QSize(24, 16); |
238 | 49 | QTest::newRow("battery7") << "battery-100-charging" << QSize(37, 24) << QSize(37, 24); | 49 | QTest::newRow("battery7") << "battery-100-charging" << QSize(37, 24) << QSize(37, 24); |
239 | 50 | QTest::newRow("battery8") << "battery-100-charging" << QSize(15, 512) << QSize(15, 10); | ||
240 | 50 | 51 | ||
241 | 51 | QTest::newRow("gallery0") << "gallery-app" << QSize(-1, -1) << QSize(512, 512); | 52 | QTest::newRow("gallery0") << "gallery-app" << QSize(-1, -1) << QSize(512, 512); |
242 | 52 | QTest::newRow("gallery1") << "gallery-app" << QSize(-1, 16) << QSize(16, 16); | 53 | QTest::newRow("gallery1") << "gallery-app" << QSize(-1, 16) << QSize(16, 16); |
243 | @@ -65,13 +66,13 @@ | |||
244 | 65 | 66 | ||
245 | 66 | UnityThemeIconProvider provider("mockTheme"); | 67 | UnityThemeIconProvider provider("mockTheme"); |
246 | 67 | QSize returnedSize; | 68 | QSize returnedSize; |
249 | 68 | QPixmap p = provider.requestPixmap(icon, &returnedSize, requestSize); | 69 | QImage i = provider.requestImage(icon, &returnedSize, requestSize); |
250 | 69 | QCOMPARE(p.size(), resultSize); | 70 | QCOMPARE(i.size(), resultSize); |
251 | 70 | QCOMPARE(returnedSize, resultSize); | 71 | QCOMPARE(returnedSize, resultSize); |
252 | 71 | 72 | ||
253 | 72 | // Search again to make sure subsequent searches still work | 73 | // Search again to make sure subsequent searches still work |
256 | 73 | p = provider.requestPixmap(icon, &returnedSize, requestSize); | 74 | i = provider.requestImage(icon, &returnedSize, requestSize); |
257 | 74 | QCOMPARE(p.size(), resultSize); | 75 | QCOMPARE(i.size(), resultSize); |
258 | 75 | QCOMPARE(returnedSize, resultSize); | 76 | QCOMPARE(returnedSize, resultSize); |
259 | 76 | } | 77 | } |
260 | 77 | 78 | ||
261 | @@ -82,14 +83,14 @@ | |||
262 | 82 | 83 | ||
263 | 83 | // myapp is in MockTheme3 (white) and hicolor (black) | 84 | // myapp is in MockTheme3 (white) and hicolor (black) |
264 | 84 | // MockTheme3 one is returned since hicolor is last per spec | 85 | // MockTheme3 one is returned since hicolor is last per spec |
268 | 85 | QPixmap p = provider.requestPixmap("myapp", &returnedSize, QSize(-1, -1)); | 86 | QImage i = provider.requestImage("myapp", &returnedSize, QSize(-1, -1)); |
269 | 86 | QVERIFY(!p.isNull()); | 87 | QVERIFY(!i.isNull()); |
270 | 87 | QCOMPARE(QColor(p.toImage().pixel(0,0)), QColor(Qt::white)); | 88 | QCOMPARE(QColor(i.pixel(0,0)), QColor(Qt::white)); |
271 | 88 | 89 | ||
272 | 89 | // myapp2 is only in hicolor (black) so that's the one returned | 90 | // myapp2 is only in hicolor (black) so that's the one returned |
276 | 90 | p = provider.requestPixmap("myapp2", &returnedSize, QSize(-1, -1)); | 91 | i = provider.requestImage("myapp2", &returnedSize, QSize(-1, -1)); |
277 | 91 | QVERIFY(!p.isNull()); | 92 | QVERIFY(!i.isNull()); |
278 | 92 | QCOMPARE(QColor(p.toImage().pixel(0,0)), QColor(Qt::black)); | 93 | QCOMPARE(QColor(i.pixel(0,0)), QColor(Qt::black)); |
279 | 93 | } | 94 | } |
280 | 94 | }; | 95 | }; |
281 | 95 | 96 |
FAILED: Continuous integration, rev:1282 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- devel/501/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/2794/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- devel/501/ rebuild
https:/