diff options
author | Marja Hassinen <ext-marja.2.hassinen@nokia.com> | 2009-10-27 10:18:18 +0200 |
---|---|---|
committer | Marja Hassinen <ext-marja.2.hassinen@nokia.com> | 2009-10-27 10:18:18 +0200 |
commit | 1b73134759744742b67d58b0edfed29b6bd613ef (patch) | |
tree | e8eef6a2c020989db058b69743afaa4973dfa461 | |
parent | 5af1ac3721920df6bdeccd030fa0c145236a1a92 (diff) |
libcontextprovider, updating customer tests: Updating the tests with the new assumptions
(Properties keep their value if you delete them and create them again.)
4 files changed, 22 insertions, 21 deletions
diff --git a/libcontextprovider/customer-tests/service/servicetest.cpp b/libcontextprovider/customer-tests/service/servicetest.cpp index 1fe148d3..534674f5 100644 --- a/libcontextprovider/customer-tests/service/servicetest.cpp +++ b/libcontextprovider/customer-tests/service/servicetest.cpp @@ -106,6 +106,8 @@ void ServiceTests::startStopStart() expected = "Subscribe returned: Unknown"; QCOMPARE(actual.simplified(), expected.simplified()); + delete service; + delete property; } void ServiceTests::readStandardOutput() diff --git a/libcontextprovider/customer-tests/subscription/subscriptiontests.cpp b/libcontextprovider/customer-tests/subscription/subscriptiontests.cpp index 3f0f91c7..1e0737df 100644 --- a/libcontextprovider/customer-tests/subscription/subscriptiontests.cpp +++ b/libcontextprovider/customer-tests/subscription/subscriptiontests.cpp @@ -56,8 +56,12 @@ void SubscriptionTests::init() test_string = new Property (*service2, "Test.String"); test_bool = new Property(*service2, "Test.Bool"); - // Process the events so that the services get started - QCoreApplication::processEvents(QEventLoop::AllEvents); + // Nullify the values (we create the same Properties over and + // over, and they will keep their old values. + test_int->unsetValue(); + test_double->unsetValue(); + test_string->unsetValue(); + test_bool->unsetValue(); // Initialize test program state isReadyToRead = false; @@ -86,7 +90,6 @@ void SubscriptionTests::cleanup() } delete client; client = NULL; - // Note: we need to delete the properties before deleting the service delete test_int; test_int = NULL; delete test_double; test_double = NULL; delete test_bool; test_bool = NULL; @@ -94,10 +97,6 @@ void SubscriptionTests::cleanup() delete service1; service1 = NULL; delete service2; service2 = NULL; - - // ServiceBackedns are deleted in a deferred way, thus we need to - // get them deleted - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); } void SubscriptionTests::subscribeReturnValueForUnknownProperty() diff --git a/libcontextprovider/customer-tests/types/typestests.cpp b/libcontextprovider/customer-tests/types/typestests.cpp index 76e77b1b..aad31142 100644 --- a/libcontextprovider/customer-tests/types/typestests.cpp +++ b/libcontextprovider/customer-tests/types/typestests.cpp @@ -55,8 +55,16 @@ void TypesTests::init() dateItem = new Property(*service, "Test.Date"); timeItem = new Property (*service, "Test.Time"); - // Process the events so that the service gets started - QCoreApplication::processEvents(QEventLoop::AllEvents); + // Nullify the values (we create the same Properties over and + // over, and they will keep their old values. + intItem->unsetValue(); + stringItem->unsetValue(); + boolItem->unsetValue(); + doubleItem->unsetValue(); + stringListItem->unsetValue(); + charItem->unsetValue(); + dateItem->unsetValue(); + timeItem->unsetValue(); // Initialize test program state isReadyToRead = false; @@ -84,8 +92,6 @@ void TypesTests::cleanup() } delete client; client = NULL; - // Note: we need to delete the properties before deleting the - // service delete intItem; intItem = NULL; delete doubleItem; doubleItem = NULL; delete boolItem; boolItem = NULL; @@ -96,10 +102,6 @@ void TypesTests::cleanup() delete dateItem; dateItem = NULL; delete service; service = NULL; - - // PropertyPrivate and ServiceBackend object are deleted in a - // deferred way, thus we need to get them deleted - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); } void TypesTests::typesInReturnValueOfSubscribe() diff --git a/libcontextprovider/customer-tests/value-changes/valuechangestests.cpp b/libcontextprovider/customer-tests/value-changes/valuechangestests.cpp index 62b3db11..f5da63e6 100644 --- a/libcontextprovider/customer-tests/value-changes/valuechangestests.cpp +++ b/libcontextprovider/customer-tests/value-changes/valuechangestests.cpp @@ -53,8 +53,10 @@ void ValueChangesTests::init() test_int = new Property(*service, "Test.Int"); test_double = new Property(*service, "Test.Double"); - // Process the events so that the services get started - QCoreApplication::processEvents(QEventLoop::AllEvents); + // Nullify the values (we create the same Properties over and + // over, and they will keep their old values. + test_int->unsetValue(); + test_double->unsetValue(); // Initialize test program state isReadyToRead = false; @@ -82,15 +84,11 @@ void ValueChangesTests::cleanup() } delete client; client = NULL; - // Note: we need to delete the properties before deleting the service delete test_int; test_int = NULL; delete test_double; test_double = NULL; delete service; service = NULL; - // PropertyPrivate and ServiceBackend objects are deleted in a - // deferred way, thus we need to get them deleted - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); } void ValueChangesTests::subscribedPropertyChanges() |