diff --git a/tools/chatgui/tests/test_file_drop.cpp b/tools/chatgui/tests/test_file_drop.cpp index 33364e24..f44e10c2 100644 --- a/tools/chatgui/tests/test_file_drop.cpp +++ b/tools/chatgui/tests/test_file_drop.cpp @@ -29,6 +29,8 @@ extern "C" { #include #include #include +#include +#include static QString makeFile(const QTemporaryDir& dir, const QString& name, const QByteArray& contents = "test") { const QString path = dir.filePath(name); diff --git a/tools/chatgui/tests/test_message_events.cpp b/tools/chatgui/tests/test_message_events.cpp index 4e6632d0..b569f3f3 100644 --- a/tools/chatgui/tests/test_message_events.cpp +++ b/tools/chatgui/tests/test_message_events.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef UTUN_TEST_BRIDGE_ALLOC_FAILURES static int failAllocation; @@ -214,6 +215,7 @@ private slots: void cancelledSubmissionReturnsOneFailureAndFreesRequest() { BoundCore core; QVERIFY(core.ua); core.attach(); submitted.clear(); + const auto resetCallback = qScopeGuard([] { gui_bridge_set_msg_submitted_cb(nullptr); }); gui_bridge_set_msg_submitted_cb([](const uint8_t* data, int len) { submitted.append(QByteArray((const char*)data, len)); }); const size_t before = u_get_allocated_count(); auto* request = static_cast(u_calloc(1, sizeof(chat_msg_submit))); QVERIFY(request); @@ -222,7 +224,7 @@ private slots: QCoreApplication::processEvents(); QCOMPARE(submitted, QList({QByteArray::fromHex("080706050403020100")})); uasync_poll(core.ua, 0); QCoreApplication::processEvents(); QCOMPARE(submitted.size(), 1); - QCOMPARE(u_get_allocated_count(), before); gui_bridge_set_msg_submitted_cb(nullptr); + QCOMPARE(u_get_allocated_count(), before); } void invalidPostArgumentsDoNotTurnIntoEmptyEvents() {