TestUtils
Create TestUtils with TestRoom and use this for all tests which require it
This commit is contained in:
@@ -12,26 +12,17 @@
|
|||||||
#include "chatbarcache.h"
|
#include "chatbarcache.h"
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
class TestRoom : public NeoChatRoom
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using NeoChatRoom::NeoChatRoom;
|
|
||||||
|
|
||||||
void update(SyncRoomData &&data, bool fromCache = false)
|
|
||||||
{
|
|
||||||
Room::updateData(std::move(data), fromCache);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChatBarCacheTest : public QObject
|
class ChatBarCacheTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection *connection = nullptr;
|
Connection *connection = nullptr;
|
||||||
TestRoom *room = nullptr;
|
TestUtils::TestRoom *room = nullptr;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
@@ -47,14 +38,7 @@ private Q_SLOTS:
|
|||||||
void ChatBarCacheTest::initTestCase()
|
void ChatBarCacheTest::initTestCase()
|
||||||
{
|
{
|
||||||
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
||||||
room = new TestRoom(connection, QStringLiteral("#myroom:kde.org"), JoinState::Join);
|
room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"), QLatin1String("test-min-sync.json"));
|
||||||
|
|
||||||
QFile testMinSyncFile;
|
|
||||||
testMinSyncFile.setFileName(QLatin1String(DATA_DIR) + u'/' + QLatin1String("test-min-sync.json"));
|
|
||||||
testMinSyncFile.open(QIODevice::ReadOnly);
|
|
||||||
const auto testMinSyncJson = QJsonDocument::fromJson(testMinSyncFile.readAll());
|
|
||||||
SyncRoomData roomData(QStringLiteral("@bob:kde.org"), JoinState::Join, testMinSyncJson.object());
|
|
||||||
room->update(std::move(roomData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatBarCacheTest::empty()
|
void ChatBarCacheTest::empty()
|
||||||
|
|||||||
@@ -18,26 +18,17 @@
|
|||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
class TestRoom : public NeoChatRoom
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using NeoChatRoom::NeoChatRoom;
|
|
||||||
|
|
||||||
void update(SyncRoomData &&data, bool fromCache = false)
|
|
||||||
{
|
|
||||||
Room::updateData(std::move(data), fromCache);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class EventHandlerTest : public QObject
|
class EventHandlerTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection *connection = nullptr;
|
Connection *connection = nullptr;
|
||||||
TestRoom *room = nullptr;
|
TestUtils::TestRoom *room = nullptr;
|
||||||
EventHandler eventHandler;
|
EventHandler eventHandler;
|
||||||
EventHandler emptyHandler;
|
EventHandler emptyHandler;
|
||||||
EventHandler noEventHandler;
|
EventHandler noEventHandler;
|
||||||
@@ -101,14 +92,7 @@ private Q_SLOTS:
|
|||||||
void EventHandlerTest::initTestCase()
|
void EventHandlerTest::initTestCase()
|
||||||
{
|
{
|
||||||
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
||||||
room = new TestRoom(connection, QStringLiteral("#myroom:kde.org"), JoinState::Join);
|
room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"), QLatin1String("test-eventhandler-sync.json"));
|
||||||
|
|
||||||
QFile testEventHandlerSyncFile;
|
|
||||||
testEventHandlerSyncFile.setFileName(QLatin1String(DATA_DIR) + u'/' + QLatin1String("test-eventhandler-sync.json"));
|
|
||||||
testEventHandlerSyncFile.open(QIODevice::ReadOnly);
|
|
||||||
const auto testEventHandlerSyncJson = QJsonDocument::fromJson(testEventHandlerSyncFile.readAll());
|
|
||||||
SyncRoomData roomData(QStringLiteral("@bob:kde.org"), JoinState::Join, testEventHandlerSyncJson.object());
|
|
||||||
room->update(std::move(roomData));
|
|
||||||
|
|
||||||
eventHandler.setRoom(room);
|
eventHandler.setRoom(room);
|
||||||
noEventHandler.setRoom(room);
|
noEventHandler.setRoom(room);
|
||||||
|
|||||||
@@ -13,19 +13,10 @@
|
|||||||
#include "models/messageeventmodel.h"
|
#include "models/messageeventmodel.h"
|
||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
class TestRoom : public NeoChatRoom
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using NeoChatRoom::NeoChatRoom;
|
|
||||||
|
|
||||||
void update(SyncRoomData &&data, bool fromCache = false)
|
|
||||||
{
|
|
||||||
Room::updateData(std::move(data), fromCache);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class MessageEventModelTest : public QObject
|
class MessageEventModelTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -34,9 +25,6 @@ private:
|
|||||||
Connection *connection = nullptr;
|
Connection *connection = nullptr;
|
||||||
MessageEventModel *model = nullptr;
|
MessageEventModel *model = nullptr;
|
||||||
|
|
||||||
TestRoom *setupTestRoom(const QString &roomName, const QString &syncFileName = {});
|
|
||||||
void syncNewEvents(TestRoom *room, const QString &syncFileName);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
void init();
|
void init();
|
||||||
@@ -66,8 +54,8 @@ void MessageEventModelTest::init()
|
|||||||
// Make sure that basic empty rooms can be switched without crashing.
|
// Make sure that basic empty rooms can be switched without crashing.
|
||||||
void MessageEventModelTest::switchEmptyRoom()
|
void MessageEventModelTest::switchEmptyRoom()
|
||||||
{
|
{
|
||||||
TestRoom *firstRoom = new TestRoom(connection, QStringLiteral("#firstRoom:kde.org"), JoinState::Join);
|
auto firstRoom = new TestUtils::TestRoom(connection, QStringLiteral("#firstRoom:kde.org"));
|
||||||
TestRoom *secondRoom = new TestRoom(connection, QStringLiteral("#secondRoom:kde.org"), JoinState::Join);
|
auto secondRoom = new TestUtils::TestRoom(connection, QStringLiteral("#secondRoom:kde.org"));
|
||||||
|
|
||||||
QSignalSpy spy(model, SIGNAL(roomChanged()));
|
QSignalSpy spy(model, SIGNAL(roomChanged()));
|
||||||
|
|
||||||
@@ -86,8 +74,8 @@ void MessageEventModelTest::switchEmptyRoom()
|
|||||||
// Make sure that rooms with some events can be switched without crashing
|
// Make sure that rooms with some events can be switched without crashing
|
||||||
void MessageEventModelTest::switchSyncedRoom()
|
void MessageEventModelTest::switchSyncedRoom()
|
||||||
{
|
{
|
||||||
auto firstRoom = setupTestRoom(QStringLiteral("#firstRoom:kde.org"), QLatin1String("test-messageventmodel-sync.json"));
|
auto firstRoom = new TestUtils::TestRoom(connection, QStringLiteral("#firstRoom:kde.org"), QLatin1String("test-messageventmodel-sync.json"));
|
||||||
auto secondRoom = setupTestRoom(QStringLiteral("#secondRoom:kde.org"), QLatin1String("test-messageventmodel-sync.json"));
|
auto secondRoom = new TestUtils::TestRoom(connection, QStringLiteral("#secondRoom:kde.org"), QLatin1String("test-messageventmodel-sync.json"));
|
||||||
|
|
||||||
QSignalSpy spy(model, SIGNAL(roomChanged()));
|
QSignalSpy spy(model, SIGNAL(roomChanged()));
|
||||||
|
|
||||||
@@ -105,7 +93,7 @@ void MessageEventModelTest::switchSyncedRoom()
|
|||||||
|
|
||||||
void MessageEventModelTest::simpleTimeline()
|
void MessageEventModelTest::simpleTimeline()
|
||||||
{
|
{
|
||||||
auto room = setupTestRoom(QStringLiteral("#myroom:kde.org"), QLatin1String("test-messageventmodel-sync.json"));
|
auto room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"), QLatin1String("test-messageventmodel-sync.json"));
|
||||||
|
|
||||||
model->setRoom(room);
|
model->setRoom(room);
|
||||||
QCOMPARE(model->rowCount(), 2);
|
QCOMPARE(model->rowCount(), 2);
|
||||||
@@ -127,13 +115,13 @@ void MessageEventModelTest::simpleTimeline()
|
|||||||
// Sync some events into the MessageEventModel's current room and don't crash.
|
// Sync some events into the MessageEventModel's current room and don't crash.
|
||||||
void MessageEventModelTest::syncNewEvents()
|
void MessageEventModelTest::syncNewEvents()
|
||||||
{
|
{
|
||||||
auto room = setupTestRoom(QStringLiteral("#myroom:kde.org"));
|
auto room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"));
|
||||||
QSignalSpy spy(room, SIGNAL(aboutToAddNewMessages(Quotient::RoomEventsRange)));
|
QSignalSpy spy(room, SIGNAL(aboutToAddNewMessages(Quotient::RoomEventsRange)));
|
||||||
|
|
||||||
model->setRoom(room);
|
model->setRoom(room);
|
||||||
QCOMPARE(model->rowCount(), 0);
|
QCOMPARE(model->rowCount(), 0);
|
||||||
|
|
||||||
syncNewEvents(room, QLatin1String("test-messageventmodel-sync.json"));
|
room->syncNewEvents(QLatin1String("test-messageventmodel-sync.json"));
|
||||||
|
|
||||||
QCOMPARE(model->rowCount(), 2);
|
QCOMPARE(model->rowCount(), 2);
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
@@ -146,7 +134,7 @@ void MessageEventModelTest::pendingEvent()
|
|||||||
QSignalSpy spyRemove(model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)));
|
QSignalSpy spyRemove(model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)));
|
||||||
QSignalSpy spyChanged(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex, const QList<int> &)));
|
QSignalSpy spyChanged(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex, const QList<int> &)));
|
||||||
|
|
||||||
auto room = setupTestRoom(QStringLiteral("#myroom:kde.org"));
|
auto room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"));
|
||||||
model->setRoom(room);
|
model->setRoom(room);
|
||||||
QCOMPARE(model->rowCount(), 0);
|
QCOMPARE(model->rowCount(), 0);
|
||||||
|
|
||||||
@@ -197,20 +185,20 @@ void MessageEventModelTest::pendingEvent()
|
|||||||
// Make sure that the signals are disconnecting correctly when a room is switched.
|
// Make sure that the signals are disconnecting correctly when a room is switched.
|
||||||
void MessageEventModelTest::disconnect()
|
void MessageEventModelTest::disconnect()
|
||||||
{
|
{
|
||||||
auto room = setupTestRoom(QStringLiteral("#myroom:kde.org"));
|
auto room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"));
|
||||||
model->setRoom(room);
|
model->setRoom(room);
|
||||||
|
|
||||||
QSignalSpy spy(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
|
QSignalSpy spy(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
|
||||||
|
|
||||||
model->setRoom(nullptr);
|
model->setRoom(nullptr);
|
||||||
syncNewEvents(room, QLatin1String("test-messageventmodel-sync.json"));
|
room->syncNewEvents(QLatin1String("test-messageventmodel-sync.json"));
|
||||||
|
|
||||||
QCOMPARE(spy.count(), 0);
|
QCOMPARE(spy.count(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageEventModelTest::idToRow()
|
void MessageEventModelTest::idToRow()
|
||||||
{
|
{
|
||||||
auto room = setupTestRoom(QStringLiteral("#myroom:kde.org"), QLatin1String("test-min-sync.json"));
|
auto room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"), QLatin1String("test-min-sync.json"));
|
||||||
model->setRoom(room);
|
model->setRoom(room);
|
||||||
|
|
||||||
QCOMPARE(model->eventIdToRow(QStringLiteral("$153456789:example.org")), 0);
|
QCOMPARE(model->eventIdToRow(QStringLiteral("$153456789:example.org")), 0);
|
||||||
@@ -223,24 +211,5 @@ void MessageEventModelTest::cleanup()
|
|||||||
QCOMPARE(model, nullptr);
|
QCOMPARE(model, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestRoom *MessageEventModelTest::setupTestRoom(const QString &roomName, const QString &syncFileName)
|
|
||||||
{
|
|
||||||
auto room = new TestRoom(connection, roomName, JoinState::Join);
|
|
||||||
syncNewEvents(room, syncFileName);
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageEventModelTest::syncNewEvents(TestRoom *room, const QString &syncFileName)
|
|
||||||
{
|
|
||||||
if (!syncFileName.isEmpty()) {
|
|
||||||
QFile testSyncFile;
|
|
||||||
testSyncFile.setFileName(QLatin1String(DATA_DIR) + u'/' + syncFileName);
|
|
||||||
testSyncFile.open(QIODevice::ReadOnly);
|
|
||||||
const auto testSyncJson = QJsonDocument::fromJson(testSyncFile.readAll());
|
|
||||||
SyncRoomData roomData(QStringLiteral("@bob:kde.org"), JoinState::Join, testSyncJson.object());
|
|
||||||
room->update(std::move(roomData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QTEST_MAIN(MessageEventModelTest)
|
QTEST_MAIN(MessageEventModelTest)
|
||||||
#include "messageeventmodeltest.moc"
|
#include "messageeventmodeltest.moc"
|
||||||
|
|||||||
@@ -5,31 +5,20 @@
|
|||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
#include "neochatroom.h"
|
|
||||||
|
|
||||||
#include <Quotient/connection.h>
|
#include <Quotient/connection.h>
|
||||||
#include <Quotient/quotient_common.h>
|
#include <Quotient/quotient_common.h>
|
||||||
#include <Quotient/syncdata.h>
|
#include <Quotient/syncdata.h>
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
class TestRoom : public NeoChatRoom
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using NeoChatRoom::NeoChatRoom;
|
|
||||||
|
|
||||||
void update(SyncRoomData &&data, bool fromCache = false)
|
|
||||||
{
|
|
||||||
Room::updateData(std::move(data), fromCache);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class NeoChatRoomTest : public QObject {
|
class NeoChatRoomTest : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection *connection = nullptr;
|
Connection *connection = nullptr;
|
||||||
TestRoom *room = nullptr;
|
TestUtils::TestRoom *room = nullptr;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
@@ -40,14 +29,7 @@ private Q_SLOTS:
|
|||||||
void NeoChatRoomTest::initTestCase()
|
void NeoChatRoomTest::initTestCase()
|
||||||
{
|
{
|
||||||
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
||||||
room = new TestRoom(connection, QStringLiteral("#myroom:kde.org"), JoinState::Join);
|
room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"), "test-min-sync.json"_ls);
|
||||||
|
|
||||||
QFile testMinSyncFile;
|
|
||||||
testMinSyncFile.setFileName(QLatin1String(DATA_DIR) + u'/' + QLatin1String("test-min-sync.json"));
|
|
||||||
testMinSyncFile.open(QIODevice::ReadOnly);
|
|
||||||
const auto testMinSyncJson = QJsonDocument::fromJson(testMinSyncFile.readAll());
|
|
||||||
SyncRoomData roomData(QStringLiteral("@bob:kde.org"), JoinState::Join, testMinSyncJson.object());
|
|
||||||
room->update(std::move(roomData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NeoChatRoomTest::subtitleTextTest()
|
void NeoChatRoomTest::subtitleTextTest()
|
||||||
|
|||||||
41
autotests/testutils.h
Normal file
41
autotests/testutils.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2023 James Graham <james.h.graham@protonmail.com>
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
|
|
||||||
|
#include <Quotient/syncdata.h>
|
||||||
|
|
||||||
|
#include "neochatroom.h"
|
||||||
|
|
||||||
|
namespace Quotient
|
||||||
|
{
|
||||||
|
class Connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace TestUtils
|
||||||
|
{
|
||||||
|
class TestRoom : public NeoChatRoom
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TestRoom(Quotient::Connection *connection, const QString &roomName, const QString &syncFileName = {})
|
||||||
|
: NeoChatRoom(connection, roomName, Quotient::JoinState::Join)
|
||||||
|
{
|
||||||
|
syncNewEvents(syncFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update(Quotient::SyncRoomData &&data, bool fromCache = false)
|
||||||
|
{
|
||||||
|
Room::updateData(std::move(data), fromCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncNewEvents(const QString &syncFileName)
|
||||||
|
{
|
||||||
|
if (!syncFileName.isEmpty()) {
|
||||||
|
QFile testSyncFile;
|
||||||
|
testSyncFile.setFileName(QLatin1String(DATA_DIR) + u'/' + syncFileName);
|
||||||
|
testSyncFile.open(QIODevice::ReadOnly);
|
||||||
|
const auto testSyncJson = QJsonDocument::fromJson(testSyncFile.readAll());
|
||||||
|
Quotient::SyncRoomData roomData(id(), Quotient::JoinState::Join, testSyncJson.object());
|
||||||
|
update(std::move(roomData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -14,26 +14,17 @@
|
|||||||
#include "neochatconnection.h"
|
#include "neochatconnection.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include "testutils.h"
|
||||||
|
|
||||||
using namespace Quotient;
|
using namespace Quotient;
|
||||||
|
|
||||||
class TestRoom : public NeoChatRoom
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
using NeoChatRoom::NeoChatRoom;
|
|
||||||
|
|
||||||
void update(SyncRoomData &&data, bool fromCache = false)
|
|
||||||
{
|
|
||||||
Room::updateData(std::move(data), fromCache);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class TextHandlerTest : public QObject
|
class TextHandlerTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Connection *connection = nullptr;
|
Connection *connection = nullptr;
|
||||||
TestRoom *room = nullptr;
|
TestUtils::TestRoom *room = nullptr;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
@@ -83,8 +74,6 @@ private Q_SLOTS:
|
|||||||
void TextHandlerTest::initTestCase()
|
void TextHandlerTest::initTestCase()
|
||||||
{
|
{
|
||||||
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
connection = Connection::makeMockConnection(QStringLiteral("@bob:kde.org"));
|
||||||
room = new TestRoom(connection, QStringLiteral("#myroom:kde.org"), JoinState::Join);
|
|
||||||
|
|
||||||
connection->setAccountData("im.ponies.user_emotes"_ls,
|
connection->setAccountData("im.ponies.user_emotes"_ls,
|
||||||
QJsonObject{{"images"_ls,
|
QJsonObject{{"images"_ls,
|
||||||
QJsonObject{{"test"_ls,
|
QJsonObject{{"test"_ls,
|
||||||
@@ -93,12 +82,7 @@ void TextHandlerTest::initTestCase()
|
|||||||
{"usage"_ls, QJsonArray{"emoticon"_ls}}}}}}});
|
{"usage"_ls, QJsonArray{"emoticon"_ls}}}}}}});
|
||||||
CustomEmojiModel::instance().setConnection(static_cast<NeoChatConnection *>(connection));
|
CustomEmojiModel::instance().setConnection(static_cast<NeoChatConnection *>(connection));
|
||||||
|
|
||||||
QFile testTextHandlerSyncFile;
|
room = new TestUtils::TestRoom(connection, QStringLiteral("#myroom:kde.org"), QLatin1String("test-texthandler-sync.json"));
|
||||||
testTextHandlerSyncFile.setFileName(QLatin1String(DATA_DIR) + u'/' + QLatin1String("test-texthandler-sync.json"));
|
|
||||||
testTextHandlerSyncFile.open(QIODevice::ReadOnly);
|
|
||||||
const auto testTextHandlerSyncJson = QJsonDocument::fromJson(testTextHandlerSyncFile.readAll());
|
|
||||||
SyncRoomData roomData(QStringLiteral("@bob:kde.org"), JoinState::Join, testTextHandlerSyncJson.object());
|
|
||||||
room->update(std::move(roomData));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextHandlerTest::allowedAttributes()
|
void TextHandlerTest::allowedAttributes()
|
||||||
|
|||||||
Reference in New Issue
Block a user