Changeset View
Changeset View
Standalone View
Standalone View
autotests/src/katedocument_test.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 304 | { | |||
---|---|---|---|---|---|
353 | reset(); | 353 | reset(); | ||
354 | testInput = ("foo \"bar\" haz"); | 354 | testInput = ("foo \"bar\" haz"); | ||
355 | typeText(testInput); | 355 | typeText(testInput); | ||
356 | QCOMPARE(doc.text(), testInput); | 356 | QCOMPARE(doc.text(), testInput); | ||
357 | // Simulate afterwards to add quotes, bug 405089 | 357 | // Simulate afterwards to add quotes, bug 405089 | ||
358 | doc.setText("foo \"bar"); | 358 | doc.setText("foo \"bar"); | ||
359 | typeText("\" haz"); | 359 | typeText("\" haz"); | ||
360 | QCOMPARE(doc.text(), testInput); | 360 | QCOMPARE(doc.text(), testInput); | ||
361 | | ||||
362 | // Let's check to add brackets to a selection... | ||||
363 | view->setBlockSelection(false); | ||||
364 | doc.setText("012xxx678"); | ||||
365 | view->setSelection(Range(0, 3, 0, 6)); | ||||
366 | typeText("["); | ||||
367 | QCOMPARE(doc.text(), "012[xxx]678"); | ||||
368 | QCOMPARE(view->selectionRange(), Range(0, 4, 0, 7)); | ||||
369 | | ||||
370 | // ...over multiple lines.. | ||||
371 | doc.setText("012xxx678\n012xxx678"); | ||||
372 | view->setSelection(Range(0, 3, 1, 6)); | ||||
373 | typeText("["); | ||||
374 | QCOMPARE(doc.text(), "012[xxx678\n012xxx]678"); | ||||
375 | QCOMPARE(view->selectionRange(), Range(0, 4, 1, 6)); | ||||
376 | | ||||
377 | // ..once again in in block mode | ||||
378 | view->setBlockSelection(true); | ||||
379 | doc.setText("012xxx678\n012xxx678"); | ||||
380 | view->setSelection(Range(0, 3, 1, 6)); | ||||
381 | typeText("["); | ||||
382 | QCOMPARE(doc.text(), "012[xxx]678\n012[xxx]678"); | ||||
383 | QCOMPARE(view->selectionRange(), Range(0, 4, 1, 7)); | ||||
361 | } | 384 | } | ||
362 | 385 | | |||
363 | void KateDocumentTest::testReplaceTabs() | 386 | void KateDocumentTest::testReplaceTabs() | ||
364 | { | 387 | { | ||
365 | KTextEditor::DocumentPrivate doc; | 388 | KTextEditor::DocumentPrivate doc; | ||
366 | auto view = static_cast<KTextEditor::ViewPrivate*>(doc.createView(nullptr)); | 389 | auto view = static_cast<KTextEditor::ViewPrivate*>(doc.createView(nullptr)); | ||
367 | 390 | | |||
368 | auto reset = [&]() { | 391 | auto reset = [&]() { | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |