mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-30 16:06:24 +00:00
fix(tests): init each GUI test correctly
This commit is contained in:
parent
55153d720d
commit
e52b6f6060
6 changed files with 24 additions and 6 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue