Commit dd794f92 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(tests/main-view): add a `showSettingsWindow` method

parent 38a4df60
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#define CHECK_VIRTUAL_WINDOW_CONTENT_INFO(WINDOW, TYPE, NAME) \ #define CHECK_VIRTUAL_WINDOW_CONTENT_INFO(WINDOW, TYPE, NAME) \
do { \ do { \
QQuickItem *virtualWindowContent = TestUtils::getVirtualWindowContent(WINDOW); \ QQuickItem *virtualWindowContent; \
QVERIFY(virtualWindowContent); \ QTRY_VERIFY_WITH_TIMEOUT(virtualWindowContent = TestUtils::getVirtualWindowContent(WINDOW), 1000); \
QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), TYPE, sizeof TYPE - 1)); \ QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), TYPE, sizeof TYPE - 1)); \
QCOMPARE(virtualWindowContent->objectName(), QStringLiteral(NAME)); \ QCOMPARE(virtualWindowContent->objectName(), QStringLiteral(NAME)); \
} while (0) } while (0)
......
...@@ -34,15 +34,12 @@ void MainViewTest::showAboutPopup () { ...@@ -34,15 +34,12 @@ void MainViewTest::showAboutPopup () {
// Open popup. // Open popup.
TestUtils::executeKeySequence(mainWindow, QKeySequence::HelpContents); TestUtils::executeKeySequence(mainWindow, QKeySequence::HelpContents);
QTest::qWait(1000);
CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__about"); CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__about");
// Close popup. // Close popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392)); QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392));
QTest::qWait(1000); QTRY_VERIFY_WITH_TIMEOUT(!TestUtils::getVirtualWindowContent(mainWindow), 1000);
QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow));
} }
void MainViewTest::showManageAccountsPopup () { void MainViewTest::showManageAccountsPopup () {
...@@ -50,13 +47,24 @@ void MainViewTest::showManageAccountsPopup () { ...@@ -50,13 +47,24 @@ void MainViewTest::showManageAccountsPopup () {
// Open popup. // Open popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(100, 35)); QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(100, 35));
QTest::qWait(1000);
CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__manageAccounts"); CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__manageAccounts");
// Close popup. // Close popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392)); QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392));
QTest::qWait(1000); QTRY_VERIFY_WITH_TIMEOUT(!TestUtils::getVirtualWindowContent(mainWindow), 1000);
}
void MainViewTest::showSettingsWindow () {
App *app = App::getInstance();
// Open window.
QTest::keyClick(app->getMainWindow(), Qt::Key_P, Qt::ControlModifier);
QQuickWindow *settingsWindow = app->getSettingsWindow();
QVERIFY(QTest::qWaitForWindowExposed(settingsWindow));
QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow)); // Hide window.
TestUtils::executeKeySequence(settingsWindow, QKeySequence::Close);
QVERIFY(!settingsWindow->isVisible());
} }
...@@ -34,4 +34,5 @@ public: ...@@ -34,4 +34,5 @@ public:
private slots: private slots:
void showAboutPopup (); void showAboutPopup ();
void showManageAccountsPopup (); void showManageAccountsPopup ();
void showSettingsWindow ();
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment