diff options
author | Ivan Frade <ivan.frade@gmail.com> | 2011-10-13 13:12:11 +0300 |
---|---|---|
committer | Martyn Russell <martyn@lanedo.com> | 2011-10-20 11:50:37 +0100 |
commit | 7e6d9829c9d89341992fb8e5ce79b5b428580c8e (patch) | |
tree | 610e89795db8834959457d943e37fb2c4f222cfe | |
parent | a67797f98ffacf8d4f9a4e1f220b14c667e8d2f6 (diff) | |
download | tracker-7e6d9829c9d89341992fb8e5ce79b5b428580c8e.tar.gz |
tests/libtracker-extract: Tests for TrackerExtractInfo
-rw-r--r-- | tests/libtracker-extract/Makefile.am | 5 | ||||
-rw-r--r-- | tests/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 336406233..a68ca57ee 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 000000000..0db73a6d4 --- /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 (); +} |