mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-07-31 12:55:42 +02:00
tests/qml: fix various issues with the MessageOptions test
This commit fixes three issues related to tst_MessageOptions.qml: 1) There was no test to check that the call to createSIPAccount() at the beginning of test_createMessageOptionsPopup() actually succeeded 2) The created account was not deleted at the end of the test 3) The test would occasionally crash due to an uncaught std::out_of_range exception thrown by the AccountModelPimpl::slotAccountDetailsChanged function. I've modified the function to issue a warning instead, which makes it consistent with AccountModelPimpl::slotVolatileAccountDetailsChanged and avoids throwing an exception from a Qt slot (which is considered undefined behavior according to the Qt documentation) Change-Id: I4d939b29f27ee27de673aea7046997ef756fbcee
This commit is contained in:
parent
79b906f12f
commit
95e36ef89b
2 changed files with 9 additions and 5 deletions
|
@ -564,8 +564,8 @@ AccountModelPimpl::slotAccountDetailsChanged(const QString& accountId,
|
||||||
{
|
{
|
||||||
auto account = accounts.find(accountId);
|
auto account = accounts.find(accountId);
|
||||||
if (account == accounts.end()) {
|
if (account == accounts.end()) {
|
||||||
throw std::out_of_range("AccountModelPimpl::slotAccountDetailsChanged, can't find "
|
qWarning() << Q_FUNC_INFO << ": can't find " << accountId;
|
||||||
+ accountId.toStdString());
|
return;
|
||||||
}
|
}
|
||||||
auto& accountInfo = account->second.first;
|
auto& accountInfo = account->second.first;
|
||||||
accountInfo.fromDetails(details);
|
accountInfo.fromDetails(details);
|
||||||
|
@ -585,8 +585,7 @@ AccountModelPimpl::slotVolatileAccountDetailsChanged(const QString& accountId,
|
||||||
{
|
{
|
||||||
auto account = accounts.find(accountId);
|
auto account = accounts.find(accountId);
|
||||||
if (account == accounts.end()) {
|
if (account == accounts.end()) {
|
||||||
qWarning() << "AccountModelPimpl::slotVolatileAccountDetailsChanged, can't find "
|
qWarning() << Q_FUNC_INFO << ": can't find " << accountId;
|
||||||
<< accountId;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto& accountInfo = account->second.first;
|
auto& accountInfo = account->second.first;
|
||||||
|
|
|
@ -82,7 +82,8 @@ Item {
|
||||||
"username": "currentAccountUsername"
|
"username": "currentAccountUsername"
|
||||||
});
|
});
|
||||||
// Block on account creation
|
// Block on account creation
|
||||||
accountAdded.wait(1000);
|
accountAdded.wait(2000);
|
||||||
|
compare(accountAdded.count, 1)
|
||||||
|
|
||||||
// Add some emoji reactions (one from current account uri, one from another uri)
|
// Add some emoji reactions (one from current account uri, one from another uri)
|
||||||
emojiReactions.reactions = {
|
emojiReactions.reactions = {
|
||||||
|
@ -101,5 +102,9 @@ Item {
|
||||||
verify(JSON.stringify(optionsPopup.emojiReplied) === JSON.stringify(["🌭"]),
|
verify(JSON.stringify(optionsPopup.emojiReplied) === JSON.stringify(["🌭"]),
|
||||||
"Message options popup should have emoji replied");
|
"Message options popup should have emoji replied");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanupTestCase() {
|
||||||
|
AccountAdapter.deleteCurrentAccount()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue