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:41:09 +0200
commit47786ad98b7c70f6719599d89a706fa820bb8b8e (patch)
tree47e0c8971c353b4a0c0d8596a880f3e72c50284d /tests/quotest.cpp
parent744592ee490858c464bba216cf19161aaf30d786 (diff)
downloadlibquotient-47786ad98b7c70f6719599d89a706fa820bb8b8e.tar.gz
libquotient-47786ad98b7c70f6719599d89a706fa820bb8b8e.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 afe26f7a..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 change" << endl;
- return false;
+ FINISH_TEST(emittedName == newName);
});
return false;
}