aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2014-02-26 21:13:52 -0500
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-02-28 12:36:33 +0100
commit5c01bb69986801bd717639a2612bf48c5701ebb3 (patch)
tree400beb7d8f48fe77049be1372c1edeaac94f7ba6 /tests
parent4de0b752405ac287e42f05b7f9bc3f99432a83fa (diff)
Introduce PropertyList functions isEmpty and clear.
These functions test whether the PropertyList object has any data loaded, and clears any existing data from the object, respectively. Change-Id: I9dfa0e7629dccd3090fc0d5de33481c8e7caf424 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata/jsextensions/propertylist.qbs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/jsextensions/propertylist.qbs b/tests/auto/blackbox/testdata/jsextensions/propertylist.qbs
index cdd1c1af3..5b80eeafb 100644
--- a/tests/auto/blackbox/testdata/jsextensions/propertylist.qbs
+++ b/tests/auto/blackbox/testdata/jsextensions/propertylist.qbs
@@ -5,6 +5,32 @@ import qbs.TextFile
Product {
type: {
+ var plistobj = new PropertyList();
+ if (!plistobj.isEmpty()) {
+ throw "newly created PropertyList was not empty!";
+ }
+
+ if (plistobj.format() !== undefined) {
+ throw "newly created PropertyList did not have an undefined format";
+ }
+
+ plistobj.clear();
+
+ if (!plistobj.isEmpty() || plistobj.format() !== undefined) {
+ throw "clear() somehow had an effect on an empty PropertyList";
+ }
+
+ plistobj.readFromString('{"key":["value"]}');
+ if (plistobj.isEmpty() || plistobj.format() !== "json") {
+ throw "readFromString did not set format to JSON or object thinks it is empty";
+ }
+
+ plistobj.clear();
+
+ if (!plistobj.isEmpty() || plistobj.format() !== undefined) {
+ throw "clear() had no effect on a non-empty PropertyList";
+ }
+
var obj = {
"Array": ["ListItem1", "ListItem2", "ListItem3"],
"Integer": 1,