| 111 | } |
| 112 | |
| 113 | void TestMICommandQueue::clearQueue() |
| 114 | { |
| 115 | KDevMI::MI::CommandQueue commandQueue; |
| 116 | |
| 117 | // prepare |
| 118 | auto command1 = std::make_unique<TestDummyCommand>(KDevMI::MI::NonMI, QString(), KDevMI::MI::CmdImmediately); |
| 119 | auto command2 = std::make_unique<TestDummyCommand>(KDevMI::MI::NonMI, QString(), KDevMI::MI::CommandFlags {}); |
| 120 | |
| 121 | QSignalSpy command1Spy(command1.get(), &QObject::destroyed); |
| 122 | QSignalSpy command2Spy(command2.get(), &QObject::destroyed); |
| 123 | |
| 124 | commandQueue.enqueue(std::move(command1)); |
| 125 | commandQueue.enqueue(std::move(command2)); |
| 126 | |
| 127 | // execute |
| 128 | commandQueue.clear(); |
| 129 | |
| 130 | // check |
| 131 | QCOMPARE(commandQueue.count(), 0); |
| 132 | QCOMPARE(commandQueue.isEmpty(), true); |
| 133 | QCOMPARE(commandQueue.haveImmediateCommand(), false); |
| 134 | QCOMPARE(command1Spy.count(), 1); |
| 135 | QCOMPARE(command2Spy.count(), 1); |
| 136 | } |
| 137 | |
| 138 | QTEST_GUILESS_MAIN(TestMICommandQueue) |
| 139 | |