Extend IdentityTest and fix all bugs it discovered
ClosedPublic

Authored by dvratil on Jul 22 2016, 9:08 AM.

Details

Summary

Fixes main serialization and deserialization of Identity to raw data.
The serializer was serializing QStrings, while the deserializer was
expecting QVariants, which did not behave as expected. The serializer
now serializes everything as QVariants too.

Fixes serialization of Signature - signature was never being stored
in mPropertiesMap, so the key was always empty. We instead serialize
mSignature directly. Calls to setSignature() etc. now also insert the
mSignature into the mPropertiesMap.

Improves operator==() to handle comparision between manually created
and deserialized Identity. Deserialization will fill mPropertiesMap
with lots of empty QVariants, but the default ctor will not so simple
mPropertiesMap == other.mPropertiesMap comparision was failing. The
algorithm now assumes that if a key is not present in one map but
is present in another the maps are considered equal as long as the
value is invalid.

Diff Detail

Repository
R176 PIM: KIdentity Management
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dvratil updated this revision to Diff 5409.Jul 22 2016, 9:08 AM
dvratil retitled this revision from to Extend IdentityTest and fix all bugs it discovered.
dvratil updated this object.
dvratil edited the test plan for this revision. (Show Details)
dvratil added a reviewer: kde-pim.
dvratil added a subscriber: mlaurent.
Restricted Application added a project: KDE PIM. · View Herald TranscriptJul 22 2016, 9:08 AM
dvratil updated this revision to Diff 5410.Jul 22 2016, 9:11 AM

Cleanup

knauss added a subscriber: knauss.Jul 22 2016, 9:19 AM
knauss added inline comments.
autotests/identitytest.cpp
166

you should also test the negativ outcome, so that you really make sure, that the == operator not just always return true :)

Something like

copy.setXFace(QStringLiteral(":-("))
QCOMPARE(copy == identity, false);

It's seems ok for me.
thanks for providing this autotests.

This revision was automatically updated to reflect the committed changes.