mirror of
https://github.com/status-im/desktop-ui-tests.git
synced 2025-01-25 20:18:52 +00:00
Merge pull request #33 from status-im/feat/test_switch
Add tests for statusSwitch
This commit is contained in:
commit
524c91a705
@ -13,5 +13,6 @@
|
||||
<file>tst_chatinfotoolbar.qml</file>
|
||||
<file>tst_statuslistitem.qml</file>
|
||||
<file>tst_statusexpandableitem.qml</file>
|
||||
<file>tst_status_switch.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
34
tst_status_switch.qml
Normal file
34
tst_status_switch.qml
Normal file
@ -0,0 +1,34 @@
|
||||
import QtQuick 2.14
|
||||
import QtTest 1.14
|
||||
|
||||
import StatusQ.Controls 0.1
|
||||
|
||||
import "base"
|
||||
|
||||
WindowTestCase {
|
||||
name: "StatusSwitch test"
|
||||
|
||||
SignalSpy {
|
||||
id: clickSpy
|
||||
target: statusSwitch
|
||||
signalName: "clicked"
|
||||
}
|
||||
|
||||
StatusSwitch {
|
||||
id: statusSwitch
|
||||
parent: windowContent
|
||||
text: "unit test"
|
||||
}
|
||||
|
||||
function test_clickOnSwitch() {
|
||||
verify(clickSpy.valid, "Signal clicked not valid")
|
||||
verify(!statusSwitch.checked, "Switch is checked on init")
|
||||
compare(statusSwitch.text, "unit test", "Text property is not working")
|
||||
|
||||
compare(clickSpy.count, 0, "Signal spy is not cleared")
|
||||
mouseClick(statusSwitch, 1, 1, Qt.LeftButton)
|
||||
compare(clickSpy.count, 1, "Signal is not emited")
|
||||
|
||||
verify(statusSwitch.checked, "Switch is not checked")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user