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

Method testIndent

tests/testeditor.cpp:16–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16void TestIDE::testIndent()
17{
18 QFETCH(QString, initial);
19 QFETCH(int, shift_amount);
20 QFETCH(int, start);
21 QFETCH(int, end);
22 QFETCH(QString, expected);
23
24 TestMocker mock;
25 MainWindow* w = mock.mw();
26 CodeEditor* e = w->curEditor;
27 QTextDocument* doc = e->document();
28 doc->setPlainText(initial);
29 QTextCursor cursor = e->textCursor();
30 cursor.setPosition(start, QTextCursor::MoveAnchor);
31 cursor.setPosition(end, QTextCursor::KeepAnchor);
32 e->setTextCursor(cursor);
33 while (shift_amount < 0) {
34 w->on_actionShift_left_triggered();
35 shift_amount++;
36 }
37 while (shift_amount > 0) {
38 w->on_actionShift_right_triggered();
39 shift_amount--;
40 }
41 QCOMPARE(doc->toPlainText(), expected);
42 doc->setModified(false);
43}
44
45void TestIDE::testIndent_data() {
46 QString initial1 = "Line 1\n"

Callers

nothing calls this directly

Calls 4

mwMethod · 0.80
setModifiedMethod · 0.80

Tested by

no test coverage detected