[tracker/miner-fs-refactor: 7/127] libtracker-miner, tests: avoid aligning backslash in Makefile.am
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-fs-refactor: 7/127] libtracker-miner, tests: avoid aligning backslash in Makefile.am
- Date: Wed, 7 Dec 2011 10:37:31 +0000 (UTC)
commit 4eae2488063d35a79606c4ee8c8a3f7882746992
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Aug 3 12:18:10 2011 +0200
libtracker-miner, tests: avoid aligning backslash in Makefile.am
tests/libtracker-miner/Makefile.am | 59 +++++-----
.../libtracker-miner/tracker-indexing-tree-test.c | 113 ++++++++++++++++++++
2 files changed, 142 insertions(+), 30 deletions(-)
---
diff --git a/tests/libtracker-miner/Makefile.am b/tests/libtracker-miner/Makefile.am
index 7dbf0ef..a6567a1 100644
--- a/tests/libtracker-miner/Makefile.am
+++ b/tests/libtracker-miner/Makefile.am
@@ -25,23 +25,23 @@ TEST_PROGS += \
tracker-priority-queue-test \
tracker-task-pool-test
-AM_CPPFLAGS = \
- $(BUILD_CFLAGS) \
- -DTEST \
- -DLIBEXEC_PATH=\""$(libexecdir)"\" \
+AM_CPPFLAGS = \
+ $(BUILD_CFLAGS) \
+ -DTEST \
+ -DLIBEXEC_PATH=\""$(libexecdir)"\" \
-DTEST_DATA_DIR=\""$(abs_top_srcdir)/tests/libtracker-miner/data"\" \
-DTEST_MINERS_DIR=\""$(abs_top_srcdir)/tests/libtracker-miner/mock-miners"\" \
- -I$(top_srcdir)/src \
- -I$(top_builddir)/src \
- -I$(top_srcdir)/tests/common \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/tests/common \
$(LIBTRACKER_MINER_CFLAGS)
-LDADD = \
+LDADD = \
$(top_builddir)/src/libtracker-miner/libtracker-miner- TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-miner/libtracker-miner-private.la \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql- TRACKER_API_VERSION@.la \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
- $(BUILD_LIBS) \
+ $(BUILD_LIBS) \
$(LIBTRACKER_MINER_LIBS)
libtracker_miner_tests_la_VALAFLAGS = \
@@ -63,29 +63,28 @@ libtracker_miner_tests_la_LIBADD = \
$(top_builddir)/src/libtracker-sparql-backend/libtracker-sparql- TRACKER_API_VERSION@.la \
$(BUILD_LIBS)
-
-tracker_crawler_test_SOURCES = \
+tracker_crawler_test_SOURCES = \
tracker-crawler-test.c
-tracker_miner_manager_test_SOURCES = \
- tracker-miner-manager-test.c \
- miners-mock.c \
+tracker_miner_manager_test_SOURCES = \
+ tracker-miner-manager-test.c \
+ miners-mock.c \
empty-gobject.c
-tracker_miner_manager_test_LDADD = \
- libtracker-miner-tests.la \
+tracker_miner_manager_test_LDADD = \
+ libtracker-miner-tests.la \
$(LDADD)
-tracker_password_provider_test_SOURCES = \
+tracker_password_provider_test_SOURCES = \
tracker-password-provider-test.c
-tracker_password_provider_test_LDADD = \
- libtracker-miner-tests.la \
+tracker_password_provider_test_LDADD = \
+ libtracker-miner-tests.la \
$(LDADD)
-tracker_thumbnailer_test_SOURCES = \
- tracker-thumbnailer-test.c \
- thumbnailer-mock.c \
+tracker_thumbnailer_test_SOURCES = \
+ tracker-thumbnailer-test.c \
+ thumbnailer-mock.c \
empty-gobject.c
tracker_monitor_test_SOURCES = \
@@ -111,14 +110,14 @@ noinst_HEADERS = \
miners-mock.h \
empty-gobject.h
-BUILT_SOURCES = \
+BUILT_SOURCES = \
libtracker_miner_tests_la_vala.stamp
-EXTRA_DIST = \
- data/empty-dir/.hidden \
- data/file1 \
- data/dir/empty-dir/.hidden \
- data/dir/file1 \
- data/dir/file2 \
- mock-miners/mock-miner-1.desktop \
+EXTRA_DIST = \
+ data/empty-dir/.hidden \
+ data/file1 \
+ data/dir/empty-dir/.hidden \
+ data/dir/file1 \
+ data/dir/file2 \
+ mock-miners/mock-miner-1.desktop \
mock-miners/mock-miner-2.desktop
diff --git a/tests/libtracker-miner/tracker-indexing-tree-test.c b/tests/libtracker-miner/tracker-indexing-tree-test.c
new file mode 100644
index 0000000..9bac491
--- /dev/null
+++ b/tests/libtracker-miner/tracker-indexing-tree-test.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2011, Nokia <ivan frade nokia com>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include <tracker-indexing-tree.h>
+
+static void
+test_indexing_tree_recursive (void)
+{
+ TrackerIndexingTree *tree;
+ GFile *recursive;
+ GFile *aux;
+
+ tree = tracker_indexing_tree_new ();
+
+ recursive = g_file_new_for_path ("/home/user/Music");
+ tracker_indexing_tree_add (tree,
+ recursive,
+ (TRACKER_DIRECTORY_FLAG_MONITOR | TRACKER_DIRECTORY_FLAG_RECURSE));
+
+ aux = g_file_new_for_path ("/home/user/Music/Album");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == TRUE);
+ g_object_unref (aux);
+
+ aux = g_file_new_for_path ("/home/user/Music/File.mp3");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == TRUE);
+ g_object_unref (aux);
+
+ aux = g_file_new_for_path ("/home/user/Music/Album/Artist");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == TRUE);
+ g_object_unref (aux);
+
+ aux = g_file_new_for_path ("/home/user/Music/Artist/File.mp3");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == TRUE);
+ g_object_unref (aux);
+
+
+ g_object_unref (aux);
+ g_object_unref (tree);
+}
+
+static void
+test_indexing_tree_non_recursive (void)
+{
+ TrackerIndexingTree *tree;
+ GFile *recursive;
+ GFile *aux;
+
+ tree = tracker_indexing_tree_new ();
+
+ recursive = g_file_new_for_path ("/home/user/Music");
+ tracker_indexing_tree_add (tree,
+ recursive,
+ (TRACKER_DIRECTORY_FLAG_MONITOR);
+
+ aux = g_file_new_for_path ("/home/user/Music/Album");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == TRUE);
+ g_object_unref (aux);
+
+ aux = g_file_new_for_path ("/home/user/Music/File.mp3");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == TRUE);
+ g_object_unref (aux);
+
+ aux = g_file_new_for_path ("/home/user/Music/Album/Artist");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_DIRECTORY) == FALSE);
+ g_object_unref (aux);
+
+ aux = g_file_new_for_path ("/home/user/Music/Artist/File.mp3");
+ g_assert (tracker_indexing_tree_file_is_indexable (tree, aux, G_FILE_TYPE_REGULAR) == FALSE);
+ g_object_unref (aux);
+
+ g_object_unref (aux);
+ g_object_unref (tree);
+}
+
+gint
+main (gint argc,
+ gchar **argv)
+{
+ g_thread_init (NULL);
+ g_type_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_message ("Testing indexing tree");
+
+ g_test_add_func ("/libtracker-miner/tracker-indexing-tree/recursive",
+ test_indexing_tree_recursive);
+ g_test_add_func ("/libtracker-miner/tracker-indexing-tree/non-recursive",
+ test_indexing_tree_non_recursive);
+
+ return g_test_run ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]