Changeset View
Changeset View
Standalone View
Standalone View
autotests/libs/collectionattributetest.cpp
Show First 20 Lines • Show All 234 Lines • ▼ Show 20 Line(s) | 229 | { | |||
---|---|---|---|---|---|
235 | 235 | | |||
236 | QByteArray result = attribute.serialized(); | 236 | QByteArray result = attribute.serialized(); | ||
237 | CollectionIdentificationAttribute parsed; | 237 | CollectionIdentificationAttribute parsed; | ||
238 | parsed.deserialize(result); | 238 | parsed.deserialize(result); | ||
239 | qDebug() << parsed.identifier() << parsed.collectionNamespace() << result; | 239 | qDebug() << parsed.identifier() << parsed.collectionNamespace() << result; | ||
240 | QCOMPARE(parsed.identifier(), id); | 240 | QCOMPARE(parsed.identifier(), id); | ||
241 | QCOMPARE(parsed.collectionNamespace(), ns); | 241 | QCOMPARE(parsed.collectionNamespace(), ns); | ||
242 | } | 242 | } | ||
243 | | ||||
244 | void CollectionAttributeTest::testDetach() | ||||
245 | { | ||||
246 | // GIVEN a collection with an attribute | ||||
247 | Collection col; | ||||
248 | col.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing); | ||||
249 | Collection col2 = col; // and a copy, so that non-const access detaches | ||||
250 | | ||||
251 | // WHEN | ||||
252 | TestAttribute *attr = col2.attribute<TestAttribute>(Akonadi::Collection::AddIfMissing); | ||||
253 | TestAttribute *attr2 = col2.attribute<TestAttribute>(); | ||||
254 | | ||||
255 | // THEN | ||||
256 | QCOMPARE(attr, attr2); | ||||
257 | } |