diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-10-10 17:44:19 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-10-14 14:42:07 +0000 |
commit | 47b575a3b3bf7dc104e1b91babc986577a63ff37 (patch) | |
tree | e6fedd69fab4011a29a32f3cc912fa52d51c1a60 /tests | |
parent | 1e60fab274e722efa01bce67c9acc56627fcc801 (diff) |
Convert null variant values to empty lists
... if their declared type is a list. This is a workaround for
QTBUG-51237.
Change-Id: Ie9e02f5fd125ce73b993e59af0e3dc2b47fe14c1
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/blackbox/testdata/QTBUG-51237/modules/mymodule/mymodule.qbs | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/QTBUG-51237/qtbug-51237.qbs | 22 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 20 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.h | 1 |
4 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/QTBUG-51237/modules/mymodule/mymodule.qbs b/tests/auto/blackbox/testdata/QTBUG-51237/modules/mymodule/mymodule.qbs new file mode 100644 index 000000000..223da0b3c --- /dev/null +++ b/tests/auto/blackbox/testdata/QTBUG-51237/modules/mymodule/mymodule.qbs @@ -0,0 +1,6 @@ +import qbs + +Module { + property stringList theProperty: [] + //property stringList otherProperty: theProperty.concat([]) +} diff --git a/tests/auto/blackbox/testdata/QTBUG-51237/qtbug-51237.qbs b/tests/auto/blackbox/testdata/QTBUG-51237/qtbug-51237.qbs new file mode 100644 index 000000000..e1f8d8ef6 --- /dev/null +++ b/tests/auto/blackbox/testdata/QTBUG-51237/qtbug-51237.qbs @@ -0,0 +1,22 @@ +import qbs + +Product { + type: "custom" + Depends { name: "mymodule" } + Rule { + multiplex: true + Artifact { + filePath: "dummy.custom" + fileTags: ["custom"] + } + prepare: { + var theProperty = product.moduleProperty("mymodule", "theProperty"); + if (!theProperty) + throw "Oh no!"; + var dummy = new JavaScriptCommand(); + dummy.silent = true; + dummy.sourceCode = function() {}; + return [dummy]; + } + } +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 80c3a1f1c..74329abf2 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -2335,6 +2335,26 @@ void TestBlackbox::qobjectInObjectiveCpp() QCOMPARE(runQbs(), 0); } +void TestBlackbox::qtBug51237() +{ + const QString profileName = "profile-qtBug51237"; + const QString propertyName = "mymodule.theProperty"; + { + Settings settings((QString())); + Profile profile(profileName, &settings); + profile.setValue(propertyName, QStringList()); + } + Settings settings((QString())); + qbs::Internal::TemporaryProfile profile(profileName, &settings); + const QVariant propertyValue = profile.p.value(propertyName); + QVERIFY(!propertyValue.isValid()); // QTBUG-51237 + QDir::setCurrent(testDataDir + "/QTBUG-51237"); + QbsRunParameters params; + params.arguments << "profile:" + profileName; + params.useProfile = false; + QCOMPARE(runQbs(params), 0); +} + void TestBlackbox::dynamicMultiplexRule() { const QString testDir = testDataDir + "/dynamicMultiplexRule"; diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 64e3b0770..b5a539bb8 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -199,6 +199,7 @@ private slots: void qbsVersion(); void qmlDebugging(); void qobjectInObjectiveCpp(); + void qtBug51237(); void radAfterIncompleteBuild_data(); void radAfterIncompleteBuild(); void recursiveRenaming(); |