MCPcopy Create free account
hub / github.com/KDE/kdevelop / testCopyConstructor

Method testCopyConstructor

kdevplatform/vcs/tests/test_vcslocation.cpp:114–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114void TestVcsLocation::testCopyConstructor()
115{
116 // test plain copy
117 const QString repositoryServer = QStringLiteral("server");
118 const QString repositoryModule = QStringLiteral("module");
119 const QString repositoryBranch = QStringLiteral("branch");
120 const QString repositoryTag = QStringLiteral("tag");
121 const QString repositoryPath = QStringLiteral("path");
122 const QVariant userData = QVariant(QStringLiteral("userdata"));
123
124 {
125 VcsLocation serverLocationA(repositoryServer);
126 setServerLocation(serverLocationA,
127 repositoryModule, repositoryBranch, repositoryTag, repositoryPath, userData);
128
129 VcsLocation serverLocationB(serverLocationA);
130 compareServerLocation(serverLocationA,
131 repositoryServer, repositoryModule, repositoryBranch, repositoryTag, repositoryPath,
132 userData);
133 compareServerLocation(serverLocationB,
134 repositoryServer, repositoryModule, repositoryBranch, repositoryTag, repositoryPath,
135 userData);
136 QVERIFY(serverLocationB == serverLocationA);
137 QVERIFY(serverLocationA == serverLocationB);
138 }
139
140 const QString repositoryServerNew = QStringLiteral("servernew");
141
142 // test detach after changing A
143 {
144 VcsLocation serverLocationA(repositoryServer);
145 setServerLocation(serverLocationA,
146 repositoryModule, repositoryBranch, repositoryTag, repositoryPath, userData);
147
148 VcsLocation serverLocationB(serverLocationA);
149 // change a property of A
150 serverLocationA.setRepositoryServer(repositoryServerNew);
151
152 compareServerLocation(serverLocationA,
153 repositoryServerNew, repositoryModule, repositoryBranch, repositoryTag, repositoryPath,
154 userData);
155 compareServerLocation(serverLocationB,
156 repositoryServer, repositoryModule, repositoryBranch, repositoryTag, repositoryPath,
157 userData);
158 QVERIFY(!(serverLocationB == serverLocationA));
159 QVERIFY(!(serverLocationA == serverLocationB));
160 }
161}
162
163void TestVcsLocation::testAssignOperator()
164{

Callers

nothing calls this directly

Calls 2

setRepositoryServerMethod · 0.80
QVariantClass · 0.50

Tested by

no test coverage detected