diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-04-22 11:24:08 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-04-22 13:36:48 +0200 |
commit | 638d4f104184fab48c541f8372284576e998a1a3 (patch) | |
tree | e0350c165d612f631b860fae266b7705fa534aee /tests/auto/api | |
parent | 5877328c4dacb1283408083cb3538ea5bc46eae5 (diff) |
Expose in the API whether a product can be run.
The list of target artifacts is typically not yet available after
resolving, but we already know the product type.
Change-Id: I8bf98901b4123197b8d8b9ac4a4b351f251ee987
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/api')
-rw-r--r-- | tests/auto/api/testdata/is-runnable/project.qbs | 10 | ||||
-rw-r--r-- | tests/auto/api/tst_api.cpp | 21 | ||||
-rw-r--r-- | tests/auto/api/tst_api.h | 1 |
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/api/testdata/is-runnable/project.qbs b/tests/auto/api/testdata/is-runnable/project.qbs new file mode 100644 index 000000000..02200fff2 --- /dev/null +++ b/tests/auto/api/testdata/is-runnable/project.qbs @@ -0,0 +1,10 @@ +import qbs + +Project { + CppApplication { + name: "app" + } + DynamicLibrary { + name: "lib" + } +} diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index aaafd49ce..887bd0241 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -504,6 +504,27 @@ void TestApi::installableFiles() QCOMPARE(installableFiles.last().targetFilePath(), QLatin1String("/tmp/dir/file2.txt")); } +void TestApi::isRunnable() +{ + qbs::SetupProjectParameters setupParams = defaultSetupParameters(); + setupParams.setProjectFilePath(QDir::cleanPath(QLatin1String(SRCDIR "/testdata" + "/is-runnable/project.qbs"))); + QScopedPointer<qbs::SetupProjectJob> job(qbs::Project::setupProject(setupParams, + m_logSink, 0)); + waitForFinished(job.data()); + QVERIFY2(!job->error().hasError(), qPrintable(job->error().toString())); + qbs::Project project = job->project(); + const QList<qbs::ProductData> products = project.projectData().products(); + QCOMPARE(products.count(), 2); + foreach (const qbs::ProductData &p, products) { + QVERIFY2(p.name() == "app" || p.name() == "lib", qPrintable(p.name())); + if (p.name() == "app") + QVERIFY(p.isRunnable()); + else + QVERIFY(!p.isRunnable()); + } +} + void TestApi::listBuildSystemFiles() { qbs::SetupProjectParameters setupParams = defaultSetupParameters(); diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h index 6183346ce..f017bd15e 100644 --- a/tests/auto/api/tst_api.h +++ b/tests/auto/api/tst_api.h @@ -54,6 +54,7 @@ private slots: void infiniteLoop(); void infiniteLoop_data(); void installableFiles(); + void isRunnable(); void listBuildSystemFiles(); void nonexistingProjectPropertyFromProduct(); void nonexistingProjectPropertyFromCommandLine(); |