summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/objectvalidation.cpp4
-rw-r--r--tests/validationtest.cpp29
-rw-r--r--tests/validationtest.h1
3 files changed, 33 insertions, 1 deletions
diff --git a/src/objectvalidation.cpp b/src/objectvalidation.cpp
index b451aed..e6a1464 100644
--- a/src/objectvalidation.cpp
+++ b/src/objectvalidation.cpp
@@ -100,7 +100,9 @@ void validate(const Todo& todo)
{
ASSERTVALID(todo.start());
ASSERTVALID(todo.due());
- ASSERTEQUAL(todo.start().timezone(), todo.due().timezone());
+ if (todo.start().isValid() && todo.due().isValid()) {
+ ASSERTEQUAL(todo.start().timezone(), todo.due().timezone());
+ }
}
void validate(const Journal& journal)
diff --git a/tests/validationtest.cpp b/tests/validationtest.cpp
index 97a928e..a1a1c04 100644
--- a/tests/validationtest.cpp
+++ b/tests/validationtest.cpp
@@ -39,6 +39,29 @@ void ValidationTest::testNoErrorOnValidEvent()
QCOMPARE(Kolab::error(), Kolab::NoError);
}
+void ValidationTest::testNoErrorOnValidTodo()
+{
+ {
+ Todo todo;
+ todo.setStart(cDateTime("Europe/Zurich", 2013,1,1,1,1,1));
+ writeTodo(todo);
+ QCOMPARE(Kolab::error(), Kolab::NoError);
+ }
+ {
+ Todo todo;
+ todo.setDue(cDateTime("Europe/Zurich", 2013,1,1,1,1,1));
+ writeTodo(todo);
+ QCOMPARE(Kolab::error(), Kolab::NoError);
+ }
+ {
+ Todo todo;
+ todo.setStart(cDateTime("Europe/Zurich", 2013,1,1,1,1,1));
+ todo.setDue(cDateTime("Europe/Zurich", 2013,1,1,1,1,1));
+ writeTodo(todo);
+ QCOMPARE(Kolab::error(), Kolab::NoError);
+ }
+}
+
void ValidationTest::testOlsonTimezone()
{
Event event;
@@ -54,6 +77,12 @@ void ValidationTest::testDifferentTimezones()
event.setEnd(cDateTime("Europe/London",2013,1,1,1,1,1));
writeEvent(event);
QCOMPARE(Kolab::error(), Kolab::Error);
+
+ Todo todo;
+ todo.setStart(cDateTime("Europe/Zurich",2013,1,1,1,1,1));
+ todo.setDue(cDateTime("Europe/London",2013,1,1,1,1,1));
+ writeTodo(todo);
+ QCOMPARE(Kolab::error(), Kolab::Error);
}
void ValidationTest::testUTCwithTimezone()
diff --git a/tests/validationtest.h b/tests/validationtest.h
index 4751ca0..552fa09 100644
--- a/tests/validationtest.h
+++ b/tests/validationtest.h
@@ -26,6 +26,7 @@ class ValidationTest: public QObject {
private slots:
void testErrorOnEmptyEvent();
void testNoErrorOnValidEvent();
+ void testNoErrorOnValidTodo();
void testOlsonTimezone();
void testDifferentTimezones();
void testUTCwithTimezone();