#include #include "TestDataSender.h" #include "model/Console.h" class ConsoleTest : public QObject { Q_OBJECT public: ConsoleTest(); ~ConsoleTest(); private slots: void test_case1(); }; ConsoleTest::ConsoleTest() { } ConsoleTest::~ConsoleTest() { } void ConsoleTest::test_case1() { Console c; auto t = new TestDataSender; c.injectDataSender(t); c.test(); QByteArray arr; arr.append(0x01); arr.append(0x04); arr.append(0x05); QCOMPARE(t->consoleData, arr); } QTEST_APPLESS_MAIN(ConsoleTest) #include "tst_console.moc"