| 38 | } |
| 39 | |
| 40 | void TestVcsAnnotation::testCopyConstructor() |
| 41 | { |
| 42 | const int lineNumber = 1; |
| 43 | const QString text("Text A"); |
| 44 | const QString author("Author A"); |
| 45 | VcsRevision revision; |
| 46 | revision.setRevisionValue("A", VcsRevision::GlobalNumber); |
| 47 | const QDateTime date = QDateTime::fromString("2001-01-01T00:00:00+00:00", Qt::ISODate); |
| 48 | const QString commitMessage("Commit A"); |
| 49 | const VcsAnnotationLine annotationLine = createAnnotationLine(lineNumber, text, author, revision, date, commitMessage); |
| 50 | const QUrl location(QStringLiteral("git://foo")); |
| 51 | |
| 52 | // test plain copy |
| 53 | { |
| 54 | VcsAnnotation annotationA; |
| 55 | annotationA.setLocation(location); |
| 56 | annotationA.insertLine(lineNumber, annotationLine); |
| 57 | |
| 58 | VcsAnnotation annotationB(annotationA); |
| 59 | |
| 60 | QCOMPARE(annotationA.location(), location); |
| 61 | QCOMPARE(annotationA.lineCount(), 1); |
| 62 | QVERIFY(annotationA.containsLine(lineNumber)); |
| 63 | QCOMPARE(annotationB.location(), location); |
| 64 | QCOMPARE(annotationB.lineCount(), 1); |
| 65 | QVERIFY(annotationB.containsLine(lineNumber)); |
| 66 | } |
| 67 | |
| 68 | const QUrl locationNew(QStringLiteral("svn://bar")); |
| 69 | |
| 70 | // test detach after changing A |
| 71 | { |
| 72 | VcsAnnotation annotationA; |
| 73 | annotationA.setLocation(location); |
| 74 | annotationA.insertLine(lineNumber, annotationLine); |
| 75 | |
| 76 | VcsAnnotation annotationB(annotationA); |
| 77 | // change a property of A |
| 78 | annotationA.setLocation(locationNew); |
| 79 | |
| 80 | QCOMPARE(annotationA.location(), locationNew); |
| 81 | QCOMPARE(annotationA.lineCount(), 1); |
| 82 | QVERIFY(annotationA.containsLine(lineNumber)); |
| 83 | QCOMPARE(annotationB.location(), location); |
| 84 | QCOMPARE(annotationB.lineCount(), 1); |
| 85 | QVERIFY(annotationB.containsLine(lineNumber)); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | void TestVcsAnnotation::testAssignOperator() |
| 90 | { |
nothing calls this directly
no test coverage detected