on xenial help sign in
Only use one Image-item for the shaped-icon feature, improved shaped-icon visibility-tests.
a520b9eMirco Müller
Notifications/ShapedIcon.qml+5−4
@@ -22,15 +22,16 @@ Item {
22 property bool shaped
22 property bool shaped
23
23
24 UbuntuShape {
24 UbuntuShape {
25+ objectName: "shapedIcon"
25 anchors.fill: parent
26 anchors.fill: parent
26 visible: shaped
27 visible: shaped
27− image: Image {
28+ image: realImage
28− source: fileSource
29− fillMode: Image.PreserveAspectCrop
30− }
31 }
29 }
32
30
33 Image {
31 Image {
32+ id: realImage
33+
34+ objectName: "nonShapedIcon"
34 anchors.fill: parent
35 anchors.fill: parent
35 visible: !shaped
36 visible: !shaped
36 source: fileSource
37 source: fileSource
tests/qmltests/Notifications/tst_Notifications.qml+18
@@ -226,6 +226,8 @@ Row {
226 bodyVisible: true,
226 bodyVisible: true,
227 interactiveAreaEnabled: false,
227 interactiveAreaEnabled: false,
228 iconVisible: true,
228 iconVisible: true,
229+ shapedIcon: true,
230+ nonShapedIcon: false,
229 secondaryIconVisible: true,
231 secondaryIconVisible: true,
230 buttonRowVisible: true,
232 buttonRowVisible: true,
231 buttonTinted: true
233 buttonTinted: true
@@ -243,6 +245,8 @@ Row {
243 bodyVisible: false,
245 bodyVisible: false,
244 interactiveAreaEnabled: false,
246 interactiveAreaEnabled: false,
245 iconVisible: false,
247 iconVisible: false,
248+ shapedIcon: false,
249+ nonShapedIcon: false,
246 secondaryIconVisible: true,
250 secondaryIconVisible: true,
247 buttonRowVisible: false,
251 buttonRowVisible: false,
248 buttonTinted: false
252 buttonTinted: false
@@ -260,6 +264,8 @@ Row {
260 bodyVisible: false,
264 bodyVisible: false,
261 interactiveAreaEnabled: false,
265 interactiveAreaEnabled: false,
262 iconVisible: false,
266 iconVisible: false,
267+ shapedIcon: false,
268+ nonShapedIcon: false,
263 secondaryIconVisible: true,
269 secondaryIconVisible: true,
264 buttonRowVisible: false,
270 buttonRowVisible: false,
265 buttonTinted: false
271 buttonTinted: false
@@ -277,6 +283,8 @@ Row {
277 bodyVisible: true,
283 bodyVisible: true,
278 interactiveAreaEnabled: true,
284 interactiveAreaEnabled: true,
279 iconVisible: true,
285 iconVisible: true,
286+ shapedIcon: true,
287+ nonShapedIcon: false,
280 secondaryIconVisible: false,
288 secondaryIconVisible: false,
281 buttonRowVisible: false,
289 buttonRowVisible: false,
282 buttonTinted: false
290 buttonTinted: false
@@ -295,6 +303,8 @@ Row {
295 bodyVisible: true,
303 bodyVisible: true,
296 interactiveAreaEnabled: false,
304 interactiveAreaEnabled: false,
297 iconVisible: true,
305 iconVisible: true,
306+ shapedIcon: true,
307+ nonShapedIcon: false,
298 secondaryIconVisible: false,
308 secondaryIconVisible: false,
299 buttonRowVisible: true,
309 buttonRowVisible: true,
300 buttonTinted: false
310 buttonTinted: false
@@ -312,6 +322,8 @@ Row {
312 bodyVisible: true,
322 bodyVisible: true,
313 interactiveAreaEnabled: false,
323 interactiveAreaEnabled: false,
314 iconVisible: true,
324 iconVisible: true,
325+ shapedIcon: true,
326+ nonShapedIcon: false,
315 secondaryIconVisible: true,
327 secondaryIconVisible: true,
316 buttonRowVisible: false,
328 buttonRowVisible: false,
317 buttonTinted: false
329 buttonTinted: false
@@ -330,6 +342,8 @@ Row {
330 bodyVisible: true,
342 bodyVisible: true,
331 interactiveAreaEnabled: false,
343 interactiveAreaEnabled: false,
332 iconVisible: true,
344 iconVisible: true,
345+ shapedIcon: false,
346+ nonShapedIcon: true,
333 secondaryIconVisible: false,
347 secondaryIconVisible: false,
334 buttonRowVisible: false,
348 buttonRowVisible: false,
335 buttonTinted: false
349 buttonTinted: false
@@ -368,6 +382,8 @@ Row {
368 verify(notification !== undefined, "notification wasn't found");
382 verify(notification !== undefined, "notification wasn't found");
369
383
370 var icon = findChild(notification, "icon")
384 var icon = findChild(notification, "icon")
385+ var shapedIcon = findChild(notification, "shapedIcon")
386+ var nonShapedIcon = findChild(notification, "nonShapedIcon")
371 var interactiveArea = findChild(notification, "interactiveArea")
387 var interactiveArea = findChild(notification, "interactiveArea")
372 var secondaryIcon = findChild(notification, "secondaryIcon")
388 var secondaryIcon = findChild(notification, "secondaryIcon")
373 var summaryLabel = findChild(notification, "summaryLabel")
389 var summaryLabel = findChild(notification, "summaryLabel")
@@ -376,6 +392,8 @@ Row {
376 waitForRendering(buttonRow)
392 waitForRendering(buttonRow)
377
393
378 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
394 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
395+ compare(shapedIcon.visible, data.shapedIcon, "shaped-icon visibility is incorrect")
396+ compare(nonShapedIcon.visible, data.nonShapedIcon, "non-shaped-icon visibility is incorrect")
379 compare(interactiveArea.enabled, data.interactiveAreaEnabled, "check for interactive area")
397 compare(interactiveArea.enabled, data.interactiveAreaEnabled, "check for interactive area")
380
398
381 if(data.interactiveAreaEnabled) {
399 if(data.interactiveAreaEnabled) {