[cheese] Add test program for chooser widget



commit 0c5bb50ed6814a4d73414815062640ba0e1e752b
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 3 16:23:27 2009 +0000

    Add test program for chooser widget

 tests/Makefile.am           |    7 +++++-
 tests/cheese-test-chooser.c |   48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a8f2533..a791561 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,7 +12,7 @@ INCLUDES = \
 	-I top_srcdir@/libcheese \
 	$(NULL)
 
-noinst_PROGRAMS = cheese-test-widget cheese-test-monitor test-webcam-button
+noinst_PROGRAMS = cheese-test-widget cheese-test-monitor test-webcam-button cheese-test-chooser
 
 cheese_test_widget_SOURCES = cheese-test-widget.c
 cheese_test_monitor_SOURCES = cheese-test-monitor.c
@@ -27,3 +27,8 @@ cheese_test_monitor_LDADD = $(CHEESE_LIBS) \
 	$(top_builddir)/libcheese/libcheese-gtk.la \
 	$(NULL)
 test_webcam_button_LDADD = -lX11 -lXtst
+cheese_test_chooser_SOURCES = cheese-test-chooser.c
+cheese_test_chooser_LDADD = $(CHEESE_LIBS) \
+	$(top_builddir)/libcheese/libcheesecommon.la \
+	$(top_builddir)/libcheese/libcheese-gtk.la \
+	$(NULL)
diff --git a/tests/cheese-test-chooser.c b/tests/cheese-test-chooser.c
new file mode 100644
index 0000000..a7a877b
--- /dev/null
+++ b/tests/cheese-test-chooser.c
@@ -0,0 +1,48 @@
+
+#include "cheese-config.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gst/gst.h>
+#include "cheese-avatar-chooser.h"
+
+static void
+response_cb (GtkDialog *dialog,
+	     int response,
+	     CheeseAvatarChooser *chooser)
+{
+	if (response == GTK_RESPONSE_ACCEPT) {
+		GdkPixbuf *pixbuf;
+		g_message ("got pixbuf captured");
+		g_object_get (G_OBJECT (chooser), "pixbuf", &pixbuf, NULL);
+	}
+
+	gtk_main_quit ();
+}
+
+int main (int argc, char **argv)
+{
+	GtkWidget *window;
+
+	g_thread_init (NULL);
+	gdk_threads_init ();
+	gst_init (&argc, &argv);
+
+	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+	textdomain (GETTEXT_PACKAGE);
+
+	gtk_init (&argc, &argv);
+
+	window = cheese_avatar_chooser_new ();
+	g_signal_connect (G_OBJECT (window), "response",
+			  G_CALLBACK (response_cb), window);
+
+	gtk_widget_show_all (window);
+
+	gtk_main ();
+
+	gtk_widget_destroy (window);
+
+	return 0;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]