summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <arichardson.kde@gmail.com>2015-08-14 16:05:09 (GMT)
committerAlex Richardson <arichardson.kde@gmail.com>2015-08-15 18:28:06 (GMT)
commit771fb0de56250ff9171c110d986b6c97d5909725 (patch)
treeecca4646eabaa9ae5ad01c9e2ad00bf0e11ef280
parent22b6d4551de18367e0c390f1051ba9b9edc42a77 (diff)
Make sure we run the okular executable from the build directory
-rw-r--r--autotests/CMakeLists.txt1
-rw-r--r--autotests/mainshelltest.cpp24
2 files changed, 14 insertions, 11 deletions
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 31f9986..96a8dce 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -62,6 +62,7 @@ ecm_add_test(mainshelltest.cpp ../shell/okular_main.cpp ../shell/shellutils.cpp
TEST_NAME "mainshelltest"
LINK_LIBRARIES Qt5::Test KF5::Activities okularpart okularcore
)
+target_compile_definitions(mainshelltest PRIVATE OKULAR_BINARY="$<TARGET_FILE:okular>")
ecm_add_test(generatorstest.cpp
TEST_NAME "generatorstest"
diff --git a/autotests/mainshelltest.cpp b/autotests/mainshelltest.cpp
index f050d39..232705f 100644
--- a/autotests/mainshelltest.cpp
+++ b/autotests/mainshelltest.cpp
@@ -286,16 +286,17 @@ void MainShellTest::testShell()
Okular::Part *part = s->findChild<Okular::Part*>();
QProcess p;
- QString command = "okular " + externalProcessPath;
+ QStringList args;
+ args << externalProcessPath;
if (unique)
- command += " -unique";
+ args << "-unique";
if (externalProcessExpectedPage != 0)
- command += QString(" -page %1").arg(externalProcessExpectedPage + 1);
+ args << QStringLiteral("-page") << QString::number(externalProcessExpectedPage + 1);
if (externalProcessExpectPresentation)
- command += QString(" -presentation");
+ args << QStringLiteral("-presentation");
if (externalProcessExpectPrintDialog)
- command += QString(" -print");
- p.start(command);
+ args << QStringLiteral("-print");
+ p.start(OKULAR_BINARY, args);
p.waitForStarted();
QCOMPARE(p.state(), QProcess::Running);
@@ -438,10 +439,11 @@ void MainShellTest::testFileRemembersPagePosition()
else
{
QProcess p;
- QString command = "okular " + paths[0] ;
+ QStringList args;
+ args << paths[0];
if (mode == 2)
- command += " -unique";
- p.start(command);
+ args << "-unique";
+ p.start(OKULAR_BINARY, args);
p.waitForStarted();
QCOMPARE(p.state(), QProcess::Running);
@@ -449,8 +451,8 @@ void MainShellTest::testFileRemembersPagePosition()
for (int i = 0; p.state() != QProcess::NotRunning && i < 20; ++i) {
QTest::qWait(100);
}
- QCOMPARE(p.state(), QProcess::NotRunning);
- QCOMPARE(p.exitStatus(), QProcess::NormalExit);
+ QCOMPARE((int)p.state(), (int)QProcess::NotRunning);
+ QCOMPARE((int)p.exitStatus(), (int)QProcess::NormalExit);
QCOMPARE(p.exitCode(), 0);
}
s = findShell();