diff ui/tests/cinstprocesstest.cpp @ 294:d95fd88f6616

Prepare cinstprocesstest to be executed on Windows
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 02 Apr 2014 15:41:31 +0000
parents 6a7eb102716d
children 02df89a275a6
line wrap: on
line diff
--- a/ui/tests/cinstprocesstest.cpp	Wed Apr 02 15:40:39 2014 +0000
+++ b/ui/tests/cinstprocesstest.cpp	Wed Apr 02 15:41:31 2014 +0000
@@ -7,11 +7,24 @@
 #include <QFile>
 #include <QProcess>
 
-#define RELATIVE_CINST_PATH "../../cinst/cinst"
+#define CINST_PATH_CANDIDATES "../../cinst/cinst" << \
+    "cinst" << "../../cinst/cinst.exe" << "cinst.exe";
 
-QProcess *CinstProcessTest::startCinstProcess() {
+QProcess *CinstProcessTest::startCinstProcess(const QStringList& args) {
+    QStringList cinstCandidates;
+    cinstCandidates << CINST_PATH_CANDIDATES;
+    QString processPath;
+    foreach (const QString& candidate, cinstCandidates) {
+        QFileInfo fi(candidate);
+        if (fi.isExecutable()) {
+            processPath = candidate;
+            break;
+        }
+    }
+
     QProcess *installerProcess = new QProcess();
-    installerProcess->setProgram(RELATIVE_CINST_PATH);
+    installerProcess->setArguments(args);
+    installerProcess->setProgram(processPath);
     installerProcess->start();
     installerProcess->waitForStarted();
     return installerProcess;

http://wald.intevation.org/projects/trustbridge/