From 5c01bb69986801bd717639a2612bf48c5701ebb3 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 26 Feb 2014 21:13:52 -0500 Subject: 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 --- .../testdata/jsextensions/propertylist.qbs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests') 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, -- cgit v1.2.3