on xenial help sign in
Made the Notifications QML-test work again...
38237dcMirco Müller
tests/qmltests/Notifications/tst_Notifications.qml+18−11
@@ -43,6 +43,21 @@ Row {
43 function getRaw(id) {
43 function getRaw(id) {
44 return mockNotification.createObject(mockModel)
44 return mockNotification.createObject(mockModel)
45 }
45 }
46+
47+ // add the default/PlaceHolder notification to the model
48+ Component.onCompleted: {
49+ var n = {
50+ type: Notification.PlaceHolder,
51+ hints: {},
52+ summary: "",
53+ body: "",
54+ icon: "",
55+ secondaryIcon: "",
56+ actions: []
57+ }
58+
59+ append(n)
60+ }
46 }
61 }
47
62
48 function addSnapDecisionNotification() {
63 function addSnapDecisionNotification() {
@@ -370,7 +385,6 @@ Row {
370 mockModel.append(data)
385 mockModel.append(data)
371
386
372 // make sure the view is properly updated before going on
387 // make sure the view is properly updated before going on
373− notifications.forceLayout();
374 waitForRendering(notifications);
388 waitForRendering(notifications);
375
389
376 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
390 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
@@ -384,7 +398,6 @@ Row {
384 var summaryLabel = findChild(notification, "summaryLabel")
398 var summaryLabel = findChild(notification, "summaryLabel")
385 var bodyLabel = findChild(notification, "bodyLabel")
399 var bodyLabel = findChild(notification, "bodyLabel")
386 var buttonRow = findChild(notification, "buttonRow")
400 var buttonRow = findChild(notification, "buttonRow")
387− waitForRendering(buttonRow)
388
401
389 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
402 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
390 compare(shapedIcon.visible, data.shapedIcon, "shaped-icon visibility is incorrect")
403 compare(shapedIcon.visible, data.shapedIcon, "shaped-icon visibility is incorrect")
@@ -402,17 +415,15 @@ Row {
402 compare(summaryLabel.visible, data.summaryVisible, "summary-text visibility is incorrect")
415 compare(summaryLabel.visible, data.summaryVisible, "summary-text visibility is incorrect")
403 compare(bodyLabel.visible, data.bodyVisible, "body-text visibility is incorrect")
416 compare(bodyLabel.visible, data.bodyVisible, "body-text visibility is incorrect")
404 compare(buttonRow.visible, data.buttonRowVisible, "button visibility is incorrect")
417 compare(buttonRow.visible, data.buttonRowVisible, "button visibility is incorrect")
418+ wait(500);
405
419
406 if(data.buttonRowVisible) {
420 if(data.buttonRowVisible) {
407 var buttonCancel = findChild(buttonRow, "button1")
421 var buttonCancel = findChild(buttonRow, "button1")
408 var buttonAccept = findChild(buttonRow, "button0")
422 var buttonAccept = findChild(buttonRow, "button0")
409
423
410− waitForRendering(notification)
411−
412 // only test the left/cancel-button if two actions have been passed in
424 // only test the left/cancel-button if two actions have been passed in
413 if (data.actions.length == 2) {
425 if (data.actions.length == 2) {
414 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
426 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
415− actionSpy.wait()
416 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
427 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
417 actionSpy.clear()
428 actionSpy.clear()
418 }
429 }
@@ -422,9 +433,9 @@ Row {
422
433
423 // click the positive/right button
434 // click the positive/right button
424 mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2)
435 mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2)
425− actionSpy.wait()
426 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
436 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
427 actionSpy.clear()
437 actionSpy.clear()
438+ wait(500);
428
439
429 // check if there's more than one negative choice
440 // check if there's more than one negative choice
430 if (data.actions.length > 2) {
441 if (data.actions.length > 2) {
@@ -432,27 +443,23 @@ Row {
432
443
433 // click to expand
444 // click to expand
434 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
445 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
435− waitForRendering(notification)
446+ wait(500);
436 actionSpy.clear()
447 actionSpy.clear()
437
448
438 // test the additional buttons
449 // test the additional buttons
439 for (var i = 2; i < data.actions.length; i++) {
450 for (var i = 2; i < data.actions.length; i++) {
440− waitForRendering(notification)
441 var buttonColumn = findChild(notification, "buttonColumn")
451 var buttonColumn = findChild(notification, "buttonColumn")
442 var button = findChild(buttonColumn, "button" + i)
452 var button = findChild(buttonColumn, "button" + i)
443 mouseClick(button, button.width / 2, button.height / 2)
453 mouseClick(button, button.width / 2, button.height / 2)
444− actionSpy.wait()
445 compare(actionSpy.signalArguments[0][0], data.actions[i]["id"], "got wrong id for additional negative action")
454 compare(actionSpy.signalArguments[0][0], data.actions[i]["id"], "got wrong id for additional negative action")
446 actionSpy.clear()
455 actionSpy.clear()
447 }
456 }
448
457
449 // click to collapse
458 // click to collapse
450 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
459 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
451− waitForRendering(notification)
452 tryCompare(notification, "height", initialHeight)
460 tryCompare(notification, "height", initialHeight)
453 } else {
461 } else {
454 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
462 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
455− actionSpy.wait()
456 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
463 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
457 }
464 }
458 }
465 }