[tracker] tests/libtracker-extract: Tests for TrackerExtractInfo



commit 32e348fbffdeb7aa3a162f3e0692668a906259e4
Author: Ivan Frade <ivan frade gmail com>
Date:   Thu Oct 13 13:12:11 2011 +0300

    tests/libtracker-extract: Tests for TrackerExtractInfo

 tests/libtracker-extract/Makefile.am               |    5 +-
 .../libtracker-extract/tracker-extract-info-test.c |   62 ++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/tests/libtracker-extract/Makefile.am b/tests/libtracker-extract/Makefile.am
index 3364062..a68ca57 100644
--- a/tests/libtracker-extract/Makefile.am
+++ b/tests/libtracker-extract/Makefile.am
@@ -4,7 +4,8 @@ noinst_PROGRAMS = $(TEST_PROGS)
 
 TEST_PROGS +=                                          \
 	tracker-test-utils                             \
-	tracker-test-xmp
+	tracker-test-xmp			       \
+	tracker-extract-info-test
 
 if HAVE_ENCA
 TEST_PROGS += tracker-encoding
@@ -37,4 +38,6 @@ tracker_test_utils_SOURCES = tracker-test-utils.c
 
 tracker_test_xmp_SOURCES = tracker-test-xmp.c
 
+tracker_extract_info_test_SOURCES = tracker-extract-info-test.c
+
 EXTRA_DIST = encoding-detect.bin areas.xmp areas-with-contacts.xmp areas-ns.xmp nb282393.xmp nb282393_simple.xmp
diff --git a/tests/libtracker-extract/tracker-extract-info-test.c b/tests/libtracker-extract/tracker-extract-info-test.c
new file mode 100644
index 0000000..0db73a6
--- /dev/null
+++ b/tests/libtracker-extract/tracker-extract-info-test.c
@@ -0,0 +1,62 @@
+#include <glib.h>
+#include <libtracker-extract/tracker-extract-info.h>
+
+void
+test_extract_info_setters ()
+{
+        TrackerExtractInfo *info, *info_ref;
+        GFile *file;
+
+        file = g_file_new_for_path ("./imaginary-file-2");
+
+        info = tracker_extract_info_new (file, "imaginary/mime", "test-graph");
+        info_ref = tracker_extract_info_ref (info);
+
+        g_assert (g_file_equal (file, tracker_extract_info_get_file (info)));
+
+        g_assert_cmpstr (tracker_extract_info_get_mimetype (info), ==, "imaginary/mime");
+        g_assert_cmpstr (tracker_extract_info_get_graph (info), ==, "test-graph");
+        g_assert (tracker_extract_info_get_preupdate_builder (info));
+        g_assert (tracker_extract_info_get_postupdate_builder (info));
+        g_assert (tracker_extract_info_get_metadata_builder (info));
+
+        g_assert (!tracker_extract_info_get_where_clause (info));
+        tracker_extract_info_set_where_clause (info, "where stuff");
+        g_assert_cmpstr (tracker_extract_info_get_where_clause (info), ==, "where stuff");
+
+        tracker_extract_info_unref (info_ref);
+        tracker_extract_info_unref (info);
+
+        g_object_unref (file);
+}
+
+void
+test_extract_info_empty_objects ()
+{
+        TrackerExtractInfo *info, *info_ref;
+        GFile *file;
+
+        file = g_file_new_for_path ("./imaginary-file");
+
+        info = tracker_extract_info_new (file, "imaginary/mime", "test-graph");
+        info_ref = tracker_extract_info_ref (info);
+
+        tracker_extract_info_unref (info_ref);
+        tracker_extract_info_unref (info);
+
+        g_object_unref (file);
+}
+
+int
+main (int argc, char **argv)
+{
+        g_type_init ();
+        g_test_init (&argc, &argv, NULL);
+
+        g_test_add_func ("/libtracker-extract/extract-info/empty_objects",
+                         test_extract_info_empty_objects);
+        g_test_add_func ("/libtracker-extract/extract-info/setters",
+                         test_extract_info_setters);
+
+        return g_test_run ();
+}



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