[cheese] Split tests for libcheese and libcheese-gtk
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Split tests for libcheese and libcheese-gtk
- Date: Tue, 13 Dec 2011 22:17:01 +0000 (UTC)
commit 4f1af6e070ed9d6b06b2f9f2bc6ef78ffac84ed8
Author: David King <amigadave amigadave com>
Date: Tue Dec 13 20:55:14 2011 +0100
Split tests for libcheese and libcheese-gtk
.gitignore | 3 +-
Makefile.am | 20 +++++--
tests/{test-widgets.c => test-libcheese-gtk.c} | 42 +-------------
tests/test-libcheese.c | 71 ++++++++++++++++++++++++
4 files changed, 90 insertions(+), 46 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e6b5dbd..cde7e86 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,8 +54,9 @@ Makefile.in*
/tests/cheese-test-chooser
/tests/cheese-test-camera
/tests/cheese-test-flash
+/tests/test-libcheese
+/tests/test-libcheese-gtk
/tests/test-webcam-button
-/tests/test-widgets
/aclocal.m4
/Cheese-*.gir
/Cheese-*.typelib
diff --git a/Makefile.am b/Makefile.am
index fa6e782..54af9e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -369,17 +369,27 @@ dist_pixmaps_DATA = \
data/pixmaps/cheese-3.svg
# Tests.
-check_PROGRAMS = tests/test-widgets
-tests_test_widgets_SOURCES = \
+check_PROGRAMS = \
+ tests/test-libcheese \
+ tests/test-libcheese-gtk
+
+tests_test_libcheese_gtk_SOURCES = \
libcheese/um-crop-area.c \
- tests/test-widgets.c
-tests_test_widgets_CPPFLAGS = $(EXAMPLES_CPPFLAGS)
-tests_test_widgets_LDADD = \
+ tests/test-libcheese-gtk.c
+tests_test_libcheese_gtk_CPPFLAGS = $(EXAMPLES_CPPFLAGS)
+tests_test_libcheese_gtk_LDADD = \
$(CHEESE_LIBS) \
$(CHEESE_GTK_LIBS) \
libcheese-gtk.la \
libcheese.la
+tests_test_libcheese_SOURCES = \
+ tests/test-libcheese.c
+tests_test_libcheese_CPPFLAGS = $(EXAMPLES_CPPFLAGS)
+tests_test_libcheese_LDADD = \
+ $(CHEESE_LIBS) \
+ libcheese.la
+
if CHEESE_ENABLE_TESTS
# test: run all tests.
test: $(check_PROGRAMS)
diff --git a/tests/test-widgets.c b/tests/test-libcheese-gtk.c
similarity index 67%
rename from tests/test-widgets.c
rename to tests/test-libcheese-gtk.c
index b02c0cf..6228b5c 100644
--- a/tests/test-widgets.c
+++ b/tests/test-libcheese-gtk.c
@@ -25,7 +25,6 @@
#include <clutter-gtk/clutter-gtk.h>
#include "cheese-avatar-chooser.h"
#include "cheese-widget.h"
-#include "cheese-fileutil.h"
#include "um-crop-area.h"
/* Test widget instantiation. */
@@ -50,42 +49,6 @@ static void test_widget ()
g_assert (GTK_IS_BUTTON (select_button));
}
-/* Test CheeseFileUtil */
-static void test_file_utils ()
-{
- CheeseFileUtil *file_util;
- gchar *first_path, *second_path, *third_path, *stub;
- gchar *real_second, *real_third;
- gchar **split;
-
- file_util = cheese_fileutil_new ();
- g_assert (file_util != NULL);
-
- first_path = cheese_fileutil_get_new_media_filename (file_util,
- CHEESE_MEDIA_MODE_BURST);
- split = g_strsplit (first_path, "_1.jpg", -1);
- stub = g_strdup (split[0]);
-
- second_path = g_strdup_printf ("%s_2.jpg", stub);
- third_path = g_strdup_printf ("%s_3.jpg", stub);
-
- real_second = cheese_fileutil_get_new_media_filename (file_util,
- CHEESE_MEDIA_MODE_BURST);
- real_third = cheese_fileutil_get_new_media_filename (file_util,
- CHEESE_MEDIA_MODE_BURST);
-
- g_assert_cmpstr (real_second, ==, second_path);
- g_assert_cmpstr (real_third, ==, third_path);
-
- g_strfreev (split);
- g_free (real_second);
- g_free (real_third);
- g_free (second_path);
- g_free (third_path);
- g_free (stub);
- g_object_unref (file_util);
-}
-
/* Test UmCropArea. */
/* TODO: Test widget instantiation. */
static void test_crop_area ()
@@ -117,9 +80,8 @@ int main (int argc, gchar *argv[])
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
- g_test_add_func ("/cheese/widgets", test_widget);
- g_test_add_func ("/cheese/file_util", test_file_utils);
- g_test_add_func ("/cheese/crop_area", test_crop_area);
+ g_test_add_func ("/libcheese-gtk/widgets", test_widget);
+ g_test_add_func ("/libcheese-gtk/crop_area", test_crop_area);
return g_test_run ();
}
diff --git a/tests/test-libcheese.c b/tests/test-libcheese.c
new file mode 100644
index 0000000..e704ff9
--- /dev/null
+++ b/tests/test-libcheese.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright  2011 Lucas Baudin <xapantu gmail com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "cheese-config.h"
+
+#include <glib/gi18n.h>
+#include "cheese-fileutil.h"
+
+/* Test CheeseFileUtil */
+static void test_file_utils ()
+{
+ CheeseFileUtil *file_util;
+ gchar *first_path, *second_path, *third_path, *stub;
+ gchar *real_second, *real_third;
+ gchar **split;
+
+ file_util = cheese_fileutil_new ();
+ g_assert (file_util != NULL);
+
+ first_path = cheese_fileutil_get_new_media_filename (file_util,
+ CHEESE_MEDIA_MODE_BURST);
+ split = g_strsplit (first_path, "_1.jpg", -1);
+ stub = g_strdup (split[0]);
+
+ second_path = g_strdup_printf ("%s_2.jpg", stub);
+ third_path = g_strdup_printf ("%s_3.jpg", stub);
+
+ real_second = cheese_fileutil_get_new_media_filename (file_util,
+ CHEESE_MEDIA_MODE_BURST);
+ real_third = cheese_fileutil_get_new_media_filename (file_util,
+ CHEESE_MEDIA_MODE_BURST);
+
+ g_assert_cmpstr (real_second, ==, second_path);
+ g_assert_cmpstr (real_third, ==, third_path);
+
+ g_strfreev (split);
+ g_free (real_second);
+ g_free (real_third);
+ g_free (second_path);
+ g_free (third_path);
+ g_free (stub);
+ g_object_unref (file_util);
+}
+
+int main (int argc, gchar *argv[])
+{
+ g_thread_init (NULL);
+ g_type_init ();
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/libcheese/file_util", test_file_utils);
+
+ return g_test_run ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]