Changeset View
Changeset View
Standalone View
Standalone View
autotests/src/kateview_test.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 281 | { | |||
---|---|---|---|---|---|
304 | QCOMPARE(view->selection(), false); | 304 | QCOMPARE(view->selection(), false); | ||
305 | 305 | | |||
306 | view->setSelection(range); | 306 | view->setSelection(range); | ||
307 | view->setCursorPositionInternal(cur1); | 307 | view->setCursorPositionInternal(cur1); | ||
308 | view->cursorRight(); | 308 | view->cursorRight(); | ||
309 | QCOMPARE(view->cursorPosition(), cur2); // Be at end: foobar|haz | 309 | QCOMPARE(view->cursorPosition(), cur2); // Be at end: foobar|haz | ||
310 | QCOMPARE(view->selection(), false); | 310 | QCOMPARE(view->selection(), false); | ||
311 | 311 | | |||
312 | view->config()->setPersistentSelection(true); | 312 | view->config()->setValue(KateViewConfig::PersistentSelection, true); | ||
313 | 313 | | |||
314 | view->setSelection(range); | 314 | view->setSelection(range); | ||
315 | view->setCursorPositionInternal(cur1); | 315 | view->setCursorPositionInternal(cur1); | ||
316 | view->cursorLeft(); | 316 | view->cursorLeft(); | ||
317 | // RTL drives me nuts! | 317 | // RTL drives me nuts! | ||
318 | help = text.isRightToLeft() ? (cur1 + curDelta): (cur1 - curDelta); | 318 | help = text.isRightToLeft() ? (cur1 + curDelta): (cur1 - curDelta); | ||
319 | QCOMPARE(view->cursorPosition(), help); // Be one left: fo|obarhaz | 319 | QCOMPARE(view->cursorPosition(), help); // Be one left: fo|obarhaz | ||
320 | QCOMPARE(view->selection(), true); | 320 | QCOMPARE(view->selection(), true); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 356 | { | |||
364 | QCOMPARE(doc.lines(), 5); | 364 | QCOMPARE(doc.lines(), 5); | ||
365 | 365 | | |||
366 | KTextEditor::ViewPrivate *view = new KTextEditor::ViewPrivate(&doc, nullptr); | 366 | KTextEditor::ViewPrivate *view = new KTextEditor::ViewPrivate(&doc, nullptr); | ||
367 | view->setCursorPosition({ 3, 5 }); | 367 | view->setCursorPosition({ 3, 5 }); | ||
368 | view->resize(400, 300); | 368 | view->resize(400, 300); | ||
369 | view->show(); | 369 | view->show(); | ||
370 | 370 | | |||
371 | // enable "[x] Scroll past end of document" | 371 | // enable "[x] Scroll past end of document" | ||
372 | view->config()->setScrollPastEnd(true); | 372 | view->config()->setValue(KateViewConfig::ScrollPastEnd, true); | ||
373 | QCOMPARE(view->config()->scrollPastEnd(), true); | 373 | QCOMPARE(view->config()->scrollPastEnd(), true); | ||
374 | 374 | | |||
375 | // disable dynamic word wrap | 375 | // disable dynamic word wrap | ||
376 | view->config()->setDynWordWrap(false); | 376 | view->config()->setDynWordWrap(false); | ||
377 | QCOMPARE(view->config()->dynWordWrap(), false); | 377 | QCOMPARE(view->config()->dynWordWrap(), false); | ||
378 | 378 | | |||
379 | view->scrollDown(); | 379 | view->scrollDown(); | ||
380 | view->scrollDown(); | 380 | view->scrollDown(); | ||
Show All 17 Lines | 394 | stream << "/**\n" | |||
398 | << "int main() {}\n"; | 398 | << "int main() {}\n"; | ||
399 | file.close(); | 399 | file.close(); | ||
400 | 400 | | |||
401 | KTextEditor::DocumentPrivate doc; | 401 | KTextEditor::DocumentPrivate doc; | ||
402 | QVERIFY(doc.openUrl(QUrl::fromLocalFile(file.fileName()))); | 402 | QVERIFY(doc.openUrl(QUrl::fromLocalFile(file.fileName()))); | ||
403 | QCOMPARE(doc.highlightingMode(), QString("C++")); | 403 | QCOMPARE(doc.highlightingMode(), QString("C++")); | ||
404 | 404 | | |||
405 | KTextEditor::ViewPrivate *view = new KTextEditor::ViewPrivate(&doc, nullptr); | 405 | KTextEditor::ViewPrivate *view = new KTextEditor::ViewPrivate(&doc, nullptr); | ||
406 | view->config()->setFoldFirstLine(false); | 406 | view->config()->setValue(KateViewConfig::FoldFirstLine, false); | ||
407 | view->setCursorPosition({4, 0}); | 407 | view->setCursorPosition({4, 0}); | ||
408 | 408 | | |||
409 | // initially, nothing is folded | 409 | // initially, nothing is folded | ||
410 | QVERIFY(view->textFolding().isLineVisible(1)); | 410 | QVERIFY(view->textFolding().isLineVisible(1)); | ||
411 | 411 | | |||
412 | // now change the config, and expect the header to be folded | 412 | // now change the config, and expect the header to be folded | ||
413 | view->config()->setFoldFirstLine(true); | 413 | view->config()->setValue(KateViewConfig::FoldFirstLine, true); | ||
414 | qint64 foldedRangeId = 0; | 414 | qint64 foldedRangeId = 0; | ||
415 | QVERIFY(!view->textFolding().isLineVisible(1, &foldedRangeId)); | 415 | QVERIFY(!view->textFolding().isLineVisible(1, &foldedRangeId)); | ||
416 | 416 | | |||
417 | // now unfold the range | 417 | // now unfold the range | ||
418 | QVERIFY(view->textFolding().unfoldRange(foldedRangeId)); | 418 | QVERIFY(view->textFolding().unfoldRange(foldedRangeId)); | ||
419 | QVERIFY(view->textFolding().isLineVisible(1)); | 419 | QVERIFY(view->textFolding().isLineVisible(1)); | ||
420 | 420 | | |||
421 | // and save the file, we do not expect the folding to change then | 421 | // and save the file, we do not expect the folding to change then | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |