| 495 | } |
| 496 | |
| 497 | void TestBreakpointModel::testSetLocation() |
| 498 | { |
| 499 | const auto [url1, doc1, b1] = setupPrimaryDocumentAndBreakpoint(); |
| 500 | RETURN_IF_TEST_FAILED(); |
| 501 | |
| 502 | // TEST: increment the line number. |
| 503 | b1->setLocation(url1, b1->savedLine() + 1); |
| 504 | // Verify the move of the mark and the change of location. |
| 505 | QCOMPARE(breakpointModel()->breakpoint(0), b1); |
| 506 | auto marks = documentMarks(doc1); |
| 507 | QCOMPARE(marks.size(), 1); |
| 508 | VERIFY_BREAKPOINT(b1, 22, BreakpointModel::BreakpointMark, marks, ); |
| 509 | |
| 510 | // Make a secondary test file and open it. |
| 511 | QVERIFY(QFile::copy(m_tempDir->filePath(primaryTestFileName), m_tempDir->filePath(secondaryTestFileName))); |
| 512 | const auto url2 = testFileUrl(secondaryTestFileName); |
| 513 | RETURN_IF_TEST_FAILED(); |
| 514 | auto* const doc2 = documentController()->openDocument(url2); |
| 515 | QVERIFY(doc2); |
| 516 | QCOMPARE(doc2->url(), url2); |
| 517 | |
| 518 | // TEST: Change b1 location to the secondary document. |
| 519 | b1->setLocation(url2, 21); |
| 520 | // Verify the move of the mark and the change of location. |
| 521 | QCOMPARE(b1->url(), url2); |
| 522 | QCOMPARE(breakpointModel()->breakpoint(0), b1); |
| 523 | QCOMPARE(documentMarks(doc1).size(), 0); |
| 524 | marks = documentMarks(doc2); |
| 525 | QCOMPARE(marks.size(), 1); |
| 526 | VERIFY_BREAKPOINT(b1, 21, BreakpointModel::BreakpointMark, marks, ); |
| 527 | |
| 528 | // TEST: Make b1 fall out of the document bounds. |
| 529 | // This should disable b1's document line tracking. |
| 530 | const auto lineNumberAfterLastLineInDocument = doc2->textDocument()->lines(); |
| 531 | b1->setLocation(url2, lineNumberAfterLastLineInDocument); |
| 532 | // Verify the removal of the mark and the change of line number. |
| 533 | VERIFY_UNTRACKED_BREAKPOINT(b1, lineNumberAfterLastLineInDocument, ); |
| 534 | QCOMPARE(documentMarks(doc1).size(), 0); |
| 535 | QCOMPARE(documentMarks(doc2).size(), 0); |
| 536 | } |
| 537 | |
| 538 | void TestBreakpointModel::testUpdateMarkType() |
| 539 | { |
nothing calls this directly
no test coverage detected