summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2016-03-15 11:11:44 -0300
committerRenato Araujo Oliveira Filho <renato.filho@canonical.com>2016-03-17 14:41:24 +0000
commit98c8af10b75feafaff5b36fe70e0e041a3e79151 (patch)
treec8849508d5f7b149f9ac4f34c5e5b91600ed4b6e /tests
parentde4cfc6b53b426799a035fefe81db9d49d3d03ab (diff)
Populate declarative Item id with the new id after it be created.
We need to update declararive organizer item id with the new id value after creation to make possible to edit or delete it in the future, without need to fetch a new item. Change-Id: I5da7e6fb6a52416b97312a3179f8db3b6d65e3d7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/organizer/qmlorganizer/testcases/tst_organizercollectionfilter.qml10
-rw-r--r--tests/auto/organizer/qmlorganizer/testcases/tst_organizerintersectionfilter.qml11
-rw-r--r--tests/auto/organizer/qmlorganizer/testcases/tst_organizerrecurrence.qml51
-rw-r--r--tests/auto/organizer/qmlorganizer/testcases/tst_organizerunionfilter.qml11
4 files changed, 73 insertions, 10 deletions
diff --git a/tests/auto/organizer/qmlorganizer/testcases/tst_organizercollectionfilter.qml b/tests/auto/organizer/qmlorganizer/testcases/tst_organizercollectionfilter.qml
index 6fa4523b8..c010e549b 100644
--- a/tests/auto/organizer/qmlorganizer/testcases/tst_organizercollectionfilter.qml
+++ b/tests/auto/organizer/qmlorganizer/testcases/tst_organizercollectionfilter.qml
@@ -128,7 +128,15 @@ Rectangle {
utility.waitModelChange(0);
compare(model.itemCount, 0)
- //save event to default collection
+ //save a new event to default collection
+ event = Qt.createQmlObject(
+ "import QtOrganizer 5.0;"
+ + "Event { "
+ + " displayLabel: \"organizer collection filter test event\"; "
+ + " description: \"organizer collection filter test event\"; "
+ + " startDateTime: '2010-12-12'; "
+ + " endDateTime: '2010-12-13'; }"
+ , test);
event.collectionId = model.defaultCollectionId();
model.saveItem(event);
utility.waitModelChange(1);
diff --git a/tests/auto/organizer/qmlorganizer/testcases/tst_organizerintersectionfilter.qml b/tests/auto/organizer/qmlorganizer/testcases/tst_organizerintersectionfilter.qml
index 11f3cbb20..99681ec35 100644
--- a/tests/auto/organizer/qmlorganizer/testcases/tst_organizerintersectionfilter.qml
+++ b/tests/auto/organizer/qmlorganizer/testcases/tst_organizerintersectionfilter.qml
@@ -116,7 +116,16 @@ Rectangle {
utility.waitModelChange(1);
compare(model.itemCount, 1)
- //event with new collection id
+ //new event with new collection id
+ event = Qt.createQmlObject(
+ "import QtOrganizer 5.0;"
+ + "Event { "
+ + " id:event;"
+ + " displayLabel: \"organizer intersection filter test event\"; "
+ + " description: \"organizer intersection filter test event\"; "
+ + " startDateTime: '2010-12-12'; "
+ + " endDateTime: '2010-12-13'; }"
+ , test);
event.collectionId = savedCollection.collectionId;
model.saveItem(event);
utility.waitModelChange(2);
diff --git a/tests/auto/organizer/qmlorganizer/testcases/tst_organizerrecurrence.qml b/tests/auto/organizer/qmlorganizer/testcases/tst_organizerrecurrence.qml
index 021c7f603..95fa0796e 100644
--- a/tests/auto/organizer/qmlorganizer/testcases/tst_organizerrecurrence.qml
+++ b/tests/auto/organizer/qmlorganizer/testcases/tst_organizerrecurrence.qml
@@ -39,6 +39,19 @@ TestCase {
id: test
name: "OrganizerRecurrenceTests"
+ property var testEvent: null
+ property var testTodo: null
+
+ Component {
+ id: eventComponent
+ Event {}
+ }
+
+ Component {
+ id: todoComponent
+ Todo {}
+ }
+
QOrganizerTestUtility {
id: utility
}
@@ -50,14 +63,6 @@ TestCase {
endPeriod:'2014-12-31'
}
- Event {
- id: testEvent
- }
-
- Todo {
- id: testTodo
- }
-
RecurrenceRule {
id: testRule
}
@@ -79,9 +84,25 @@ TestCase {
}
function cleanup() {
+ if (testEvent) {
+ testEvent.destroy()
+ testEvent = null
+ }
+
+ if (testTodo) {
+ testTodo.destroy()
+ testTodo = null
+ }
+
model.manager = ""
}
+ function init()
+ {
+ testEvent = eventComponent.createObject(test)
+ testTodo = todoComponent.createObject(test)
+ }
+
function localDateTime(tsSpec) {
// Parse a ISO8601 time spec and return it as local time; if passed to the Date
// ctor, it will be interpreted as UTC
@@ -711,6 +732,7 @@ TestCase {
model.manager = managers[i];
spyManagerChanged.wait()
cleanDatabase();
+ testEvent = eventComponent.createObject(test)
testRule.frequency = RecurrenceRule.Daily;
testRule.interval = 1;
@@ -737,6 +759,7 @@ TestCase {
model.manager = managers[i];
spyManagerChanged.wait()
cleanDatabase();
+ testEvent = eventComponent.createObject(test)
testRule.frequency = RecurrenceRule.Daily;
testRule.interval = 3;
@@ -832,6 +855,16 @@ TestCase {
spyModelChanged.wait()
}
compare(model.itemIds().length, 0)
+
+ if (testEvent) {
+ testEvent.destroy()
+ testEvent = null
+ }
+
+ if (testTodo) {
+ testTodo.destroy()
+ testTodo = null
+ }
}
function populateTestItemsFromData(data) {
@@ -859,6 +892,8 @@ TestCase {
testXRule.positions = data.xrule.positions;
testXRule.firstDayOfWeek = data.xrule.firstDayOfWeek;
}
+ testEvent = eventComponent.createObject(test)
+ testTodo = todoComponent.createObject(test)
testEvent.startDateTime = new Date(data.definitions.start);
testTodo.startDateTime = new Date(data.definitions.start);
diff --git a/tests/auto/organizer/qmlorganizer/testcases/tst_organizerunionfilter.qml b/tests/auto/organizer/qmlorganizer/testcases/tst_organizerunionfilter.qml
index 96a8e2852..727d2f6ad 100644
--- a/tests/auto/organizer/qmlorganizer/testcases/tst_organizerunionfilter.qml
+++ b/tests/auto/organizer/qmlorganizer/testcases/tst_organizerunionfilter.qml
@@ -114,12 +114,23 @@ Rectangle {
model.saveItem(event);
utility.waitModelChange(1);
compare(model.itemCount, 1)
+ event.destroy()
//event with new collection id
+ event = Qt.createQmlObject(
+ "import QtOrganizer 5.0;"
+ + "Event { "
+ + " id:event;"
+ + " displayLabel: \"organizer union filter test event\"; "
+ + " description: \"organizer union filter test event\"; "
+ + " startDateTime: '2010-12-12'; "
+ + " endDateTime: '2010-12-13'; }"
+ , test);
event.collectionId = savedCollection.collectionId;
model.saveItem(event);
utility.waitModelChange(2);
compare(model.itemCount, 2)
+ event.destroy()
var fetchlist = model.items;
var idEventId;