| 10 | #include <QSignalSpy> |
| 11 | |
| 12 | void TestIDE::testCPProfiler() |
| 13 | { |
| 14 | TestMocker mock; |
| 15 | MainWindow* w = mock.mw(); |
| 16 | CodeEditor* e = w->curEditor; |
| 17 | QTextDocument* doc = e->document(); |
| 18 | doc->setPlainText("var 1..3: x;" |
| 19 | "solve :: int_search([x], input_order, indomain_min) maximize x;"); |
| 20 | doc->setModified(false); |
| 21 | w->on_actionShow_search_profiler_triggered(); |
| 22 | |
| 23 | qRegisterMetaType<cpprofiler::Execution*>(); |
| 24 | QSignalSpy spy(w->conductor, &cpprofiler::Conductor::executionStart); |
| 25 | QSignalSpy spy2(w, &MainWindow::finished); |
| 26 | w->on_actionProfile_search_triggered(); |
| 27 | QVERIFY(spy.wait()); |
| 28 | auto args = spy.takeFirst(); |
| 29 | auto* ex = args[0].value<cpprofiler::Execution*>(); |
| 30 | QVERIFY(ex != nullptr); |
| 31 | QVERIFY(QTest::qWaitFor([=] () { |
| 32 | return ex->tree().nodeCount() == 5; |
| 33 | }, 30000)); |
| 34 | QVERIFY(spy2.count() > 0 || spy2.wait()); |
| 35 | } |
nothing calls this directly
no test coverage detected