From 428f57948cc5f5416f8c4e5dade9d9ec8d4ee824 Mon Sep 17 00:00:00 2001 From: "B.Melnik" Date: Tue, 19 Oct 2021 22:42:30 +0300 Subject: [PATCH] Add test for status expandable item --- tests.qrc | 1 + tst_statusexpandableitem.qml | 45 ++++++++++++++++++++++++++++++++++++ ui-tests.pro | 16 ++----------- 3 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 tst_statusexpandableitem.qml diff --git a/tests.qrc b/tests.qrc index c962378..25c0922 100644 --- a/tests.qrc +++ b/tests.qrc @@ -13,5 +13,6 @@ base/WindowTestCase.qml tst_chatinfotoolbar.qml tst_statuslistitem.qml + tst_statusexpandableitem.qml diff --git a/tst_statusexpandableitem.qml b/tst_statusexpandableitem.qml new file mode 100644 index 0000000..bcd88be --- /dev/null +++ b/tst_statusexpandableitem.qml @@ -0,0 +1,45 @@ +import QtQuick 2.14 +import QtTest 1.14 + +import "base" + +import StatusQ.Components 0.1 + +WindowTestCase { + name: "StatusExpandableItem test" + when: windowShown + + StatusExpandableItem { + id: expandableItem + parent: windowContent + + primaryText: "primary text" + secondaryText: "secondary text" + additionalText: "additional text" + + expandable: true + + expandableComponent: Rectangle { + width: 1000 + height: 300 + } + } + + function initTestCase() { + window.show() + } + + function cleanupTestCase() { + window.close() + } + + function test_expand() { + verify(!expandableItem.expanded) + + mouseClick(expandableItem, expandableItem.width / 2, expandableItem.height / 2, Qt.LeftButton) + + verify(expandableItem.expanded) + wait(400) // transition duration + compare(expandableItem.height, 82 + 300 + 22) + } +} diff --git a/ui-tests.pro b/ui-tests.pro index cede8e6..bfa2655 100644 --- a/ui-tests.pro +++ b/ui-tests.pro @@ -6,21 +6,9 @@ DESTDIR += $${PWD}/bin DEFINES += PROJECT_PATH=\"$${PWD}\" -DISTFILES += \ - base/ChatsModelData.qml \ - base/Helpers.qml \ - base/LegacyModalsHelpers.qml \ - base/ModalHelpers.qml \ - base/ProfileModelData.qml \ - base/WindowTestCase.qml \ - tst_choose_chat_name_modal.qml \ - tst_get_started_modal.qml \ - tst_initialtest.qml \ - tst_profile_popup.qml \ - tst_statusButton.qml \ - tst_statusChatInfoButton.qml +#DISTFILES += $$ -DISTFILES += $$files("status-desktop/ui/*", true) +DISTFILES += $$files("$$PWD/*", true) QML_IMPORT_PATH += status-desktop/ui/StatusQ/src