[cheese] tests: Add test program for the flash object



commit a70d3bd42dd5b81902d6f0ad7e69d8ec77e35a90
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Mar 18 15:02:50 2011 +0000

    tests: Add test program for the flash object

 tests/Makefile.am         |   10 ++++++++--
 tests/cheese-test-flash.c |   29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a3f56c0..263d482 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,7 +13,7 @@ AM_CPPFLAGS = \
 	-I top_srcdir@/libcheese \
 	$(NULL)
 
-EXAMPLES = cheese-test-widget cheese-test-camera cheese-test-monitor cheese-test-chooser
+EXAMPLES = cheese-test-widget cheese-test-camera cheese-test-monitor cheese-test-chooser cheese-test-flash
 
 if HAVE_XTEST
 noinst_PROGRAMS = $(EXAMPLES) test-webcam-button
@@ -25,6 +25,8 @@ cheese_test_widget_SOURCES = cheese-test-widget.c
 cheese_test_camera_SOURCES = cheese-test-camera.c
 cheese_test_monitor_SOURCES = cheese-test-monitor.c
 test_webcam_button_SOURCES = test-webcam-button.c
+cheese_test_flash_SOURCES = cheese-test-flash.c
+cheese_test_chooser_SOURCES = cheese-test-chooser.c
 
 cheese_test_widget_LDADD = $(CHEESE_LIBS) \
 	$(CHEESE_GTK_LIBS) \
@@ -41,9 +43,13 @@ cheese_test_monitor_LDADD = $(CHEESE_LIBS) \
 	$(top_builddir)/libcheese/libcheese-gtk.la \
 	$(NULL)
 test_webcam_button_LDADD = $(XTEST_LIBS)
-cheese_test_chooser_SOURCES = cheese-test-chooser.c
 cheese_test_chooser_LDADD = $(CHEESE_LIBS) \
 	$(CHEESE_GTK_LIBS) \
 	$(top_builddir)/libcheese/libcheese.la \
 	$(top_builddir)/libcheese/libcheese-gtk.la \
 	$(NULL)
+cheese_test_flash_LDADD = $(CHEESE_LIBS) \
+	$(CHEESE_GTK_LIBS) \
+	$(top_builddir)/libcheese/libcheese.la \
+	$(top_builddir)/libcheese/libcheese-gtk.la \
+	$(NULL)
diff --git a/tests/cheese-test-flash.c b/tests/cheese-test-flash.c
new file mode 100644
index 0000000..40aeda2
--- /dev/null
+++ b/tests/cheese-test-flash.c
@@ -0,0 +1,29 @@
+#include <gtk/gtk.h>
+#include "cheese-flash.h"
+
+static void
+button_clicked (GtkButton *button,
+		CheeseFlash *flash)
+{
+	cheese_flash_fire (flash);
+}
+
+int main (int argc, char **argv)
+{
+	GtkWidget *window, *button;
+	CheeseFlash *flash;
+
+	gtk_init (&argc, &argv);
+
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	flash = cheese_flash_new (window);
+	button = gtk_button_new_with_label ("Fire flash");
+	g_signal_connect (G_OBJECT (button), "clicked",
+			  G_CALLBACK (button_clicked), flash);
+	gtk_container_add (GTK_CONTAINER (window), button);
+	gtk_widget_show_all (window);
+
+	gtk_main ();
+
+	return 0;
+}



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