Add unit and integration tests for DAOs, Translator, EventBus, and SyncScheduler (Phase 9 - Testing & QA)

This commit is contained in:
Padrino
2026-06-04 19:00:31 +02:00
parent c5704b78a4
commit dcb7c52269
8 changed files with 512 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#include <QtTest/QtTest>
#include "../../src/core/eventbus.h"
#include "../../src/core/events.h"
class TestEventBus : public QObject
{
Q_OBJECT
private slots:
void testPublishAndSubscribe();
};
void TestEventBus::testPublishAndSubscribe()
{
bool received = false;
int value = 0;
// Subscribe to an event of type int
auto subscription = EventBus::instance().subscribe<int>([&](int data) {
received = true;
value = data;
});
// Publish an event
EventBus::instance().publish<int>(42);
// Check that we received the event
QVERIFY(received);
QCOMPARE(value, 42);
// Unsubscribe (optional, subscription goes out of scope)
}
QTEST_MAIN(TestEventBus)
#include "test_eventbus.moc"