mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-03-28 14:56:19 +01:00
tests: qml: initialize the preview engine
This was causing invalid connections during test setup. Not having a null preview engine will prevent dereferencing a null pointer once messaging tests are implemented, however, the webengine will not work correctly due to missing resources which may be corrected in a subsequent patch. This commit also moves .clang-format to the root repo dir so it will apply to the test source code (the test source code should be within the src dir). Gitlab: #899 Change-Id: I8cac1fb937a0c60a91219b11ed1e0b5f323b1816
This commit is contained in:
parent
df5b955465
commit
5566c1a968
2 changed files with 12 additions and 8 deletions
|
@ -1,7 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2023 Savoir-faire Linux Inc.
|
||||
* Author: Albert Babí Oller <albert.babi@savoirfairelinux.com>
|
||||
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,10 +30,12 @@
|
|||
#include <QQmlEngine>
|
||||
#include <QScopedPointer>
|
||||
#include <QtQuickTest/quicktest.h>
|
||||
|
||||
#ifdef WITH_WEBENGINE
|
||||
#include <QtWebEngineCore>
|
||||
#include <QtWebEngineQuick>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -54,6 +54,7 @@ public:
|
|||
connectivityMonitor_.reset(new ConnectivityMonitor(this));
|
||||
settingsManager_.reset(new AppSettingsManager(this));
|
||||
systemTray_.reset(new SystemTray(settingsManager_.get(), this));
|
||||
previewEngine_.reset(new PreviewEngine(this));
|
||||
|
||||
QFontDatabase::addApplicationFont(":/images/FontAwesome.otf");
|
||||
|
||||
|
@ -65,7 +66,7 @@ public:
|
|||
lrcInstance_->accountModel().downloadDirectory = downloadPath.toString() + "/";
|
||||
}
|
||||
|
||||
void qmlEngineRegistration(QQmlEngine* engine)
|
||||
void registerQmlTypes(QQmlEngine* engine)
|
||||
{
|
||||
// Expose custom types to the QML engine.
|
||||
Utils::registerTypes(engine,
|
||||
|
@ -79,12 +80,15 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Called once before qmlEngineAvailable.
|
||||
*/
|
||||
void applicationAvailable() { init(); }
|
||||
void applicationAvailable()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Called when the QML engine is available. Any import paths, plugin paths,
|
||||
* and extra file selectors will have been set on the engine by this point.
|
||||
* This function is called once for each QML test file, so any arguments are
|
||||
|
@ -96,6 +100,7 @@ public Q_SLOTS:
|
|||
*/
|
||||
void qmlEngineAvailable(QQmlEngine* engine)
|
||||
{
|
||||
registerQmlTypes(engine);
|
||||
auto videoProvider = new VideoProvider(lrcInstance_->avModel(), this);
|
||||
engine->rootContext()->setContextProperty("videoProvider", videoProvider);
|
||||
#ifdef WITH_WEBENGINE
|
||||
|
@ -103,10 +108,9 @@ public Q_SLOTS:
|
|||
#else
|
||||
engine->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(false));
|
||||
#endif
|
||||
qmlEngineRegistration(engine);
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Called once right after the all test execution has finished. Use this
|
||||
* function to clean up before everything is destroyed.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue