mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-03-28 14:56:19 +01: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:
parent
8dc0be11d6
commit
b8b5e2f502
3 changed files with 35 additions and 30 deletions
|
@ -51,8 +51,7 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
|
|||
QML_REGISTERSINGLETONTYPE_POBJECT(NS_MODELS, overlayModel_.get(), "CallOverlayModel");
|
||||
|
||||
accountId_ = lrcInstance_->get_currentAccountId();
|
||||
if (!accountId_.isEmpty())
|
||||
connectCallModel(accountId_);
|
||||
connectCallModel(accountId_);
|
||||
|
||||
connect(&lrcInstance_->behaviorController(),
|
||||
&BehaviorController::showIncomingCallView,
|
||||
|
@ -471,6 +470,9 @@ CallAdapter::showNotification(const QString& accountId, const QString& convUid)
|
|||
void
|
||||
CallAdapter::connectCallModel(const QString& accountId)
|
||||
{
|
||||
if (accountId.isEmpty())
|
||||
return;
|
||||
|
||||
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
|
||||
connect(accInfo.callModel.get(),
|
||||
&CallModel::callStarted,
|
||||
|
|
|
@ -44,7 +44,12 @@ LRCInstance::LRCInstance(migrateCallback willMigrateCb,
|
|||
accountModel().setTopAccount(currentAccountId_);
|
||||
Q_EMIT accountListChanged();
|
||||
|
||||
auto profileInfo = getCurrentAccountInfo().profileInfo;
|
||||
profile::Info profileInfo;
|
||||
try {
|
||||
profileInfo = getCurrentAccountInfo().profileInfo;
|
||||
} catch (...) {
|
||||
return;
|
||||
}
|
||||
|
||||
// update type
|
||||
set_currentAccountType(profileInfo.type);
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue