diff options
author | daniel g. siegel <dgsiegel@gnome.org> | 2009-12-03 02:04:06 +0100 |
---|---|---|
committer | daniel g. siegel <dgsiegel@gnome.org> | 2009-12-03 02:04:06 +0100 |
commit | bc0668de6514dd8b01a4aef2f6a03779ebab2bbc (patch) | |
tree | 6ee044c1a5ba1c47820b8115ca1eb2baf7b549be /tests | |
parent | f9413cb5af7d5f5890919f19be61f7e9e6dd5591 (diff) |
move remaining test programs to tests/
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/test-webcam-button.c | 22 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index f354ea8..a8f2533 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,10 +12,11 @@ INCLUDES = \ -I@top_srcdir@/libcheese \ $(NULL) -noinst_PROGRAMS = cheese-test-widget cheese-test-monitor +noinst_PROGRAMS = cheese-test-widget cheese-test-monitor test-webcam-button cheese_test_widget_SOURCES = cheese-test-widget.c cheese_test_monitor_SOURCES = cheese-test-monitor.c +test_webcam_button_SOURCES = test-webcam-button.c cheese_test_widget_LDADD = $(CHEESE_LIBS) \ $(top_builddir)/libcheese/libcheesecommon.la \ @@ -25,3 +26,4 @@ cheese_test_monitor_LDADD = $(CHEESE_LIBS) \ $(top_builddir)/libcheese/libcheesecommon.la \ $(top_builddir)/libcheese/libcheese-gtk.la \ $(NULL) +test_webcam_button_LDADD = -lX11 -lXtst diff --git a/tests/test-webcam-button.c b/tests/test-webcam-button.c new file mode 100644 index 0000000..66768f8 --- /dev/null +++ b/tests/test-webcam-button.c @@ -0,0 +1,22 @@ +/* emit foo webcam button event */ +/* gcc -o test-webcam-button test-webcam-button.c -lX11 -lXtst */ + +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/extensions/XTest.h> +#include <X11/XF86keysym.h> + +int main (void) +{ + Display *dpy; + dpy = XOpenDisplay (NULL); + + printf ("Emitting fake Webcam button press in 2 seconds...\n"); + printf ("Focus Cheese window to make it receive the event\n"); + + XTestFakeKeyEvent (dpy, XKeysymToKeycode(dpy, XF86XK_WebCam), True, 2000); + XTestFakeKeyEvent (dpy, XKeysymToKeycode(dpy, XF86XK_WebCam), False, CurrentTime); + + XCloseDisplay (dpy); + return 0; +} |