[banshee] ArtworkManagerTests: make test more robust



commit 2c0c53f6bf9e297ca98f4afd0e1ab1490edd586c
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Mon Jan 20 02:14:25 2014 +0100

    ArtworkManagerTests: make test more robust
    
    It could happen that this test failed in case banshee had not
    ever been run in the computer, which was assuming the cache
    folder to exist, and would fail this way:
    
    GLib.GException : Failed to open
    '/home/knocte/.cache/media-art/36/album-d33f25dbd7dfb4817a7e99f6bc2de49e.jpg'
    for writing: No such file or directory
     at Gdk.Pixbuf.Save (System.String filename, System.String type)
     at Banshee.Collection.Gui.Tests.ArtworkManagerTests.TestsSizePath ()

 .../Tests/ArtworkManagerTests.cs                   |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/Tests/ArtworkManagerTests.cs 
b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/Tests/ArtworkManagerTests.cs
index e29658e..dfef185 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/Tests/ArtworkManagerTests.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/Tests/ArtworkManagerTests.cs
@@ -81,6 +81,12 @@ namespace Banshee.Collection.Gui.Tests
                 var artist_album_id = CoverArtSpec.CreateArtistAlbumId ("Metallica", "Master Of Puppets");
                 jpg_file_path = CoverArtSpec.GetPathForSize (artist_album_id, 
CustomArtworkManager.SizeTest); // i.e.: 
/home/knocte/.cache/media-art/36/album-d33f25dbd7dfb4817a7e99f6bc2de49e.jpg"
                 var pixbuf = new Pixbuf (png_file_path);
+
+                var dir = System.IO.Path.GetDirectoryName (jpg_file_path);
+                if (!System.IO.Directory.Exists (dir)) {
+                    System.IO.Directory.CreateDirectory (dir);
+                }
+
                 pixbuf.Save (jpg_file_path, "jpeg");
 
                 var artwork_manager = new CustomArtworkManager ();


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