MCPcopy Create free account
hub / github.com/KDE/kdevelop / clearQueue

Method clearQueue

plugins/debuggercommon/tests/test_micommandqueue.cpp:113–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void 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
138QTEST_GUILESS_MAIN(TestMICommandQueue)
139

Callers

nothing calls this directly

Calls 7

enqueueMethod · 0.80
haveImmediateCommandMethod · 0.80
QStringClass · 0.50
getMethod · 0.45
clearMethod · 0.45
countMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected