[Xfce4-commits] <xfce4-clipman-plugin:master> [tests] Add daemon test program

Mike Massonnet noreply at xfce.org
Sun Nov 15 16:04:02 CET 2009


Updating branch refs/heads/master
         to c3192a6ff4bd40985741d9b1daf550d86ec3d9c5 (commit)
       from 7bd9d78433c372b529b462c660eb0c400db34bc2 (commit)

commit c3192a6ff4bd40985741d9b1daf550d86ec3d9c5
Author: Mike Massonnet <mmassonnet at gmail.com>
Date:   Sat Nov 7 14:16:48 2009 +0100

    [tests] Add daemon test program
    
    New test program for the daemon. The targets test program has a command
    line flag to switch between the selections and the default clipboard.

 tests/Makefile.am    |    5 ++++-
 tests/test_daemon.c  |   18 ++++++++++++++++++
 tests/test_targets.c |    5 ++++-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7648648..4a27567 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,10 +10,13 @@ INCLUDES =								\
 	-DLOCALEDIR=\"$(localedir)\"					\
 	$(NULL)
 
-noinst_PROGRAMS = test-actions test-targets
+noinst_PROGRAMS = test-actions test-daemon test-targets
 test_actions_SOURCES = test_actions.c ../panel-plugin/actions.c ../panel-plugin/actions.h ../panel-plugin/common.h
 test_actions_CFLAGS = @GTK_CFLAGS@ @EXO_CFLAGS@ @LIBXFCE4UTIL_CFLAGS@ @LIBXFCEGUI4_CFLAGS@
 test_actions_LDADD = @GTK_LIBS@ @EXO_LIBS@ @LIBXFCE4UTIL_LIBS@ @LIBXFCEGUI4_LIBS@ 
+test_daemon_SOURCES = test_daemon.c
+test_daemon_CFLAGS = @GTK_CFLAGS@
+test_daemon_LDADD = $(top_builddir)/daemon/libdaemon.la @GTK_LIBS@
 test_targets_SOURCES = test_targets.c
 test_targets_CFLAGS = @GTK_CFLAGS@
 test_targets_LDADD = @GTK_LIBS@
diff --git a/tests/test_daemon.c b/tests/test_daemon.c
new file mode 100644
index 0000000..0f2bd0c
--- /dev/null
+++ b/tests/test_daemon.c
@@ -0,0 +1,18 @@
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <daemon/daemon.h>
+
+int main (int argc, char *argv[])
+{
+  GsdClipboardManager *daemon;
+
+  gtk_init (&argc, &argv);
+
+  daemon = gsd_clipboard_manager_new ();
+  gsd_clipboard_manager_start (daemon, NULL);
+
+  gtk_main ();
+
+  return 0;
+}
+
diff --git a/tests/test_targets.c b/tests/test_targets.c
index 133b028..7f9f47b 100644
--- a/tests/test_targets.c
+++ b/tests/test_targets.c
@@ -30,7 +30,10 @@ int main (int argc, char *argv[])
 
   gtk_init (&argc, &argv);
 
-  clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  if (argc > 1 && !g_strcmp0 (argv[1], "-s"))
+    clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+  else
+    clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
   g_signal_connect (clipboard, "owner-change", G_CALLBACK (cb), NULL);
 
   gtk_main ();



More information about the Xfce4-commits mailing list