MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / testCPProfiler

Method testCPProfiler

tests/testcpprofier.cpp:12–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include <QSignalSpy>
11
12void 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}

Callers

nothing calls this directly

Calls 6

mwMethod · 0.80
setModifiedMethod · 0.80
countMethod · 0.80
nodeCountMethod · 0.45

Tested by

no test coverage detected