| 87 | } |
| 88 | |
| 89 | void TestVcsAnnotation::testAssignOperator() |
| 90 | { |
| 91 | const int lineNumber = 1; |
| 92 | const QString text("Text A"); |
| 93 | const QString author("Author A"); |
| 94 | VcsRevision revision; |
| 95 | revision.setRevisionValue("A", VcsRevision::GlobalNumber); |
| 96 | const QDateTime date = QDateTime::fromString("2001-01-01T00:00:00+00:00", Qt::ISODate); |
| 97 | const QString commitMessage("Commit A"); |
| 98 | const VcsAnnotationLine annotationLine = createAnnotationLine(lineNumber, text, author, revision, date, commitMessage); |
| 99 | const QUrl location(QStringLiteral("https://kdevelop.org")); |
| 100 | |
| 101 | // test plain copy |
| 102 | { |
| 103 | VcsAnnotation annotationA; |
| 104 | annotationA.setLocation(location); |
| 105 | annotationA.insertLine(lineNumber, annotationLine); |
| 106 | |
| 107 | VcsAnnotation annotationB; |
| 108 | annotationB = annotationA; |
| 109 | |
| 110 | QCOMPARE(annotationA.location(), location); |
| 111 | QCOMPARE(annotationA.lineCount(), 1); |
| 112 | QVERIFY(annotationA.containsLine(lineNumber)); |
| 113 | QCOMPARE(annotationB.location(), location); |
| 114 | QCOMPARE(annotationB.lineCount(), 1); |
| 115 | QVERIFY(annotationB.containsLine(lineNumber)); |
| 116 | } |
| 117 | |
| 118 | const QUrl locationNew(QStringLiteral("https://kate-editor.org")); |
| 119 | |
| 120 | // test detach after changing A |
| 121 | { |
| 122 | VcsAnnotation annotationA; |
| 123 | annotationA.setLocation(location); |
| 124 | annotationA.insertLine(lineNumber, annotationLine); |
| 125 | |
| 126 | VcsAnnotation annotationB; |
| 127 | annotationB = annotationA; |
| 128 | // change a property of A |
| 129 | annotationA.setLocation(locationNew); |
| 130 | |
| 131 | QCOMPARE(annotationA.location(), locationNew); |
| 132 | QCOMPARE(annotationA.lineCount(), 1); |
| 133 | QVERIFY(annotationA.containsLine(lineNumber)); |
| 134 | QCOMPARE(annotationB.location(), location); |
| 135 | QCOMPARE(annotationB.lineCount(), 1); |
| 136 | QVERIFY(annotationB.containsLine(lineNumber)); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | QTEST_GUILESS_MAIN(TestVcsAnnotation) |
| 141 |
nothing calls this directly
no test coverage detected