Commit 771fb0de authored by Alex Richardson's avatar Alex Richardson
Browse files

Make sure we run the okular executable from the build directory

parent 22b6d455
......@@ -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"
......
......@@ -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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment