From 4dfbb10cedf555d317d3044fa896d463b6ec810b Mon Sep 17 00:00:00 2001 From: "B.Melnik" Date: Mon, 25 Oct 2021 15:10:17 +0300 Subject: [PATCH] Add test for StatusPickerButton --- tests.qrc | 1 + tst_status_picker_button.qml | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tst_status_picker_button.qml diff --git a/tests.qrc b/tests.qrc index 794f615..b521f34 100644 --- a/tests.qrc +++ b/tests.qrc @@ -14,5 +14,6 @@ tst_statuslistitem.qml tst_statusexpandableitem.qml tst_status_switch.qml + tst_status_picker_button.qml diff --git a/tst_status_picker_button.qml b/tst_status_picker_button.qml new file mode 100644 index 0000000..2b6879a --- /dev/null +++ b/tst_status_picker_button.qml @@ -0,0 +1,29 @@ +import QtQuick 2.14 +import QtTest 1.14 + +import "base" + +import StatusQ.Controls 0.1 + +WindowTestCase { + name: "StatusPickerButton test" + + SignalSpy { + id: clickedSpy + target: pickerButton + signalName: "clicked" + } + + StatusPickerButton { + id: pickerButton + parent: windowContent + } + + function test_clickOnPickerButton() { + verify(clickedSpy.valid, "Signal not valid") + + compare(clickedSpy.count, 0, "Signal spy is not cleared") + mouseClick(pickerButton, 1, 1, Qt.LeftButton) + compare(clickedSpy.count, 1, "StatusPickerButton is not emit clicked") + } +}