| 14 | } |
| 15 | |
| 16 | void 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 | |
| 45 | void TestIDE::testIndent_data() { |
| 46 | QString initial1 = "Line 1\n" |
nothing calls this directly
no test coverage detected