[libmediaart/api-cleanup: 11/14] tests: Don't expect media art extraction for NULL data buffer for !images



commit 3ff26a66df8a2dc751b9ac2721bd7c46d953f94a
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Feb 25 13:46:48 2014 +0000

    tests: Don't expect media art extraction for NULL data buffer for !images

 libmediaart/extract.c |    5 ++++-
 tests/mediaarttest.c  |   22 +++++++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/libmediaart/extract.c b/libmediaart/extract.c
index 328e78d..8ab81ee 100644
--- a/libmediaart/extract.c
+++ b/libmediaart/extract.c
@@ -1415,7 +1415,10 @@ get_heuristic_for_parent_path (GFile        *file,
  *
  * If @buffer is %NULL, libmediaart will search the parent directory of @file
  * for image files that are likely to be media art for @file, and if one is
- * found it will be saved in the media art cache.
+ * found it will be saved in the media art cache. If @buffer is %NULL
+ * for a @file which is *not* an image file (typically JPEG or PNG,
+ * supported by the backends), this function will return %FALSE with
+ * no error set, because it's not expected to work.
  *
  * If @file is on a removable filesystem, the media art file will be saved in a
  * cache on the removable file system rather than on the host machine.
diff --git a/tests/mediaarttest.c b/tests/mediaarttest.c
index 11cd31a..9cead21 100644
--- a/tests/mediaarttest.c
+++ b/tests/mediaarttest.c
@@ -209,6 +209,10 @@ test_mediaart_embedded_mp3 (void)
        process = media_art_process_new (&error);
        g_assert_no_error (error);
 
+       /* NOTE: This should fail because we aren't passing a buffer
+        * in. With MP3 files, or none IMAGE based files, we don't
+        * have extractors for each type and it's up to the caller to
+        * pass in the data buffer to save in this case. */
        retval = media_art_process_file (process,
                                         file,
                                         NULL,
@@ -216,11 +220,11 @@ test_mediaart_embedded_mp3 (void)
                                         "audio/mp3", /* mime */
                                         MEDIA_ART_ALBUM,
                                         "King Kilo", /* artist */
-                                        "Lanedo",    /* title */
+                                        "Radium",    /* title */
                                         &error);
 
        g_assert_no_error (error);
-       g_assert_true (retval);
+       g_assert_false (retval);
 
        g_object_unref (file);
        g_free (dir);
@@ -250,8 +254,8 @@ test_mediaart_png (void)
 
        /* Check data is not cached currently */
        media_art_get_path ("Lanedo", /* artist / title */
-                           NULL, /* album */
-                           NULL, /* prefix */
+                           NULL,     /* album */
+                           NULL,     /* prefix */
                             path,
                             &out_path,
                             &out_uri);
@@ -266,16 +270,16 @@ test_mediaart_png (void)
                                         0,
                                         "image/png", /* mime */
                                         MEDIA_ART_ALBUM,
-                                        NULL, /* album */
+                                        NULL,        /* album */
                                         "Lanedo",    /* title */
-                                        NULL);
-
+                                        &error);
+       g_assert_no_error (error);
        g_assert_true (retval);
 
        /* Check cache exists */
        media_art_get_path ("Lanedo", /* artist / title */
-                           NULL, /* album */
-                           NULL, /* prefix */
+                           NULL,     /* album */
+                           NULL,     /* prefix */
                             path,
                             &out_path,
                             &out_uri);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]