This only tests that Button.clicked signal is working. You should instead create an actionInvoked(string) signal on Notification and spy on this signal, making sure that SignalSpy.signalArguments are as expected.
Another run through the code itself
===================================
Again, top-level components in a file should not have width or height defined. Use implicitHeight and get rid of width altogether - it's determined by the delegate definition in Notifications.qml.
========
57 + visible: type == "Notifications.Type.Interactive"
MouseAreas are not graphical, use "enabled" instead.
Tests ======= ======= ===
=======
627 + wait(0)
Looks unnecessary?
========
643 + interactiveArea Spy.clear( ) .clear( )
644 + clickThroughSpy
651 + clickThroughSpy .clear( )
You should do that in a « function cleanup() » instead - it's called after every test case.
========
646 + interactiveArea Spy.wait( ) interactiveArea Spy.count == 1)
647 + verify(
653 + clickThroughSpy .wait() clickThroughSpy .count == 1)
654 + verify(
SignalSpy.wait() already verifies the count is 1.
========
648 + verify( clickThroughSpy .count == 0)
Should use compare().
========
649 + }
650 + else {
Please keep in one line.
========
638 + compare( icon.visible, data.iconVisible, "check for icon of notification" + (mockModel.count - 1)) interactiveArea .visible, data.interactiv eAreaVisible, "check for interactive notification" + (mockModel.count - 1))
639 + compare(
657 + compare( secondaryIcon. visible, data.secondaryI conVisible, "check for secondary icon" + (mockModel.count - 1)) summaryLabel. visible, data.summaryVis ible, "check for summary-label" + (mockModel.count - 1)) bodyLabel. visible, data.bodyVisible, "check for body-label" + (mockModel.count - 1)) buttonRow. visible, data.buttonRowV isible, "check for buttons" + (mockModel.count - 1))
658 + compare(
659 + compare(
660 + compare(
The messages could be improved, and also "notification1", "notification2" are not really useful - the tag: from _data() shows which test is being run.
========
662 + if(data. buttonRowVisibl e) { buttonRow, "button0") buttonRow, "button1") buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2) buttonSpy. count == 1) buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2) buttonSpy. count == 1)
663 + var buttonCancel = findChild(
664 + var buttonAccept = findChild(
665 +
666 + buttonSpy.target = buttonCancel
667 + buttonSpy.clear()
668 + mouseClick(
669 + buttonSpy.wait()
670 + verify(
671 +
672 + buttonSpy.target = buttonAccept
673 + buttonSpy.clear()
674 + mouseClick(
675 + buttonSpy.wait()
676 + verify(
677 + }
This only tests that Button.clicked signal is working. You should instead create an actionInvoked( string) signal on Notification and spy on this signal, making sure that SignalSpy. signalArguments are as expected.
Another run through the code itself ======= ======= ======= =======
=======
46 + width: parent.width
47 + height: childrenRect.height
Again, top-level components in a file should not have width or height defined. Use implicitHeight and get rid of width altogether - it's determined by the delegate definition in Notifications.qml.
========
57 + visible: type == "Notifications. Type.Interactiv e"
MouseAreas are not graphical, use "enabled" instead.
========
58 + onClicked: print("clicked " + actions.get(0).id)
Forward through actionInvoked( string) signal mentioned above.
======= ======= ======= ======= ======
Going into a meeting, more in a bit.