mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-20 01:18:29 +00:00
feat(tests/main-view): add a testMainMenuEntries method
This commit is contained in:
parent
62e9a39351
commit
29b9040894
3 changed files with 37 additions and 0 deletions
|
|
@ -20,6 +20,8 @@
|
|||
* Author: Ronan Abhamon
|
||||
*/
|
||||
|
||||
#include <QQmlProperty>
|
||||
#include <QSignalSpy>
|
||||
#include <QTest>
|
||||
|
||||
#include "../../app/App.hpp"
|
||||
|
|
@ -42,6 +44,8 @@ void MainViewTest::showAboutPopup () {
|
|||
QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void MainViewTest::showManageAccountsPopup () {
|
||||
QQuickWindow *mainWindow = App::getInstance()->getMainWindow();
|
||||
|
||||
|
|
@ -55,6 +59,8 @@ void MainViewTest::showManageAccountsPopup () {
|
|||
QVERIFY(!TestUtils::getVirtualWindowContent(mainWindow));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void MainViewTest::showSettingsWindow () {
|
||||
App *app = App::getInstance();
|
||||
|
||||
|
|
@ -68,3 +74,29 @@ void MainViewTest::showSettingsWindow () {
|
|||
TestUtils::executeKeySequence(settingsWindow, QKeySequence::Close);
|
||||
QVERIFY(!settingsWindow->isVisible());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void MainViewTest::testMainMenuEntries_data () {
|
||||
QTest::addColumn<int>("y");
|
||||
QTest::addColumn<QString>("source");
|
||||
|
||||
QTest::newRow("home view 1") << 100 << "qrc:/ui/views/App/Main/Home.qml";
|
||||
QTest::newRow("contacts view 1") << 150 << "qrc:/ui/views/App/Main/Contacts.qml";
|
||||
QTest::newRow("home view 2") << 100 << "qrc:/ui/views/App/Main/Home.qml";
|
||||
QTest::newRow("contacts view 2") << 150 << "qrc:/ui/views/App/Main/Contacts.qml";
|
||||
}
|
||||
|
||||
void MainViewTest::testMainMenuEntries () {
|
||||
QQuickItem *contentLoader = App::getInstance()->getMainWindow()->findChild<QQuickItem *>("__contentLoader");
|
||||
QVERIFY(contentLoader);
|
||||
|
||||
QSignalSpy spyLoaderReady(contentLoader, SIGNAL(loaded()));
|
||||
|
||||
QFETCH(int, y);
|
||||
QTest::mouseClick(App::getInstance()->getMainWindow(), Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(110, y));
|
||||
QVERIFY(spyLoaderReady.count() == 1);
|
||||
|
||||
QFETCH(QString, source);
|
||||
QCOMPARE(QQmlProperty::read(contentLoader, "source").toString(), source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,7 @@ private slots:
|
|||
void showAboutPopup ();
|
||||
void showManageAccountsPopup ();
|
||||
void showSettingsWindow ();
|
||||
|
||||
void testMainMenuEntries_data ();
|
||||
void testMainMenuEntries ();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -231,6 +231,8 @@ ApplicationWindow {
|
|||
Loader {
|
||||
id: contentLoader
|
||||
|
||||
objectName: '__contentLoader'
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue