Commit e52b6f60 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(tests): init each GUI test correctly

parent 55153d72
......@@ -36,6 +36,13 @@
QCOMPARE(virtualWindowContent->objectName(), QStringLiteral(NAME)); \
} while (0)
#define INIT_GUI_TEST() \
QQuickWindow * mainWindow = App::getInstance()->getMainWindow(); \
App::smartShowWindow(mainWindow); \
QQuickItem *contentLoader = mainWindow->findChild<QQuickItem *>("__contentLoader"); \
QVERIFY(contentLoader); \
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(110, 100));
namespace TestUtils {
void executeKeySequence (QQuickWindow *window, QKeySequence sequence);
......
......@@ -21,27 +21,28 @@
*/
#include <QQmlProperty>
#include <QQuickItem>
#include <QSignalSpy>
#include <QTest>
#include "../../app/App.hpp"
#include "../TestUtils.hpp"
#include "AssistantViewTest.hpp"
// =============================================================================
void AssistantViewTest::init () {
INIT_GUI_TEST();
}
void AssistantViewTest::showAssistantView () {
QQuickWindow *mainWindow = App::getInstance()->getMainWindow();
// Ensure home view is selected.
QQuickItem *contentLoader = mainWindow->findChild<QQuickItem *>("__contentLoader");
QVERIFY(contentLoader);
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(110, 100));
// Show assistant view.
QSignalSpy spyLoaderReady(contentLoader, SIGNAL(loaded()));
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(705, 485));
QVERIFY(spyLoaderReady.count() == 1);
QCOMPARE(
QQmlProperty::read(contentLoader, "source").toString(),
......
......@@ -35,6 +35,8 @@ public:
~AssistantViewTest () = default;
private slots:
void init ();
void showAssistantView ();
};
......
......@@ -31,6 +31,12 @@
// =============================================================================
void MainViewTest::init () {
INIT_GUI_TEST();
}
// -----------------------------------------------------------------------------
void MainViewTest::showAboutPopup () {
QQuickWindow *mainWindow = App::getInstance()->getMainWindow();
......
......@@ -35,6 +35,8 @@ public:
~MainViewTest () = default;
private slots:
void init ();
void showAboutPopup ();
void showManageAccountsPopup ();
void showSettingsWindow ();
......
......@@ -37,7 +37,7 @@ function _getDisplayName (str) {
return name
}
return _getDisplayNameFromString (str)
return _getDisplayNameFromString(str)
}
// -----------------------------------------------------------------------------
......
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