aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/api
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-10 12:53:45 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-10 12:53:45 +0200
commit0135957c349579d28256d05da342ea79b560bc77 (patch)
tree994bf999196955596245bf3abe1eb4cba069aaaf /tests/auto/api
parent6464a075c5edfafb3a88bfc4097b3d5d9b9cdb28 (diff)
parent349baf79883a96fdd85325a2900997fbf574f9a8 (diff)
Merge 1.12 into master
Diffstat (limited to 'tests/auto/api')
-rw-r--r--tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs18
-rw-r--r--tests/auto/api/tst_api.cpp43
-rw-r--r--tests/auto/api/tst_api.h1
3 files changed, 62 insertions, 0 deletions
diff --git a/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs b/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs
new file mode 100644
index 000000000..cfc2769d2
--- /dev/null
+++ b/tests/auto/api/testdata/dependency-on-multiplexed-type/dependency-on-multiplexed-type.qbs
@@ -0,0 +1,18 @@
+import qbs
+
+Project {
+ Product { name: "dep"; type: "x" }
+ Product {
+ name: "p1"
+ multiplexByQbsProperties: "architectures"
+ qbs.architectures: ["a", "b"]
+ aggregate: true
+ Depends { productTypes: "x" }
+ multiplexedType: "x"
+ }
+ Product {
+ name: "p2"
+ Depends { productTypes: "x" }
+ }
+}
+
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 185a90c56..f7e7b82c9 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -965,6 +965,49 @@ void TestApi::commandExtraction()
QVERIFY(!command.arguments().empty());
}
+void TestApi::dependencyOnMultiplexedType()
+{
+ qbs::SetupProjectParameters setupParams
+ = defaultSetupParameters("/dependency-on-multiplexed-type");
+ std::unique_ptr<qbs::SetupProjectJob> setupJob(qbs::Project().setupProject(setupParams,
+ m_logSink, 0));
+ waitForFinished(setupJob.get());
+ QVERIFY2(!setupJob->error().hasError(), qPrintable(setupJob->error().toString()));
+ qbs::Project project = setupJob->project();
+ qbs::ProjectData projectData = project.projectData();
+ const QList<qbs::ProductData> allProducts = projectData.allProducts();
+ QCOMPARE(allProducts.size(), 5);
+ int depCount = 0;
+ int p1Count = 0;
+ int p2Count = 0;
+ for (const qbs::ProductData &p : allProducts) {
+ if (p.name() == "dep") {
+ ++depCount;
+ QCOMPARE(p.dependencies().size(), 0);
+ } else if (p.name() == "p1") {
+ ++p1Count;
+ if (p.multiplexConfigurationId().isEmpty()) // aggregate
+ QCOMPARE(p.dependencies().size(), 3);
+ else
+ QCOMPARE(p.dependencies().size(), 1);
+ } else {
+ QVERIFY(p.name() == "p2");
+ ++p2Count;
+
+ // FIXME: This is an odd effect of our current algorithm: We collect the products
+ // matching the requested type and add Depends items with their names ("p1" in
+ // this case). Later, the algorithm checking for compatibility regarding the
+ // multiplexing axes picks the aggregate. However, the aggregate does not have
+ // a matching type... It's not entirely clear what the real expected
+ // result should be here.
+ QCOMPARE(p.dependencies().size(), 2);
+ }
+ }
+ std::unique_ptr<qbs::BuildJob> buildJob(project.buildAllProducts(qbs::BuildOptions()));
+ waitForFinished(buildJob.get());
+ QVERIFY2(!buildJob->error().hasError(), qPrintable(buildJob->error().toString()));
+}
+
void TestApi::changeDependentLib()
{
qbs::ErrorInfo errorInfo = doBuildProject("change-dependent-lib");
diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h
index 9207a7328..ff32c8634 100644
--- a/tests/auto/api/tst_api.h
+++ b/tests/auto/api/tst_api.h
@@ -75,6 +75,7 @@ private slots:
void checkOutputs();
void checkOutputs_data();
void commandExtraction();
+ void dependencyOnMultiplexedType();
void disabledInstallGroup();
void disabledProduct();
void disabledProject();