aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2018-06-05 12:31:00 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2018-06-06 08:02:04 +0000
commitfadb41e330d92c03633c9a596eeb9ff125227426 (patch)
tree64b16c951cba82a185a9534289de2f034ea6d44b /tests
parent0af8d1b7870d44e4a024669cae28593173687de1 (diff)
Fix property values that are pure assignments of imports
Those were broken, because QScriptValue::toVariant() doesn't take QScriptValue::prototype() into account, which we set for imports. Change-Id: I571f7a4b63df08b1768f61bcc1d622f3730c2a73 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata/import-assignment/import-assignment.qbs23
-rw-r--r--tests/auto/blackbox/testdata/import-assignment/imports/MyImport/myimport.js2
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp8
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
4 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/import-assignment/import-assignment.qbs b/tests/auto/blackbox/testdata/import-assignment/import-assignment.qbs
new file mode 100644
index 000000000..2bff00f35
--- /dev/null
+++ b/tests/auto/blackbox/testdata/import-assignment/import-assignment.qbs
@@ -0,0 +1,23 @@
+import qbs
+import MyImport
+
+Product {
+ type: "outtype"
+ property var importValue: MyImport
+ Rule {
+ multiplex: true
+ Artifact {
+ fileTags: "outtype"
+ filePath: "dummy"
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand;
+ cmd.silent = true;
+ cmd.sourceCode = function() {
+ console.info("key 1 = " + product.importValue.key1);
+ console.info("key 2 = " + product.importValue.key2);
+ };
+ return cmd;
+ }
+ }
+}
diff --git a/tests/auto/blackbox/testdata/import-assignment/imports/MyImport/myimport.js b/tests/auto/blackbox/testdata/import-assignment/imports/MyImport/myimport.js
new file mode 100644
index 000000000..5befd5151
--- /dev/null
+++ b/tests/auto/blackbox/testdata/import-assignment/imports/MyImport/myimport.js
@@ -0,0 +1,2 @@
+var key1 = "value1";
+var key2 = "value2";
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 3293c09de..0c3f8b1bc 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -6180,6 +6180,14 @@ void TestBlackbox::ico()
}
}
+void TestBlackbox::importAssignment()
+{
+ QDir::setCurrent(testDataDir + "/import-assignment");
+ QCOMPARE(runQbs(QStringList("project.qbsSearchPaths:" + QDir::currentPath())), 0);
+ QVERIFY2(m_qbsStdout.contains("key 1 = value1") && m_qbsStdout.contains("key 2 = value2"),
+ m_qbsStdout.constData());
+}
+
void TestBlackbox::importChangeTracking()
{
QDir::setCurrent(testDataDir + "/import-change-tracking");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index e81551b26..70a950a84 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -115,6 +115,7 @@ private slots:
void generator_data();
void groupsInModules();
void ico();
+ void importAssignment();
void importChangeTracking();
void importInPropertiesCondition();
void importSearchPath();