Commit 31f2ec67 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(tests/MainViewTest): close popup in `showManageAccountsPopup`

parent c7509acd
......@@ -50,10 +50,7 @@ void TestUtils::printItemTree (const QQuickItem *item) {
// -----------------------------------------------------------------------------
QQuickItem *TestUtils::getMainLoaderFromMainWindow () {
QQuickWindow *window = App::getInstance()->getMainWindow();
Q_CHECK_PTR(window);
QList<QQuickItem *> items = window->contentItem()->childItems();
QList<QQuickItem *> items = App::getInstance()->getMainWindow()->contentItem()->childItems();
Q_ASSERT(!items.empty());
for (int i = 0; i < 3; ++i) {
......@@ -96,8 +93,5 @@ QQuickItem *TestUtils::getVirtualWindowContainer (const QQuickItem *virtualWindo
QList<QQuickItem *> items = virtualWindow->childItems();
Q_ASSERT(items.size() == 2);
QQuickItem *container = items.at(1);
Q_ASSERT(!container->childItems().empty());
return container;
return items.at(1);
}
......@@ -32,14 +32,21 @@
void MainViewTest::showManageAccountsPopup () {
QQuickWindow *mainWindow = App::getInstance()->getMainWindow();
// Open popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(100, 35));
QTest::qWait(1000);
const char name[] = "DialogPlus_QMLTYPE_";
QQuickItem *virtualWindowContent = TestUtils::getVirtualWindowContainer(
TestUtils::getVirtualWindow(mainWindow)
)->childItems().at(0);
QQuickItem *virtualWindow = TestUtils::getVirtualWindow(mainWindow);
QQuickItem *virtualWindowContent = TestUtils::getVirtualWindowContainer(virtualWindow)->childItems().at(0);
QVERIFY(virtualWindowContent);
QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), name, sizeof name - 1));
QVERIFY(virtualWindowContent->objectName() == "manageAccounts");
// Close popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392));
QTest::qWait(1000);
QVERIFY(TestUtils::getVirtualWindowContainer(virtualWindow)->childItems().empty());
}
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