mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2026-01-03 18:43:17 +08:00
tests: fix some possible crashes
Prevents some uncaught exceptions that could occur depending on test implementation. Gitlab: #899 Change-Id: I5b06c270c924071f331e20f3b894a4bb80228137
This commit is contained in:
committed by
Sébastien Blin
parent
8dc0be11d6
commit
b8b5e2f502
@@ -49,7 +49,12 @@ public:
|
||||
: muteDring_(muteDring)
|
||||
{}
|
||||
|
||||
void init()
|
||||
public Q_SLOTS:
|
||||
|
||||
/*
|
||||
* Called once before qmlEngineAvailable.
|
||||
*/
|
||||
void applicationAvailable()
|
||||
{
|
||||
connectivityMonitor_.reset(new ConnectivityMonitor(this));
|
||||
settingsManager_.reset(new AppSettingsManager(this));
|
||||
@@ -66,28 +71,6 @@ public:
|
||||
lrcInstance_->accountModel().downloadDirectory = downloadPath.toString() + "/";
|
||||
}
|
||||
|
||||
void registerQmlTypes(QQmlEngine* engine)
|
||||
{
|
||||
// Expose custom types to the QML engine.
|
||||
Utils::registerTypes(engine,
|
||||
systemTray_.get(),
|
||||
lrcInstance_.get(),
|
||||
settingsManager_.get(),
|
||||
previewEngine_.get(),
|
||||
&screenInfo_,
|
||||
this);
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
/*
|
||||
* Called once before qmlEngineAvailable.
|
||||
*/
|
||||
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.
|
||||
@@ -100,7 +83,17 @@ public Q_SLOTS:
|
||||
*/
|
||||
void qmlEngineAvailable(QQmlEngine* engine)
|
||||
{
|
||||
registerQmlTypes(engine);
|
||||
lrcInstance_->set_currentAccountId();
|
||||
|
||||
// Expose custom types to the QML engine.
|
||||
Utils::registerTypes(engine,
|
||||
systemTray_.get(),
|
||||
lrcInstance_.get(),
|
||||
settingsManager_.get(),
|
||||
previewEngine_.get(),
|
||||
&screenInfo_,
|
||||
this);
|
||||
|
||||
auto videoProvider = new VideoProvider(lrcInstance_->avModel(), this);
|
||||
engine->rootContext()->setContextProperty("videoProvider", videoProvider);
|
||||
#ifdef WITH_WEBENGINE
|
||||
@@ -133,9 +126,14 @@ main(int argc, char** argv)
|
||||
{
|
||||
QDir tempDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
|
||||
|
||||
auto jamiDataDir = tempDir.absolutePath() + "\\jami_test\\jami";
|
||||
auto jamiConfigDir = tempDir.absolutePath() + "\\jami_test\\.config";
|
||||
auto jamiCacheDir = tempDir.absolutePath() + "\\jami_test\\.cache";
|
||||
auto jamiDataDir = tempDir.absolutePath() + "/jami_test/jami";
|
||||
auto jamiConfigDir = tempDir.absolutePath() + "/jami_test/.config";
|
||||
auto jamiCacheDir = tempDir.absolutePath() + "/jami_test/.cache";
|
||||
|
||||
// Clean up the temp directories.
|
||||
QDir(jamiDataDir).removeRecursively();
|
||||
QDir(jamiConfigDir).removeRecursively();
|
||||
QDir(jamiCacheDir).removeRecursively();
|
||||
|
||||
bool envSet = qputenv("JAMI_DATA_HOME", jamiDataDir.toLocal8Bit());
|
||||
envSet &= qputenv("JAMI_CONFIG_HOME", jamiConfigDir.toLocal8Bit());
|
||||
|
||||
Reference in New Issue
Block a user