From ef421db6c8938cd1a1a07727c31a4ef60caf45be Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 26 Sep 2017 16:06:45 +0200 Subject: libtracker-miner: Remove TrackerCrawler max_depth argument It was always called with depth=1 (return just direct children of the given folder), so make this the default. Admittedly, the "crawler" name is a bit of an stretch now. The TrackerCrawler tests have also been removed the recursive tests, since that's not possible anymore. --- tests/libtracker-miner/tracker-crawler-test.c | 82 ++------------------------- 1 file changed, 5 insertions(+), 77 deletions(-) (limited to 'tests') diff --git a/tests/libtracker-miner/tracker-crawler-test.c b/tests/libtracker-miner/tracker-crawler-test.c index 4739f390e..45295a8b4 100644 --- a/tests/libtracker-miner/tracker-crawler-test.c +++ b/tests/libtracker-miner/tracker-crawler-test.c @@ -126,7 +126,7 @@ test_crawler_crawl (void) file = g_file_new_for_path (TEST_DATA_DIR); - started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, -1); + started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE); g_assert_cmpint (started, ==, 1); @@ -153,7 +153,7 @@ test_crawler_crawl_interrupted (void) file = g_file_new_for_path (TEST_DATA_DIR); - started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, -1); + started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE); g_assert_cmpint (started, ==, 1); @@ -175,7 +175,7 @@ test_crawler_crawl_nonexisting (void) crawler = tracker_crawler_new (NULL); file = g_file_new_for_path (TEST_DATA_DIR "-idontexist"); - started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, -1); + started = tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE); g_assert_cmpint (started, ==, 0); @@ -183,38 +183,6 @@ test_crawler_crawl_nonexisting (void) g_object_unref (file); } -static void -test_crawler_crawl_recursive (void) -{ - TrackerCrawler *crawler; - CrawlerTest test = { 0 }; - GFile *file; - - test.main_loop = g_main_loop_new (NULL, FALSE); - - crawler = tracker_crawler_new (NULL); - g_signal_connect (crawler, "finished", - G_CALLBACK (crawler_finished_cb), &test); - g_signal_connect (crawler, "directory-crawled", - G_CALLBACK (crawler_directory_crawled_cb), &test); - - file = g_file_new_for_path (TEST_DATA_DIR); - - tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, -1); - - g_main_loop_run (test.main_loop); - - /* There are 4 directories and 5 (2 hidden) files */ - g_assert_cmpint (test.directories_found, ==, 4); - g_assert_cmpint (test.directories_ignored, ==, 0); - g_assert_cmpint (test.files_found, ==, 5); - g_assert_cmpint (test.files_ignored, ==, 0); - - g_main_loop_unref (test.main_loop); - g_object_unref (crawler); - g_object_unref (file); -} - static void test_crawler_crawl_non_recursive (void) { @@ -232,7 +200,7 @@ test_crawler_crawl_non_recursive (void) file = g_file_new_for_path (TEST_DATA_DIR); - tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, 1); + tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE); g_main_loop_run (test.main_loop); @@ -247,42 +215,6 @@ test_crawler_crawl_non_recursive (void) g_object_unref (file); } -static void -test_crawler_crawl_n_signals (void) -{ - TrackerCrawler *crawler; - CrawlerTest test = { 0 }; - GFile *file; - - test.main_loop = g_main_loop_new (NULL, FALSE); - - crawler = tracker_crawler_new (NULL); - g_signal_connect (crawler, "finished", - G_CALLBACK (crawler_finished_cb), &test); - g_signal_connect (crawler, "directory-crawled", - G_CALLBACK (crawler_directory_crawled_cb), &test); - g_signal_connect (crawler, "check-directory", - G_CALLBACK (crawler_check_directory_cb), &test); - g_signal_connect (crawler, "check-directory-contents", - G_CALLBACK (crawler_check_directory_contents_cb), &test); - g_signal_connect (crawler, "check-file", - G_CALLBACK (crawler_check_file_cb), &test); - - file = g_file_new_for_path (TEST_DATA_DIR); - - tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, -1); - - g_main_loop_run (test.main_loop); - - g_assert_cmpint (test.directories_found, ==, test.n_check_directory); - g_assert_cmpint (test.directories_found, ==, test.n_check_directory_contents); - g_assert_cmpint (test.files_found, ==, test.n_check_file); - - g_main_loop_unref (test.main_loop); - g_object_unref (crawler); - g_object_unref (file); -} - static void test_crawler_crawl_n_signals_non_recursive (void) { @@ -308,7 +240,7 @@ test_crawler_crawl_n_signals_non_recursive (void) file = g_file_new_for_path (TEST_DATA_DIR); - tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE, 1); + tracker_crawler_start (crawler, file, TRACKER_DIRECTORY_FLAG_NONE); g_main_loop_run (test.main_loop); @@ -336,13 +268,9 @@ main (int argc, g_test_add_func ("/libtracker-miner/tracker-crawler/crawl-nonexisting", test_crawler_crawl_nonexisting); - g_test_add_func ("/libtracker-miner/tracker-crawler/crawl-recursive", - test_crawler_crawl_recursive); g_test_add_func ("/libtracker-miner/tracker-crawler/crawl-non-recursive", test_crawler_crawl_non_recursive); - g_test_add_func ("/libtracker-miner/tracker-crawler/crawl-n-signals", - test_crawler_crawl_n_signals); g_test_add_func ("/libtracker-miner/tracker-crawler/crawl-n-signals-non-recursive", test_crawler_crawl_n_signals_non_recursive); -- cgit v1.2.1