summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartyn Russell <martyn@lanedo.com>2014-02-25 13:46:48 +0000
committerMartyn Russell <martyn@lanedo.com>2014-06-23 05:31:45 +0100
commit91f827eb4d176ac14f514a1c260abdb4dabd9cf0 (patch)
tree0a09f4516953497d406ca6d3479f134d056778d9
parent44c8e4a8ebc30255c170c63b476371ba0e9adb13 (diff)
downloadlibmediaart-91f827eb4d176ac14f514a1c260abdb4dabd9cf0.tar.gz
tests: Don't expect media art extraction for NULL data buffer for !images
-rw-r--r--libmediaart/extract.c5
-rw-r--r--tests/mediaarttest.c22
2 files changed, 17 insertions, 10 deletions
diff --git a/libmediaart/extract.c b/libmediaart/extract.c
index 690bca7..9ddc8d0 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);