Make unittest independent from the location of the executable.

Summary:
This fixes the check in the unittest when doing
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
which I intend to do globally at some point.

Turns out it's comparing with its own executable location, so we
can use QCoreApplication to get it generically.

Test Plan: Verified to work with ctest and with "./testWaylandServerDisplay"

Reviewers: graesslin, mart

Reviewed By: graesslin, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6974
This commit is contained in:
David Faure 2017-07-29 08:40:11 +02:00
parent 0c42a1bfeb
commit cac7d766b1
2 changed files with 1 additions and 2 deletions

View file

@ -1,7 +1,6 @@
########################################################
# Test WaylandServerDisplay
########################################################
add_definitions(-DAUTOTEST_CURRENT_BIN_DIR="${CMAKE_CURRENT_BINARY_DIR}")
set( testWaylandServerDisplay_SRCS
test_display.cpp
)

View file

@ -143,7 +143,7 @@ void TestWaylandServerDisplay::testClientConnection()
QVERIFY(connection->groupId() != 0);
QVERIFY(connection->processId() != 0);
QCOMPARE(connection->display(), &display);
QCOMPARE(connection->executablePath(), QStringLiteral("%1/testWaylandServerDisplay").arg(AUTOTEST_CURRENT_BIN_DIR));
QCOMPARE(connection->executablePath(), QCoreApplication::applicationFilePath());
QCOMPARE((wl_client*)*connection, client);
const ClientConnection &constRef = *connection;
QCOMPARE((wl_client*)constRef, client);