Commit dd794f92 authored by Ronan Abhamon's avatar Ronan Abhamon

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

parent 38a4df60
......@@ -27,8 +27,8 @@
#define CHECK_VIRTUAL_WINDOW_CONTENT_INFO(WINDOW, TYPE, NAME) \
do { \
QQuickItem *virtualWindowContent = TestUtils::getVirtualWindowContent(WINDOW); \
QVERIFY(virtualWindowContent); \
QQuickItem *virtualWindowContent; \
QTRY_VERIFY_WITH_TIMEOUT(virtualWindowContent = TestUtils::getVirtualWindowContent(WINDOW), 1000); \
QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), TYPE, sizeof TYPE - 1)); \
QCOMPARE(virtualWindowContent->objectName(), QStringLiteral(NAME)); \
} while (0)
......
......@@ -34,15 +34,12 @@ void MainViewTest::showAboutPopup () {
// Open popup.
TestUtils::executeKeySequence(mainWindow, QKeySequence::HelpContents);
QTest::qWait(1000);
CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__about");
// Close popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392));
QTest::qWait(1000);
QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow));
QTRY_VERIFY_WITH_TIMEOUT(!TestUtils::getVirtualWindowContent(mainWindow), 1000);
}
void MainViewTest::showManageAccountsPopup () {
......@@ -50,13 +47,24 @@ void MainViewTest::showManageAccountsPopup () {
// Open popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(100, 35));
QTest::qWait(1000);
CHECK_VIRTUAL_WINDOW_CONTENT_INFO(mainWindow, "DialogPlus_QMLTYPE_", "__manageAccounts");
// Close popup.
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:
private slots:
void showAboutPopup ();
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