Fix the X11TimestampUpdateTest

Summary:
It also searches for the platform plugin, so we need to ensure it finds
it in the build directory.

This was a regression caused by building all platform plugins in the
correct location.

Test Plan: strace on the failing test, verified correct plugin is loaded

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17573
This commit is contained in:
Martin Flöser 2018-12-14 06:54:15 +01:00
parent a0fe38c9b3
commit c3e712e967

View file

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QTest>
#include <QX11Info>
#include <KPluginLoader>
#include <KPluginMetaData>
#include "main.h"
@ -46,7 +47,20 @@ X11TestApplication::X11TestApplication(int &argc, char **argv)
{
setX11Connection(QX11Info::connection());
setX11RootWindow(QX11Info::appRootWindow());
initPlatform(KPluginMetaData(QStringLiteral("KWinX11Platform.so")));
// move directory containing executable to front, so that KPluginLoader prefers the plugins in
// the build dir over system installed ones
const auto ownPath = libraryPaths().last();
removeLibraryPath(ownPath);
addLibraryPath(ownPath);
const auto plugins = KPluginLoader::findPluginsById(QStringLiteral("org.kde.kwin.platforms"),
QStringLiteral("KWinX11Platform"));
if (plugins.empty()) {
quit();
return;
}
initPlatform(plugins.first());
}
X11TestApplication::~X11TestApplication()