Client tests: Set XDG_CURRENT_DESKTOP to avoid platform themes

If the client tests are run from within a desktop environment, the
XDG_CURRENT_DESKTOP variable may be set, causing the client to try to
load a platform theme for the user's desktop.

The tests, however, are running against a mock Wayland compositor, so
launching a platform theme that expects to connect to a certain
compositor implementation is probably not a good idea.

And furthermore, if the gtk3 platform theme is used, it will start
binding to interfaces and create wayland objects, confusing our existing
test code.

Setting XDG_CURRENT_DESKTOP to qtwaylandtests will prevent detection of
the (outer) desktop environment, making tests more predictable.

Change-Id: I57fa76e51cecdd0cbe8be6bd075ce67e9d2892bc
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2019-08-28 11:13:55 +02:00
parent 6a51c6eb73
commit 928a81ec13

View File

@ -78,6 +78,7 @@ public:
int main(int argc, char **argv) \
{ \
setenv("XDG_RUNTIME_DIR", ".", 1); \
setenv("XDG_CURRENT_DESKTOP", "qtwaylandtests", 1); \
setenv("QT_QPA_PLATFORM", "wayland", 1); \
test tc; \
QGuiApplication app(argc, argv); \