summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2018-03-21 14:16:58 +0100
committerBastien Nocera <hadess@hadess.net>2018-05-03 17:41:22 +0200
commit5bc16fda30ee05142cc86b0ab8d71b185ed8afed (patch)
tree4e85ff8a5d8833a9926dc3966c911844a98b426b /tests
parent06eb39d087d722dd274c9954485cfb404c1c992f (diff)
downloadgnome-settings-daemon-5bc16fda30ee05142cc86b0ab8d71b185ed8afed.tar.gz
tests: Use Mutter's new D-Bus interface to reset idletime
Rather than poke through using XTest, use Mutter's new D-Bus API to do as if the user pressed a key on a keyboard. See https://bugzilla.gnome.org/show_bug.cgi?id=705942 https://bugzilla.gnome.org/show_bug.cgi?id=794563
Diffstat (limited to 'tests')
-rw-r--r--tests/gsdtestcase.py6
-rw-r--r--tests/meson.build11
-rw-r--r--tests/shiftkey.c57
3 files changed, 5 insertions, 69 deletions
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py
index ffb4a2b4..fb821d38 100644
--- a/tests/gsdtestcase.py
+++ b/tests/gsdtestcase.py
@@ -184,6 +184,7 @@ class GSDTestCase(X11SessionTestCase):
def start_mutter(klass):
''' start mutter '''
+ os.environ['MUTTER_DEBUG_RESET_IDLETIME']='1'
klass.mutter_log = open(os.path.join(klass.workdir, 'mutter.log'), 'wb', buffering=0)
# See https://gitlab.gnome.org/GNOME/mutter/merge_requests/15
klass.mutter = subprocess.Popen(['mutter', '--x11'],
@@ -204,4 +205,7 @@ class GSDTestCase(X11SessionTestCase):
def reset_idle_timer(klass):
'''trigger activity to reset idle timer'''
- subprocess.check_call([os.path.join(top_builddir, 'tests', 'shiftkey')])
+ obj_mutter_idlemonitor = klass.session_bus_con.get_object(
+ 'org.gnome.Mutter.IdleMonitor', '/org/gnome/Mutter/IdleMonitor/Core')
+
+ obj_mutter_idlemonitor.ResetIdletime(dbus_interface='org.gnome.Mutter.IdleMonitor')
diff --git a/tests/meson.build b/tests/meson.build
deleted file mode 100644
index 1c29c48e..00000000
--- a/tests/meson.build
+++ /dev/null
@@ -1,11 +0,0 @@
-deps = [
- x11_dep,
- xtst_dep
-]
-
-exe = executable(
- 'shiftkey',
- 'shiftkey.c',
- include_directories: top_inc,
- dependencies: deps
-)
diff --git a/tests/shiftkey.c b/tests/shiftkey.c
deleted file mode 100644
index cd5a1c8e..00000000
--- a/tests/shiftkey.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Test helper program to send a "left shift key" event via XTest, to reset the
- * idle timer.
- *
- * Copyright (C) 2013 Canonical Ltd.
- * Author: Martin Pitt <martin.pitt@ubuntu.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#include <X11/extensions/XTest.h>
-#include <X11/keysym.h>
-
-int
-main()
-{
- Display *display = NULL;
- int event_base, error_base, major_version, minor_version;
- KeyCode keycode;
-
- display = XOpenDisplay (NULL);
-
- if (display == NULL) {
- fputs ("Error: Cannot open display\n", stderr);
- return 1;
- }
-
- if (!XTestQueryExtension (display, &event_base, &error_base, &major_version, &minor_version)) {
- fputs ("Error: No XTest extension\n", stderr);
- return 1;
- }
-
- /* send a left shift key; first press, then release */
- keycode = XKeysymToKeycode (display, XK_Shift_L);
- XTestFakeKeyEvent (display, keycode, True, 0);
- XTestFakeKeyEvent (display, keycode, False, 0);
-
- XCloseDisplay (display);
- return 0;
-}