Verify edit events bypass new-message callbacks and notifications
This commit is contained in:
1 parent
f112f0004c
commit
571e86b327
1 file changed
+14
@@ -16,6 +16,7 @@ static QList<ReceivedMessage> received;
|
||||
static QList<int> cpuLoads;
|
||||
static bool cpuOnGuiThread = true;
|
||||
static QStringList changedChannels;
|
||||
static QList<QByteArray> edits;
|
||||
|
||||
static void cpu_received(int percent) {
|
||||
cpuLoads.append(percent);
|
||||
@@ -80,6 +81,19 @@ private slots:
|
||||
QVERIFY(received.isEmpty());
|
||||
}
|
||||
|
||||
void editIsDeliveredSeparatelyFromNewMessage() {
|
||||
edits.clear();
|
||||
gui_bridge_set_msg_updated_cb([](const uint8_t* data, int len) {
|
||||
QVERIFY(QThread::currentThread() == qApp->thread()); edits.append(QByteArray((const char*)data, len));
|
||||
});
|
||||
QByteArray event(1, char(5)); event += "12345"; event += QByteArray(32, 'k');
|
||||
gui_bridge_post(CHAT_EVT_MSG_UPDATED, (const uint8_t*)event.constData(), event.size());
|
||||
QTRY_COMPARE(edits.size(), 1); QCOMPARE(edits.first(), event); QVERIFY(received.isEmpty());
|
||||
event.chop(1); gui_bridge_post(CHAT_EVT_MSG_UPDATED, (const uint8_t*)event.constData(), event.size());
|
||||
QTest::qWait(30); QCOMPARE(edits.size(), 1); QVERIFY(received.isEmpty());
|
||||
gui_bridge_set_msg_updated_cb(nullptr);
|
||||
}
|
||||
|
||||
void cpuLoadDeliveredToGuiThread() {
|
||||
cpuLoads.clear(); cpuOnGuiThread = true;
|
||||
gui_bridge_set_cpu_load_cb(cpu_received);
|
||||
|
||||
Reference in new issue
Block a user