Compare commits

..

3 Commits

Author SHA1 Message Date
61163037d4 misc: bump daemon submodule
This bump will include changes to fix failing builds on Windows.
https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/1022

Change-Id: Ic34a097fbcea5723c8fe44da9c5887368dce2258
2024-07-04 16:03:20 -04:00
3577982a93 testing: added account switcher box
Change-Id: I76b67b819cd8e028062406b96583a36ae6a6d509
2024-07-04 15:53:04 -04:00
3ad0b92dcd link-preview: use non-ASCII UTF-8 characters in a UTF-8 test
Non-ASCII characters in UTF-8 are encoded with multiple bytes. Testing with these characters ensures that the decoder correctly interprets multi-byte sequences.

Gitlab: #1536
Change-Id: I0a92ee91b6cd26d70daab1f9baef3a9577aee02e
2024-07-04 13:01:02 -04:00
3 changed files with 24 additions and 13 deletions

2
daemon

Submodule daemon updated: c9f251d797...2e49d649d7

View File

@ -145,6 +145,16 @@ ApplicationWindow {
LRCInstance.selectConversation(convUid);
}
}
ListElement {
label: "Account ID"
type: "combobox"
getDataModel: () => AccountListModel
displayRole: AccountList.Username
onIndexChanged: function(model, index) {
const accountId = JamiQmlUtils.getModelData(model, index, AccountList.ID);
LRCInstance.currentAccountId = accountId;
}
}
ListElement {
label: "Force local preview"
type: "checkbox"

View File

@ -24,15 +24,17 @@ class PreviewEngineFixture : public ::testing::Test
public:
// Prepare unit test context. Called at
// prior each unit test execution
void SetUp() override {
void SetUp() override
{
server = new QHttpServer();
// Setup a server that can return an HTML body.
server->listen(QHostAddress::LocalHost, 8000);
}
// Close unit test context. Called
// after each unit test ending
void TearDown() override {
// Close unit test context. Called
// after each unit test ending
void TearDown() override
{
delete server;
}
@ -47,9 +49,8 @@ public:
TEST_F(PreviewEngineFixture, ParsingALinkEmitsInfoReadySignal)
{
auto link = QString("http://localhost:8000/test");
server->route("/test", [] () {
return QString("<meta property=\"og:title\" content=\"Test title\">");
});
server->route("/test",
[]() { return QString("<meta property=\"og:title\" content=\"Test title\">"); });
QSignalSpy infoReadySpy(globalEnv.previewEngine.data(), &PreviewEngine::infoReady);
@ -70,14 +71,14 @@ TEST_F(PreviewEngineFixture, ParsingALinkEmitsInfoReadySignal)
*/
TEST_F(PreviewEngineFixture, UTF8CharactersAreParsedCorrectly)
{
auto link = QString("http://localhost:8000/test");
server->route("/test", [] () {
return QString("<meta property=\"og:description\" content=\"Test de caractères Utf-8");
const auto testString = QString("liberté 自由 自由 свобода Szabadság ŐőŰű 자유 😊 € è ñ");
server->route("/test", [&]() {
return QString("<meta property=\"og:description\" content=\"%1\">").arg(testString);
});
QSignalSpy infoReadySpy(globalEnv.previewEngine.data(), &PreviewEngine::infoReady);
Q_EMIT globalEnv.previewEngine->parseLink("msgId_01", link);
Q_EMIT globalEnv.previewEngine->parseLink("msgId_01", "http://localhost:8000/test");
// Wait for the infoReady signal which should be emitted once.
infoReadySpy.wait();
@ -89,5 +90,5 @@ TEST_F(PreviewEngineFixture, UTF8CharactersAreParsedCorrectly)
// Check that the description is parsed correctly.
QVariantMap info = infoReadyArguments.at(1).toMap();
EXPECT_TRUE(info.contains("description"));
EXPECT_EQ(info["description"].toString(), "Test de caractères Utf-8");
EXPECT_EQ(info["description"].toString(), testString);
}