diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-11-29 00:11:47 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-11-29 00:12:43 -0500 |
commit | b328cae6a975055ad83d99b248f366fe0973ff0e (patch) | |
tree | ccfa3e03072aff6d5b27ad975d5699a30d96d549 | |
parent | 7a90c201f7212a410ed871d7decab23e8b63d0e9 (diff) | |
download | glib-b328cae6a975055ad83d99b248f366fe0973ff0e.tar.gz |
Add a test for g_file_measure_disk_usage
-rw-r--r-- | gio/tests/file.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gio/tests/file.c b/gio/tests/file.c index 9d819f3cc..8ca24edbb 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -806,6 +806,40 @@ test_copy_preserve_mode (void) } #endif +static void +test_measure (void) +{ + GFile *file; + guint64 size; + guint64 num_dirs; + guint64 num_files; + GError *error = NULL; + gboolean ok; + gchar *path; + + path = g_test_build_filename (G_TEST_DIST, "desktop-files", NULL); + file = g_file_new_for_path (path); + g_free (path); + + ok = g_file_measure_disk_usage (file, + G_FILE_MEASURE_NONE, + NULL, + NULL, + NULL, + &size, + &num_dirs, + &num_files, + &error); + g_assert (ok); + g_assert_no_error (error); + + g_assert_cmpuint (size, ==, 155648); + g_assert_cmpuint (num_dirs, ==, 6); + g_assert_cmpuint (num_files, ==, 30); + + g_object_unref (file); +} + int main (int argc, char *argv[]) { @@ -829,6 +863,7 @@ main (int argc, char *argv[]) #ifdef G_OS_UNIX g_test_add_func ("/file/copy-preserve-mode", test_copy_preserve_mode); #endif + g_test_add_func ("/file/measure", test_measure); return g_test_run (); } |