diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/quotest.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/quotest.cpp b/tests/quotest.cpp index 2b1f0229..98c01cfc 100644 --- a/tests/quotest.cpp +++ b/tests/quotest.cpp @@ -91,6 +91,7 @@ public slots: void doTest(const QByteArray& testName); private slots: + TEST_DECL(findRoomByAlias) TEST_DECL(loadMembers) TEST_DECL(sendMessage) TEST_DECL(sendReaction) @@ -186,7 +187,7 @@ TestManager::TestManager(int& argc, char** argv) connect(c, &Connection::connected, this, &TestManager::setupAndRun); connect(c, &Connection::resolveError, this, - [this](const QString& error) { + [](const QString& error) { clog << "Failed to resolve the server: " << error.toStdString() << endl; QCoreApplication::exit(-2); @@ -268,7 +269,7 @@ void TestManager::onNewRoom(Room* r) << endl; connect(r, &Room::aboutToAddNewMessages, r, [r](RoomEventsRange timeline) { clog << timeline.size() << " new event(s) in room " - << r->canonicalAlias().toStdString() << endl; + << r->objectName().toStdString() << endl; }); } @@ -306,26 +307,25 @@ void TestManager::doTests() }); } +TEST_IMPL(findRoomByAlias) +{ + auto* roomByAlias = connection()->roomByAlias(targetRoom->canonicalAlias(), + JoinState::Join); + FINISH_TEST(roomByAlias == targetRoom); +} + TEST_IMPL(loadMembers) { - // Trying to load members from another (larger) room - const auto& testRoomAlias = QStringLiteral("#test:matrix.org"); - auto* r = connection()->roomByAlias(testRoomAlias, JoinState::Join); - if (!r) { - clog << testRoomAlias.toStdString() - << " is not found in the test user's rooms" << endl; - FAIL_TEST(); - } // It's not exactly correct because an arbitrary server might not support // lazy loading; but in the absence of capabilities framework we assume // it does. - if (r->memberNames().size() >= r->joinedCount()) { + if (targetRoom->users().size() >= targetRoom->joinedCount()) { clog << "Lazy loading doesn't seem to be enabled" << endl; FAIL_TEST(); } - r->setDisplayed(); - connect(r, &Room::allMembersLoaded, this, [this, thisTest, r] { - FINISH_TEST(r->memberNames().size() >= r->joinedCount()); + targetRoom->setDisplayed(); + connect(targetRoom, &Room::allMembersLoaded, this, [this, thisTest] { + FINISH_TEST(targetRoom->users().size() >= targetRoom->joinedCount()); }); return false; } @@ -828,7 +828,7 @@ void TestManager::conclude() // .then(this, &TestManager::finalize); // Qt-style or // .then([this] { finalize(); }); // STL-style auto* job = room->leaveRoom(); - connect(job, &BaseJob::finished, this, [this, job,plainReport] { + connect(job, &BaseJob::result, this, [this, job,plainReport] { Q_ASSERT(job->status().good()); finalize(); // Still flying, as the exit() connection in finalize() is queued |