| 59 | } |
| 60 | |
| 61 | void TestVcsStatusInfo::testAssignOperator() |
| 62 | { |
| 63 | // test plain copy |
| 64 | const QUrl url(QStringLiteral("git://foo")); |
| 65 | const VcsStatusInfo::State state = VcsStatusInfo::ItemUpToDate; |
| 66 | |
| 67 | { |
| 68 | VcsStatusInfo statusInfoA; |
| 69 | statusInfoA.setUrl(url); |
| 70 | statusInfoA.setState(state); |
| 71 | |
| 72 | VcsStatusInfo statusInfoB; |
| 73 | statusInfoB = statusInfoA; |
| 74 | |
| 75 | QCOMPARE(statusInfoA.url(), url); |
| 76 | QCOMPARE(statusInfoA.state(), state); |
| 77 | QCOMPARE(statusInfoB.url(), url); |
| 78 | QCOMPARE(statusInfoB.state(), state); |
| 79 | QVERIFY(statusInfoA == statusInfoB); |
| 80 | QVERIFY(statusInfoB == statusInfoA); |
| 81 | } |
| 82 | |
| 83 | const QUrl urlNew(QStringLiteral("svn://bar")); |
| 84 | |
| 85 | // test detach after changing A |
| 86 | { |
| 87 | VcsStatusInfo statusInfoA; |
| 88 | statusInfoA.setUrl(url); |
| 89 | statusInfoA.setState(state); |
| 90 | |
| 91 | VcsStatusInfo statusInfoB; |
| 92 | statusInfoB = statusInfoA; |
| 93 | // change a property of A |
| 94 | statusInfoA.setUrl(urlNew); |
| 95 | |
| 96 | QCOMPARE(statusInfoA.url(), urlNew); |
| 97 | QCOMPARE(statusInfoA.state(), state); |
| 98 | QCOMPARE(statusInfoB.url(), url); |
| 99 | QCOMPARE(statusInfoB.state(), state); |
| 100 | QVERIFY(statusInfoA != statusInfoB); |
| 101 | QVERIFY(statusInfoB != statusInfoA); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | QTEST_GUILESS_MAIN(TestVcsStatusInfo) |
| 106 | |