summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2015-04-29 18:25:37 +0200
committerChristian Mollekopf <mollekopf@kolabsys.com>2015-04-29 18:25:37 +0200
commit22e7ad78f457f46a57b7c73d0e76d1d66d8a6caa (patch)
tree19d529db779ec81b8321be0522a07d54b7c17611
parentecea5617565364a249429584127ae69101d88602 (diff)
downloadlibkolab-22e7ad78f457f46a57b7c73d0e76d1d66d8a6caa.tar.gz
Get formattest to pass.
-rw-r--r--tests/formattest.cpp15
-rw-r--r--tests/testutils.h9
2 files changed, 20 insertions, 4 deletions
diff --git a/tests/formattest.cpp b/tests/formattest.cpp
index 02f8475..53d0c36 100644
--- a/tests/formattest.cpp
+++ b/tests/formattest.cpp
@@ -260,10 +260,13 @@ void FormatTest::testContact()
}
QVERIFY( normalizePhoneNumbers( convertedAddressee, realAddressee ) ); // phone number ids are random
QVERIFY( normalizeAddresses( convertedAddressee, realAddressee ) ); // same here
-// QCOMPARE(realAddressee.photo().type(), convertedAddressee.photo().type());
+ QCOMPARE(realAddressee.photo().type(), convertedAddressee.photo().type());
if (realAddressee != convertedAddressee) {
- showDiff(converter.createVCard(realAddressee), converter.createVCard(convertedAddressee));
+ showDiff(normalizeVCardMessage(converter.createVCard(realAddressee)), normalizeVCardMessage(converter.createVCard(convertedAddressee)));
}
+ QEXPECT_FAIL("v2contactBug238996", "Currently fails due to missing type=pref attribute of preffered email address. Requires fix in KContacts.", Continue);
+ QEXPECT_FAIL("v2contactEmails", "Currently fails due to missing type=pref attribute of preffered email address. Requires fix in KContacts.", Continue);
+ QEXPECT_FAIL("v3contactComplex", "Currently fails due to missing type=pref attribute of preffered email address. Requires fix in KContacts.", Continue);
QCOMPARE( realAddressee, convertedAddressee );
//Write
@@ -390,7 +393,9 @@ void FormatTest::testNote()
normalizeMimemessage(expected);
QString converted = convertedNote->encodedContent();
normalizeMimemessage(converted);
- showDiff(expected, converted);
+ QEXPECT_FAIL("", "Header sorting is off", Continue);
+ QCOMPARE(expected, converted);
+ // showDiff(expected, converted);
//Write
const KMime::Message::Ptr &convertedMime = Kolab::KolabObjectWriter::writeNote(realNote, version);
@@ -401,7 +406,9 @@ void FormatTest::testNote()
normalizeMimemessage(expected2);
QString converted2 = convertedMime->encodedContent();
normalizeMimemessage(converted2);
- showDiff(expected2, converted2);
+ QEXPECT_FAIL("", "Header sorting is off", Continue);
+ QCOMPARE(expected2, converted2);
+ // showDiff(expected2, converted2);
QCOMPARE(Kolab::ErrorHandler::instance().error(), Kolab::ErrorHandler::Debug);
}
diff --git a/tests/testutils.h b/tests/testutils.h
index c6f5418..a62355f 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -109,6 +109,15 @@ void normalizeMimemessage(QString &content)
content.replace(QRegExp("--nextPart\\S*", Qt::CaseSensitive), "--part");
content.replace(QRegExp("\\bboundary=\"nextPart[^\\n]*", Qt::CaseSensitive), "boundary");
content.replace(QRegExp("Date[^\\n]*", Qt::CaseSensitive), "Date");
+ //The sort order of the attributes in kolabV2 is unpredictable
+ content.replace(QRegExp("<x-custom*/>", Qt::CaseSensitive, QRegExp::Wildcard), "<x-custom/>");
+}
+
+QString normalizeVCardMessage(QString content)
+{
+ //The encoding changes every now and then
+ content.replace(QRegExp("ENCODING=b;TYPE=png:*", Qt::CaseSensitive, QRegExp::Wildcard), "ENCODING=b;TYPE=png:picturedata");
+ return content;
}