From 8f0f84d2b354cd7e276aa3a6f26d782ccd43850c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sun, 24 Sep 2017 14:51:35 +0200 Subject: [PATCH] [autotests] Try to detect whether distro calls cursor theme DMZ-White or Vanilla-DMZ Some distributions (e.g. Arch, FreeBSD) call the DMZ-White cursor theme Vanilla-DMZ. Due to that our tests are failing even if the correct theme is installed (see also T6623). This change tries to detect whether DMZ-White is installed by looking into the GenericDataLocation. If not found we set to Vanilla-DMZ. No guarantee that the check works for all setups, but it's only tests... --- autotests/integration/pointer_input.cpp | 7 ++++++- autotests/integration/scene_qpainter_test.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index 1fb5d04a20..d308dae93c 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -97,7 +97,12 @@ void PointerInputTest::initTestCase() kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig)); - qputenv("XCURSOR_THEME", QByteArrayLiteral("DMZ-White")); + if (!QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("icons/DMZ-White/index.theme")).isEmpty()) { + qputenv("XCURSOR_THEME", QByteArrayLiteral("DMZ-White")); + } else { + // might be vanilla-dmz (e.g. Arch, FreeBSD) + qputenv("XCURSOR_THEME", QByteArrayLiteral("Vanilla-DMZ")); + } qputenv("XCURSOR_SIZE", QByteArrayLiteral("24")); qputenv("XKB_DEFAULT_RULES", "evdev"); diff --git a/autotests/integration/scene_qpainter_test.cpp b/autotests/integration/scene_qpainter_test.cpp index a928cc5356..dd2c40c9da 100644 --- a/autotests/integration/scene_qpainter_test.cpp +++ b/autotests/integration/scene_qpainter_test.cpp @@ -88,7 +88,12 @@ void SceneQPainterTest::initTestCase() config->sync(); kwinApp()->setConfig(config); - qputenv("XCURSOR_THEME", QByteArrayLiteral("DMZ-White")); + if (!QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("icons/DMZ-White/index.theme")).isEmpty()) { + qputenv("XCURSOR_THEME", QByteArrayLiteral("DMZ-White")); + } else { + // might be vanilla-dmz (e.g. Arch, FreeBSD) + qputenv("XCURSOR_THEME", QByteArrayLiteral("Vanilla-DMZ")); + } qputenv("XCURSOR_SIZE", QByteArrayLiteral("24")); qputenv("KWIN_COMPOSE", QByteArrayLiteral("Q"));