Add tests for StatusListItem
This commit is contained in:
parent
a8944d8c72
commit
fbdc3a6a13
|
@ -12,5 +12,6 @@
|
|||
<file>base/ProfileModelData.qml</file>
|
||||
<file>base/WindowTestCase.qml</file>
|
||||
<file>tst_chatinfotoolbar.qml</file>
|
||||
<file>tst_statuslistitem.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -3,7 +3,7 @@ import QtQuick.Window 2.14
|
|||
import QtTest 1.14
|
||||
|
||||
import "base"
|
||||
import "status-desktop/ui/onboarding" as DesktopComponents
|
||||
import "status-desktop/ui/app/AppLayouts/Onboarding/popups" as DesktopComponents
|
||||
|
||||
|
||||
WindowTestCase {
|
||||
|
|
|
@ -3,7 +3,7 @@ import QtQuick.Window 2.14
|
|||
import QtTest 1.14
|
||||
|
||||
import "base"
|
||||
import "status-desktop/ui/onboarding" as DesktopComponents
|
||||
import "status-desktop/ui/app/AppLayouts/Onboarding/popups" as DesktopComponents
|
||||
|
||||
|
||||
WindowTestCase {
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import QtQuick 2.14
|
||||
import QtTest 1.14
|
||||
|
||||
import "base"
|
||||
|
||||
import StatusQ.Components 0.1
|
||||
|
||||
WindowTestCase {
|
||||
name: "StatusListItem test"
|
||||
|
||||
SignalSpy {
|
||||
id: clickedSpy
|
||||
target: listItem
|
||||
signalName: "clicked"
|
||||
}
|
||||
|
||||
SignalSpy {
|
||||
id: titleClickedSpy
|
||||
target: listItem
|
||||
signalName: "titleClicked"
|
||||
}
|
||||
|
||||
StatusListItem {
|
||||
id: listItem
|
||||
|
||||
parent: windowContent
|
||||
|
||||
itemId: "someId"
|
||||
title: "Title"
|
||||
subTitle: "Subtitle"
|
||||
}
|
||||
|
||||
function initTestCase() {
|
||||
window.show()
|
||||
}
|
||||
|
||||
function cleanupTestCase() {
|
||||
window.close()
|
||||
}
|
||||
|
||||
function test_clickFunctions() {
|
||||
// Verify than signal exists
|
||||
verify(clickedSpy.valid, "Signal " + clickedSpy.signalName + "is not valid")
|
||||
verify(titleClickedSpy.valid, "Signal " + titleClickedSpy.signalName + "is not valid")
|
||||
|
||||
compare(clickedSpy.count, 0)
|
||||
mouseClick(listItem, 1, 1, Qt.LeftButton)
|
||||
compare(clickedSpy.count, 1, "Signal clicked is not called")
|
||||
|
||||
compare(titleClickedSpy.count, 0)
|
||||
mouseClick(listItem, listItem.leftPadding + 1, listItem.implicitHeight / 2, Qt.LeftButton)
|
||||
compare(titleClickedSpy.count, 1, "Signal titleClicked is not called");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue