tests/bindingstest.cpp tests/bindingstest.h
Christian Mollekopf
mollekopf at kolabsys.com
Tue Jul 17 16:28:48 CEST 2012
tests/bindingstest.cpp | 40 +++++++++++++++++++++++++++++++++-------
tests/bindingstest.h | 2 ++
2 files changed, 35 insertions(+), 7 deletions(-)
New commits:
commit 307401f3235efeca856cc4b7cd6ebb9ea74598a8
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date: Tue Jul 17 13:48:45 2012 +0200
Check the lastModified date (we don't use the systemtimestamp anymore)
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index 7459a7d..02bdef8 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -124,6 +124,7 @@ void setIncidence(T &ev)
{
ev.setUid("UID");
ev.setCreated(Kolab::cDateTime(2006,1,6,12,0,0,true)); //UTC
+ ev.setLastModified(Kolab::cDateTime(2006,1,6,12,0,0,true)); //UTC
ev.setSequence(1);
ev.setClassification(Kolab::ClassConfidential);
ev.addCategory("Category");
@@ -234,7 +235,7 @@ void checkIncidence(const T &ev, const T &re)
QCOMPARE(ev.uid(), re.uid());
QCOMPARE(ev.created(), re.created());
- QVERIFY(re.lastModified().isValid()); //TODO can we check this better?
+ QCOMPARE(ev.lastModified(), re.lastModified());
QCOMPARE(ev.sequence(), re.sequence());
QCOMPARE(ev.classification(), re.classification());
QCOMPARE(ev.categories(), re.categories());
@@ -283,7 +284,7 @@ void BindingsTest::eventCompletness()
setIncidence(ev);
ev.setEnd(Kolab::cDateTime("Europe/Zurich", 2006,1,8,12,0,0));
ev.setTransparency(true);
-
+
std::string result = Kolab::writeEvent(ev);
QVERIFY(Kolab::error() == Kolab::NoError);
// std::cout << result << endl;
@@ -318,7 +319,7 @@ void BindingsTest::todoCompletness()
ev.addRelatedTo("rel1");
ev.addRelatedTo("rel2");
ev.setPercentComplete(50);
-
+
std::string result = Kolab::writeTodo(ev);
QVERIFY(Kolab::error() == Kolab::NoError);
// std::cout << result << endl;
@@ -349,6 +350,7 @@ void BindingsTest::journalCompletness()
ev.setUid("UID");
ev.setCreated(Kolab::cDateTime(2006,1,6,12,0,0,true)); //UTC
+ ev.setLastModified(Kolab::cDateTime(2006,1,6,12,0,0,true));
ev.setSequence(1);
ev.setClassification(Kolab::ClassConfidential);
ev.addCategory("Category");
@@ -414,7 +416,7 @@ void BindingsTest::journalCompletness()
QCOMPARE(ev.uid(), re.uid());
QCOMPARE(ev.created(), re.created());
- QVERIFY(re.lastModified().isValid()); //TODO can we check this better?
+ QCOMPARE(ev.lastModified(), re.lastModified());
QCOMPARE(ev.sequence(), re.sequence());
QCOMPARE(ev.classification(), re.classification());
QCOMPARE(ev.categories(), re.categories());
@@ -431,6 +433,7 @@ void BindingsTest::freebusyCompletness()
{
Kolab::Freebusy ev;
ev.setUid("UID");
+ ev.setTimestamp(Kolab::cDateTime(2006,1,6,12,0,0, true));
ev.setStart(Kolab::cDateTime(2006,1,6,12,0,0, true));
ev.setEnd(Kolab::cDateTime(2006,1,6,12,0,0, true));
ev.setOrganizer(Kolab::ContactReference(Kolab::ContactReference::EmailReference, "mail", "name"));
@@ -448,6 +451,7 @@ void BindingsTest::freebusyCompletness()
ev.setPeriods(fbperiods);
+ Kolab::overrideTimestamp(ev.timestamp());
std::string result = Kolab::writeFreebusy(ev);
QVERIFY(Kolab::error() == Kolab::NoError);
// std::cout << result << endl;
@@ -456,7 +460,7 @@ void BindingsTest::freebusyCompletness()
QCOMPARE(ev.uid(), re.uid());
- QVERIFY(re.timestamp().isValid()); //TODO can we check this better?
+ QCOMPARE(ev.timestamp(), re.timestamp());
QCOMPARE(ev.start(), re.start());
QCOMPARE(ev.end(), re.end());
QCOMPARE(ev.organizer(), re.organizer());
@@ -471,6 +475,7 @@ void BindingsTest::contactCompletness()
Kolab::Contact c;
c.setUid("1045b57d-ff7f-0000-d814-867b4d7f0000");
+ c.setLastModified(Kolab::cDateTime(2006,1,6,12,0,0, true));
c.setCategories(stringlist);
c.setName("name");
Kolab::NameComponents nc;
@@ -574,14 +579,14 @@ void BindingsTest::contactCompletness()
properties.push_back(Kolab::CustomProperty("ident", "value"));
properties.push_back(Kolab::CustomProperty("ident", "value"));
c.setCustomProperties(properties);
-
+
const std::string result = Kolab::writeContact(c);
QVERIFY(Kolab::error() == Kolab::NoError);
// std::cout << result << endl;
Kolab::Contact e = Kolab::readContact(result, false);
QVERIFY(Kolab::error() == Kolab::NoError);
QCOMPARE(e.uid(), c.uid());
- QVERIFY(e.lastModified().isValid());
+ QCOMPARE(e.lastModified(), c.lastModified());
QCOMPARE(e.categories(), c.categories());
QCOMPARE(e.name(), c.name());
QCOMPARE(e.nameComponents(), c.nameComponents());
@@ -641,6 +646,27 @@ void BindingsTest::distlistCompletness()
QCOMPARE(e.customProperties(), c.customProperties());
}
+void BindingsTest::generateTimestampIfEmpty()
+{
+ //xcal
+ Kolab::Event ev;
+ setIncidence(ev);
+ ev.setLastModified(Kolab::cDateTime());
+
+ std::string result = Kolab::writeEvent(ev);
+ Kolab::Event e = Kolab::readEvent(result, false);
+ QVERIFY(e.lastModified().isValid());
+ QVERIFY(e.lastModified().isUTC());
+
+ //xcard
+ Kolab::Contact c;
+ c.setUid("1045b57d-ff7f-0000-d814-867b4d7f0000");
+
+ const std::string contactResult = Kolab::writeContact(c);
+ Kolab::Contact retContact = Kolab::readContact(contactResult, false);
+ QVERIFY(retContact.lastModified().isValid());
+ QVERIFY(retContact.lastModified().isUTC());
+}
void BindingsTest::versionTest()
{
diff --git a/tests/bindingstest.h b/tests/bindingstest.h
index f16c3e6..b5f7ce0 100644
--- a/tests/bindingstest.h
+++ b/tests/bindingstest.h
@@ -35,6 +35,8 @@ class BindingsTest : public QObject
void contactCompletness();
void distlistCompletness();
+ void generateTimestampIfEmpty();
+
void versionTest();
void errorTest();
void errorRecoveryTest();
More information about the commits
mailing list