diff options
author | Bastien Nocera <hadess@hadess.net> | 2009-12-03 16:23:27 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2009-12-03 16:23:27 +0000 |
commit | 0c5bb50ed6814a4d73414815062640ba0e1e752b (patch) | |
tree | 167473f2aa16234eef6e4b357fe22eac25dc8f35 | |
parent | db2d21c3f169fcc3af43b7949f12181a5a945491 (diff) | |
download | cheese-0c5bb50ed6814a4d73414815062640ba0e1e752b.tar.gz |
Add test program for chooser widget
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/cheese-test-chooser.c | 48 |
2 files changed, 54 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index a8f2533e..a7915613 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 00000000..a7a877b8 --- /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; +} |