[glib] Improve GFileAttributeMatcher test coverage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Improve GFileAttributeMatcher test coverage
- Date: Sun, 2 Jun 2013 05:48:15 +0000 (UTC)
commit c40e0b59da5dba6af74f7778e77b01e7f7f48e15
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 2 01:43:13 2013 -0400
Improve GFileAttributeMatcher test coverage
gio/tests/g-file-info.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
index 85fc9f3..7ed874a 100644
--- a/gio/tests/g-file-info.c
+++ b/gio/tests/g-file-info.c
@@ -69,6 +69,7 @@ test_g_file_info (void)
GFileInfo *info_dup;
GFileInfo *info_copy;
char **attr_list;
+ GFileAttributeMatcher *matcher;
info = g_file_info_new ();
@@ -100,15 +101,32 @@ test_g_file_info (void)
g_file_info_copy_into (info_dup, info_copy);
g_assert (info_copy != NULL);
test_assigned_values (info_copy);
-
+
/* Test remove attribute */
g_assert (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER) == FALSE);
g_file_info_set_attribute_int32 (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER, 10);
g_assert (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER) == TRUE);
-
+
+ g_assert (g_file_info_get_attribute_type (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER) ==
G_FILE_ATTRIBUTE_TYPE_INT32);
+ g_assert (g_file_info_get_attribute_status (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER) !=
G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING);
+
g_file_info_remove_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER);
g_assert (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER) == FALSE);
-
+ g_assert (g_file_info_get_attribute_type (info, G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER) ==
G_FILE_ATTRIBUTE_TYPE_INVALID);
+
+ matcher = g_file_attribute_matcher_new (G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
+
+ g_assert (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_NAME) == TRUE);
+ g_assert (g_file_attribute_matcher_matches_only (matcher, G_FILE_ATTRIBUTE_STANDARD_NAME) == FALSE);
+ g_assert (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_STANDARD_SIZE) == FALSE);
+
+ g_file_info_set_attribute_mask (info, matcher);
+ g_file_attribute_matcher_unref (matcher);
+
+ g_assert (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_SIZE) == FALSE);
+ g_assert (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_NAME) == TRUE);
+
g_object_unref (info);
g_object_unref (info_dup);
g_object_unref (info_copy);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]