aboutsummaryrefslogtreecommitdiff
path: root/tests/quotest.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-08-22 21:39:31 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-08-22 21:45:43 +0200
commit90e940c9b398aa26d50095b2ca6905d0815f6412 (patch)
treebc8b41e767635c841083ad704464419aedfb8682 /tests/quotest.cpp
parentc75ef102c4b24c89f28a4773d7758adcbf4b6846 (diff)
downloadlibquotient-90e940c9b398aa26d50095b2ca6905d0815f6412.tar.gz
libquotient-90e940c9b398aa26d50095b2ca6905d0815f6412.zip
quotest: fix changeName test failures
Member renames upon profile changes don't come right away, it turns out; so check User::nameChanged instead of Room::memberRenamed.
Diffstat (limited to 'tests/quotest.cpp')
-rw-r--r--tests/quotest.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/quotest.cpp b/tests/quotest.cpp
index 0ad5ff6b..f14edcc0 100644
--- a/tests/quotest.cpp
+++ b/tests/quotest.cpp
@@ -493,22 +493,14 @@ TEST_IMPL(changeName)
{
auto* const localUser = connection()->user();
const auto& newName = connection()->generateTxnId(); // See setTopic()
+ clog << "Renaming the user to " << newName.toStdString() << endl;
localUser->rename(newName);
- connectUntil(targetRoom, &Room::memberRenamed, this,
- [this, thisTest, newName, localUser](const User* arrivedUser) {
- if (localUser != arrivedUser)
+ connectUntil(localUser, &User::nameChanged, this,
+ [this, thisTest, newName](const QString& emittedName, QString,
+ const Room* r) {
+ if (r != nullptr)
return false;
-
- const auto& arrivedNewName = arrivedUser->name(targetRoom);
- // Old names may diverge e.g. because the original name
- // hasn't been known to Quotient
- if (newName == arrivedNewName)
- FINISH_TEST(true);
-
- clog << "Names mismatch: found " << newName.toStdString()
- << " instead of " << arrivedNewName.toStdString()
- << "; waiting for the next event" << endl;
- return false;
+ FINISH_TEST(emittedName == newName);
});
return false;
}