mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
test: fix ut_typers
GitLab: #968 Change-Id: I9049d376984d480f686a369237b8dcab29144f45
This commit is contained in:
@ -2760,9 +2760,9 @@ JamiAccount::setIsComposing(const std::string& conversationUri, bool isWriting)
|
||||
if (auto cm = convModule(true)) {
|
||||
if (auto typer = cm->getTypers(conversationId)) {
|
||||
if (isWriting)
|
||||
typer->addTyper(getUsername());
|
||||
typer->addTyper(getUsername(), true);
|
||||
else
|
||||
typer->removeTyper(getUsername());
|
||||
typer->removeTyper(getUsername(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,6 @@ Typers::addTyper(const std::string &typer, bool sendMessage)
|
||||
convId_,
|
||||
typer,
|
||||
1);
|
||||
return;
|
||||
}
|
||||
if (sendMessage) {
|
||||
// In this case we should emit for remote to update the timer
|
||||
|
@ -64,7 +64,6 @@ struct UserData {
|
||||
bool registered {false};
|
||||
bool stopped {false};
|
||||
bool deviceAnnounced {false};
|
||||
bool composing {false};
|
||||
bool sending {false};
|
||||
bool sent {false};
|
||||
bool searchFinished {false};
|
||||
@ -120,7 +119,6 @@ private:
|
||||
void testMergeTwoDifferentHeads();
|
||||
void testSendMessageToMultipleParticipants();
|
||||
void testPingPongMessages();
|
||||
void testIsComposing();
|
||||
void testSetMessageDisplayedTwice();
|
||||
void testSetMessageDisplayedPreference();
|
||||
void testSetMessageDisplayedAfterClone();
|
||||
@ -174,7 +172,6 @@ private:
|
||||
CPPUNIT_TEST(testMergeTwoDifferentHeads);
|
||||
CPPUNIT_TEST(testSendMessageToMultipleParticipants);
|
||||
CPPUNIT_TEST(testPingPongMessages);
|
||||
CPPUNIT_TEST(testIsComposing);
|
||||
CPPUNIT_TEST(testSetMessageDisplayedTwice);
|
||||
CPPUNIT_TEST(testSetMessageDisplayedPreference);
|
||||
CPPUNIT_TEST(testSetMessageDisplayedAfterClone);
|
||||
@ -409,17 +406,6 @@ ConversationTest::connectSignals()
|
||||
carlaData.errorDetected = true;
|
||||
cv.notify_one();
|
||||
}));
|
||||
confHandlers.insert(
|
||||
libjami::exportable_callback<libjami::ConfigurationSignal::ComposingStatusChanged>(
|
||||
[&](const std::string& accountId,
|
||||
const std::string& /*conversationId*/,
|
||||
const std::string& /*peer*/,
|
||||
bool state) {
|
||||
if (accountId == bobId) {
|
||||
bobData.composing = state;
|
||||
}
|
||||
cv.notify_one();
|
||||
}));
|
||||
confHandlers.insert(
|
||||
libjami::exportable_callback<libjami::ConfigurationSignal::AccountMessageStatusChanged>(
|
||||
[&](const std::string& accountId,
|
||||
@ -958,36 +944,6 @@ ConversationTest::testPingPongMessages()
|
||||
}));
|
||||
}
|
||||
|
||||
void
|
||||
ConversationTest::testIsComposing()
|
||||
{
|
||||
std::cout << "\nRunning test: " << __func__ << std::endl;
|
||||
connectSignals();
|
||||
|
||||
auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId);
|
||||
auto bobAccount = Manager::instance().getAccount<JamiAccount>(bobId);
|
||||
auto bobUri = bobAccount->getUsername();
|
||||
auto convId = libjami::startConversation(aliceId);
|
||||
auto aliceMsgSize = aliceData.messages.size();
|
||||
libjami::addConversationMember(aliceId, convId, bobUri);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return aliceMsgSize + 1 == aliceData.messages.size(); }));
|
||||
// Assert that repository exists
|
||||
auto repoPath = fileutils::get_data_dir() / aliceId
|
||||
/ "conversations" / convId;
|
||||
CPPUNIT_ASSERT(std::filesystem::is_directory(repoPath));
|
||||
// Check created files
|
||||
auto bobInvited = repoPath / "invited" / bobUri;
|
||||
CPPUNIT_ASSERT(std::filesystem::is_regular_file(bobInvited));
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.requestReceived; }));
|
||||
libjami::acceptConversationRequest(bobId, convId);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return aliceMsgSize + 2 == aliceData.messages.size(); }));
|
||||
|
||||
aliceAccount->setIsComposing("swarm:" + convId, true);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.composing; }));
|
||||
aliceAccount->setIsComposing("swarm:" + convId, false);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return !bobData.composing; }));
|
||||
}
|
||||
|
||||
void
|
||||
ConversationTest::testSetMessageDisplayedTwice()
|
||||
{
|
||||
|
Reference in New Issue
Block a user