Commit 55b07cb1 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(tests/self-test): fix test for mac os

parent e35927d1
...@@ -63,6 +63,8 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) : ...@@ -63,6 +63,8 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) :
mInstance->mSettingsModel = new SettingsModel(mInstance); mInstance->mSettingsModel = new SettingsModel(mInstance);
mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance); mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance);
mInstance->mStarted = true;
emit mInstance->coreStarted(); emit mInstance->coreStarted();
}); });
......
...@@ -47,6 +47,10 @@ class CoreManager : public QObject { ...@@ -47,6 +47,10 @@ class CoreManager : public QObject {
public: public:
~CoreManager () = default; ~CoreManager () = default;
bool started () const {
return mStarted;
}
std::shared_ptr<linphone::Core> getCore () { std::shared_ptr<linphone::Core> getCore () {
Q_CHECK_PTR(mCore); Q_CHECK_PTR(mCore);
return mCore; return mCore;
...@@ -151,6 +155,8 @@ private: ...@@ -151,6 +155,8 @@ private:
std::shared_ptr<linphone::Core> mCore; std::shared_ptr<linphone::Core> mCore;
std::shared_ptr<CoreHandlers> mHandlers; std::shared_ptr<CoreHandlers> mHandlers;
bool mStarted = false;
CallsListModel *mCallsListModel = nullptr; CallsListModel *mCallsListModel = nullptr;
ContactsListModel *mContactsListModel = nullptr; ContactsListModel *mContactsListModel = nullptr;
SipAddressesModel *mSipAddressesModel = nullptr; SipAddressesModel *mSipAddressesModel = nullptr;
......
...@@ -42,7 +42,7 @@ void MainViewTest::showManageAccountsPopup () { ...@@ -42,7 +42,7 @@ void MainViewTest::showManageAccountsPopup () {
QVERIFY(virtualWindowContent); QVERIFY(virtualWindowContent);
QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), name, sizeof name - 1)); QVERIFY(!strncmp(virtualWindowContent->metaObject()->className(), name, sizeof name - 1));
QCOMPARE(virtualWindowContent->objectName(), QStringLiteral("manageAccounts")); QCOMPARE(virtualWindowContent->objectName(), QStringLiteral("__manageAccounts"));
// Close popup. // Close popup.
QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392)); QTest::mouseClick(mainWindow, Qt::LeftButton, Qt::KeyboardModifiers(), QPoint(476, 392));
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
* Author: Ronan Abhamon * Author: Ronan Abhamon
*/ */
#include <QQmlProperty>
#include <QSignalSpy> #include <QSignalSpy>
#include <QTest> #include <QTest>
...@@ -32,12 +33,16 @@ ...@@ -32,12 +33,16 @@
// ============================================================================= // =============================================================================
void SelfTest::checkAppStartup () { void SelfTest::checkAppStartup () {
QSignalSpy spyCoreStarted(CoreManager::getInstance()->getHandlers().get(), &CoreHandlers::coreStarted); CoreManager *coreManager = CoreManager::getInstance();
QSignalSpy spyLoaderReady(TestUtils::getMainLoaderFromMainWindow(), SIGNAL(loaded())); QQuickItem *mainLoader = TestUtils::getMainLoaderFromMainWindow();
QVERIFY(spyCoreStarted.wait(5000)); QSignalSpy spyCoreStarted(coreManager->getHandlers().get(), &CoreHandlers::coreStarted);
QSignalSpy spyLoaderReady(mainLoader, SIGNAL(loaded()));
if (spyLoaderReady.count() != 1) if (!coreManager->started())
QVERIFY(spyCoreStarted.wait(5000));
if (!QQmlProperty::read(mainLoader, "item").value<QObject *>())
QVERIFY(spyLoaderReady.wait(1000)); QVERIFY(spyLoaderReady.wait(1000));
QVERIFY(QTest::qWaitForWindowExposed(App::getInstance()->getMainWindow())); QVERIFY(QTest::qWaitForWindowExposed(App::getInstance()->getMainWindow()));
......
...@@ -48,7 +48,7 @@ Item { ...@@ -48,7 +48,7 @@ Item {
id: window id: window
// Used for internal purposes only. Like Notifications. // Used for internal purposes only. Like Notifications.
objectName: 'internalWindow' objectName: '__internalWindow'
flags: wrapper.flags flags: wrapper.flags
opacity: 0 opacity: 0
......
...@@ -39,6 +39,6 @@ TestCase { ...@@ -39,6 +39,6 @@ TestCase {
var window = notification.data[0] var window = notification.data[0]
compare(Utils.qmlTypeof(window, 'QQuickWindowQmlImpl'), true) compare(Utils.qmlTypeof(window, 'QQuickWindowQmlImpl'), true)
compare(window.objectName === 'internalWindow', true) compare(window.objectName === '__internalWindow', true)
} }
} }
...@@ -18,7 +18,7 @@ DialogPlus { ...@@ -18,7 +18,7 @@ DialogPlus {
] ]
centeredButtons: true centeredButtons: true
objectName: 'manageAccounts' objectName: '__manageAccounts'
height: ManageAccountsStyle.height height: ManageAccountsStyle.height
width: ManageAccountsStyle.width width: ManageAccountsStyle.width
......
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