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