aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/quotest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/quotest.cpp b/tests/quotest.cpp
index ae272622..ce714a84 100644
--- a/tests/quotest.cpp
+++ b/tests/quotest.cpp
@@ -96,6 +96,7 @@ private slots:
TEST_DECL(sendReaction)
TEST_DECL(sendFile)
TEST_DECL(setTopic)
+ TEST_DECL(changeName)
TEST_DECL(sendAndRedact)
TEST_DECL(addAndRemoveTag)
TEST_DECL(markDirectChat)
@@ -488,6 +489,31 @@ TEST_IMPL(setTopic)
return false;
}
+TEST_IMPL(changeName)
+{
+ auto* const localUser = connection()->user();
+ const auto& newName = connection()->generateTxnId(); // See setTopic()
+ localUser->rename(newName);
+ connectUntil(targetRoom, &Room::memberRenamed, this,
+ [this, thisTest, newName, localUser](const User* arrivedUser) {
+ if (localUser != arrivedUser)
+ return false;
+
+ localUser->rename({});
+ 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()
+ << endl;
+ FAIL_TEST();
+ });
+ return false;
+}
+
TEST_IMPL(sendAndRedact)
{
clog << "Sending a message to redact" << endl;