[grilo-plugins] test: Add two test cases to thegamesdb



commit ac1835687edd32cf1da5eb7c05974503a9c2009f
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri May 20 14:21:19 2016 +0200

    test: Add two test cases to thegamesdb
    
    Add thumbnail tests for:
    - Kirby's Dream Land on Game boy
    - Sonic th Hedgehog on Master System
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766678

 tests/games/data/network-data.ini               |   12 +
 tests/games/data/resolve-getgame-kirby-gb.data  |   26 ++
 tests/games/data/resolve-getgame-sonic-sms.data |   49 ++++
 tests/games/data/resolve-kirby-gb.data          |   94 ++++++++
 tests/games/data/resolve-sonic-sms.data         |  286 +++++++++++++++++++++++
 tests/games/test_games.c                        |   64 ++++--
 6 files changed, 515 insertions(+), 16 deletions(-)
---
diff --git a/tests/games/data/network-data.ini b/tests/games/data/network-data.ini
index 9cb0fcf..1cbb1c4 100644
--- a/tests/games/data/network-data.ini
+++ b/tests/games/data/network-data.ini
@@ -12,3 +12,15 @@ data=resolve-kirby.data
 
 [http://thegamesdb.net/api/GetGame.php?id=2336]
 data=resolve-getgame-kirby.data
+
+[http://thegamesdb.net/api/GetGamesList.php?name=Kirby%27s%20Dream%20Land&platform=Nintendo%20Game%20Boy]
+data=resolve-kirby-gb.data
+
+[http://thegamesdb.net/api/GetGame.php?id=8706]
+data=resolve-getgame-kirby-gb.data
+
+[http://thegamesdb.net/api/GetGamesList.php?name=Sonic%20the%20Hedgehog&platform=Sega%20Master%20System]
+data=resolve-sonic-sms.data
+
+[http://thegamesdb.net/api/GetGame.php?id=3016]
+data=resolve-getgame-sonic-sms.data
diff --git a/tests/games/data/resolve-getgame-kirby-gb.data b/tests/games/data/resolve-getgame-kirby-gb.data
new file mode 100644
index 0000000..892240d
--- /dev/null
+++ b/tests/games/data/resolve-getgame-kirby-gb.data
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Data>
+<baseImgUrl>http://thegamesdb.net/banners/</baseImgUrl>
+<Game>
+<id>8706</id>
+<GameTitle>Kirby's Dream Land</GameTitle>
+<PlatformId>4</PlatformId>
+<Platform>Nintendo Game Boy</Platform>
+<ReleaseDate>08/01/1992</ReleaseDate>
+<Overview>The gluttonous King Dedede has stolen all of the food from the inhabitants of Dream Land for a 
midnight feast, so Kirby, a resident of Dream Land, goes to retrieve the food and stop Dedede. Kirby's Dream 
Land plays like other platformers of the 8-bit and 16-bit era of video games: Kirby must use various natural 
abilities and occasionally external abilities or items while heading toward the goal at the end of each 
level. Like many 1980s-era platformers, the player can accumulate points, with an extra life granted when the 
player has enough points. However, because Kirby lacks a save function, scores are not recorded. Also, there 
are no save files, so the player has to start over again when the Game Boy is turned off, if the player 
chooses to return to the title screen after a Game Over, or if the player resets the game. All levels are 
played on a two-dimensional plane, letting Kirby move only left, right, up, and down. Kirby can walk, jump, 
and fly. Kirby can also i
 nhale objects and enemies, swallowing them or spitting them out as projectiles.</Overview>
+<ESRB>E - Everyone</ESRB>
+<Genres><genre>Platform</genre></Genres><Players>1</Players><Co-op>No</Co-op>
+<Youtube>http://www.youtube.com/watch?v=rJjcHAU5jb8</Youtube>
+<Publisher>Nintendo</Publisher>
+<Developer>HAL Laboratory</Developer>
+<Rating>8.5</Rating><Images>
+<boxart side="back" width="640" height="643" 
thumb="boxart/thumb/original/back/8706-1.jpg">boxart/original/back/8706-1.jpg</boxart>
+<boxart side="front" width="640" height="640" 
thumb="boxart/thumb/original/front/8706-1.jpg">boxart/original/front/8706-1.jpg</boxart>
+<screenshot>
+<original width="480" height="360">screenshots/8706-1.jpg</original>
+<thumb>screenshots/thumb/8706-1.jpg</thumb>
+</screenshot>
+</Images>
+</Game>
+</Data>
diff --git a/tests/games/data/resolve-getgame-sonic-sms.data b/tests/games/data/resolve-getgame-sonic-sms.data
new file mode 100644
index 0000000..172a927
--- /dev/null
+++ b/tests/games/data/resolve-getgame-sonic-sms.data
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Data>
+<baseImgUrl>http://thegamesdb.net/banners/</baseImgUrl>
+<Game>
+<id>3016</id>
+<GameTitle>Sonic the Hedgehog</GameTitle>
+<PlatformId>35</PlatformId>
+<Platform>Sega Master System</Platform>
+<ReleaseDate>06/23/1991</ReleaseDate>
+<Overview>Bust the video game speed barrier wide open with Sonic The Hedgehog. Blaze by in a blur using the 
Super Sonic Spin Attack. Plummet down tunnels and spin through space. Bounce around 'til you're dizzy in a 
pinball machine. You've never seen anything like it!</Overview>
+<ESRB>E - Everyone</ESRB>
+<Genres><genre>Adventure</genre><genre>Platform</genre></Genres><Players>1</Players><Co-op>No</Co-op>
+<Publisher>Sega</Publisher>
+<Developer>Sonic Team</Developer>
+<Rating>8</Rating><Similar><SimilarCount>8</SimilarCount><Game><id>33733</id><PlatformId>23</PlatformId></Game><Game><id>7581</id><PlatformId>15</PlatformId></Game><Game><id>17073</id><PlatformId>1</PlatformId></Game><Game><id>5754</id><PlatformId>20</PlatformId></Game><Game><id>114</id><PlatformId>18</PlatformId></Game><Game><id>5544</id><PlatformId>36</PlatformId></Game><Game><id>16645</id><PlatformId>12</PlatformId></Game><Game><id>18802</id><PlatformId>6</PlatformId></Game></Similar><Images>
+<fanart>
+<original width="1920" height="1080">fanart/original/3016-1.jpg</original>
+<thumb>fanart/thumb/3016-1.jpg</thumb>
+</fanart>
+<fanart>
+<original width="1920" height="1080">fanart/original/3016-2.jpg</original>
+<thumb>fanart/thumb/3016-2.jpg</thumb>
+</fanart>
+<fanart>
+<original width="1920" height="1080">fanart/original/3016-3.jpg</original>
+<thumb>fanart/thumb/3016-3.jpg</thumb>
+</fanart>
+<fanart>
+<original width="1920" height="1080">fanart/original/3016-4.jpg</original>
+<thumb>fanart/thumb/3016-4.jpg</thumb>
+</fanart>
+<fanart>
+<original width="1920" height="1080">fanart/original/3016-5.jpg</original>
+<thumb>fanart/thumb/3016-5.jpg</thumb>
+</fanart>
+<fanart>
+<original width="1920" height="1080">fanart/original/3016-6.jpg</original>
+<thumb>fanart/thumb/3016-6.jpg</thumb>
+</fanart>
+<boxart side="back" width="1521" height="2100" 
thumb="boxart/thumb/original/back/3016-1.jpg">boxart/original/back/3016-1.jpg</boxart>
+<boxart side="front" width="1529" height="2100" 
thumb="boxart/thumb/original/front/3016-1.jpg">boxart/original/front/3016-1.jpg</boxart>
+<banner width="760" height="140">graphical/3016-g.jpg</banner><screenshot>
+<original width="256" height="192">screenshots/3016-1.jpg</original>
+<thumb>screenshots/thumb/3016-1.jpg</thumb>
+</screenshot>
+<clearlogo width="400" height="183">clearlogo/3016.png</clearlogo></Images>
+</Game>
+</Data>
diff --git a/tests/games/data/resolve-kirby-gb.data b/tests/games/data/resolve-kirby-gb.data
new file mode 100644
index 0000000..f4a2e57
--- /dev/null
+++ b/tests/games/data/resolve-kirby-gb.data
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Data>
+<Game>
+<id>3190</id>
+<GameTitle>Kirby's Dream Land 2</GameTitle>
+<ReleaseDate>05/01/1995</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>8706</id>
+<GameTitle>Kirby's Dream Land</GameTitle>
+<ReleaseDate>08/01/1992</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>3191</id>
+<GameTitle>Kirby's Pinball Land</GameTitle>
+<ReleaseDate>03/04/1994</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>1728</id>
+<GameTitle>Wario Land: Super Mario Land 3</GameTitle>
+<ReleaseDate>01/21/1994</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>2305</id>
+<GameTitle>Kirby's Block Ball</GameTitle>
+<ReleaseDate>12/14/1995</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>3192</id>
+<GameTitle>Kirby's Star Stacker</GameTitle>
+<ReleaseDate>04/01/1997</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>21697</id>
+<GameTitle>Pipe Dream</GameTitle>
+<ReleaseDate>09/01/1990</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>24117</id>
+<GameTitle>Rod Land</GameTitle>
+<ReleaseDate>04/01/1990</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>11547</id>
+<GameTitle>Wario Land II</GameTitle>
+<ReleaseDate>03/02/1998</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>1726</id>
+<GameTitle>Super Mario Land</GameTitle>
+<ReleaseDate>04/21/1989</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>3176</id>
+<GameTitle>Donkey Kong Land 2</GameTitle>
+<ReleaseDate>01/16/1996</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>2644</id>
+<GameTitle>Donkey Kong Land</GameTitle>
+<ReleaseDate>07/26/1995</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>3175</id>
+<GameTitle>Donkey Kong Land 3</GameTitle>
+<ReleaseDate>10/01/1997</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>36159</id>
+<GameTitle>Exodus: Journey to the Promised Land</GameTitle>
+<ReleaseDate>01/01/1990</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+<Game>
+<id>1727</id>
+<GameTitle>Super Mario Land 2: 6 Golden Coins</GameTitle>
+<ReleaseDate>10/21/1992</ReleaseDate>
+<Platform>Nintendo Game Boy</Platform>
+</Game>
+</Data>
\ No newline at end of file
diff --git a/tests/games/data/resolve-sonic-sms.data b/tests/games/data/resolve-sonic-sms.data
new file mode 100644
index 0000000..b266831
--- /dev/null
+++ b/tests/games/data/resolve-sonic-sms.data
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Data>
+<Game>
+<id>3014</id>
+<GameTitle>Sonic the Hedgehog Chaos</GameTitle>
+<ReleaseDate>10/25/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3016</id>
+<GameTitle>Sonic the Hedgehog</GameTitle>
+<ReleaseDate>06/23/1991</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3017</id>
+<GameTitle>Sonic the Hedgehog 2</GameTitle>
+<ReleaseDate>11/21/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3013</id>
+<GameTitle>Sonic Blast</GameTitle>
+<ReleaseDate>01/01/1997</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3067</id>
+<GameTitle>The Ottifants</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3074</id>
+<GameTitle>The Terminator</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3071</id>
+<GameTitle>The Smurfs</GameTitle>
+<ReleaseDate>01/01/1994</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3076</id>
+<GameTitle>The Ninja</GameTitle>
+<ReleaseDate>01/01/1987</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>26432</id>
+<GameTitle>The Smurfs Travel The World</GameTitle>
+<ReleaseDate>01/01/1996</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3059</id>
+<GameTitle>The Flash</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3070</id>
+<GameTitle>The Simpsons: Bart vs. The World</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3069</id>
+<GameTitle>The Simpsons: Bart vs. The Space Mutants</GameTitle>
+<ReleaseDate>01/01/1991</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>5501</id>
+<GameTitle>Ys: The Vanished Omens</GameTitle>
+<ReleaseDate>10/14/1988</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2742</id>
+<GameTitle>Fantasy Zone: The Maze</GameTitle>
+<ReleaseDate>01/01/1988</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2824</id>
+<GameTitle>Heroes of the Lance</GameTitle>
+<ReleaseDate>01/01/1991</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2994</id>
+<GameTitle>RoboCop Versus The Terminator</GameTitle>
+<ReleaseDate>01/01/1991</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3062</id>
+<GameTitle>The Incredible Hulk</GameTitle>
+<ReleaseDate>01/01/1994</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2898</id>
+<GameTitle>Ecco the Dolphin</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3132</id>
+<GameTitle>T2: The Arcade Game</GameTitle>
+<ReleaseDate>01/01/1991</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3056</id>
+<GameTitle>The Addams Family</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3063</id>
+<GameTitle>Disney's The Jungle Book</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>27357</id>
+<GameTitle>The Three Dragon Story</GameTitle>
+<ReleaseDate>01/01/1989</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3007</id>
+<GameTitle>Shadow of the Beast</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3064</id>
+<GameTitle>The Lion King</GameTitle>
+<ReleaseDate>01/01/1994</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3057</id>
+<GameTitle>The Cyber Shinobi</GameTitle>
+<ReleaseDate>01/01/1990</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3061</id>
+<GameTitle>The Incredible Crash Dummies</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3066</id>
+<GameTitle>The New Zealand Story</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>26105</id>
+<GameTitle>Ariel: The Little Mermaid</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3081</id>
+<GameTitle>Tom and Jerry - The Movie</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>5498</id>
+<GameTitle>Alex Kidd: The Lost Stars</GameTitle>
+<ReleaseDate>07/01/1988</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>1799</id>
+<GameTitle>Dragon: The Bruce Lee Story</GameTitle>
+<ReleaseDate>1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2731</id>
+<GameTitle>Dinobasher Starring Bignose the Caveman</GameTitle>
+<ReleaseDate>03/01/1994</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3068</id>
+<GameTitle>The Pro Yakyuu: Pennant Race</GameTitle>
+<ReleaseDate>01/01/1987</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3126</id>
+<GameTitle>Zillion II: The Tri Formation</GameTitle>
+<ReleaseDate>01/01/1988</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2857</id>
+<GameTitle>James Bond 007: The Duel</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2693</id>
+<GameTitle>Asterix and the Great Rescue</GameTitle>
+<ReleaseDate>11/15/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3097</id>
+<GameTitle>Ecco: The Tides of Time</GameTitle>
+<ReleaseDate>01/01/1995</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2855</id>
+<GameTitle>Indiana Jones and the Last Crusade</GameTitle>
+<ReleaseDate>01/01/1990</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2700</id>
+<GameTitle>Back to the Future Part III</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2875</id>
+<GameTitle>King's Quest: Quest for the Crown</GameTitle>
+<ReleaseDate>01/01/1989</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3099</id>
+<GameTitle>Where in the World Is Carmen Sandiego?</GameTitle>
+<ReleaseDate>01/01/1989</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>7510</id>
+<GameTitle>Zool: Ninja of the 'Nth' Dimension</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3026</id>
+<GameTitle>Spider-Man - Return of the Sinister Six</GameTitle>
+<ReleaseDate>01/01/1992</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>3108</id>
+<GameTitle>Wonder Boy III: The Dragon's Trap</GameTitle>
+<ReleaseDate>07/03/1989</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>5500</id>
+<GameTitle>Miracle Warriors: Seal of the Dark Lord</GameTitle>
+<ReleaseDate>01/31/1988</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2984</id>
+<GameTitle>Quest for the Shaven Yak Starring Ren Hoek &amp; Stimpy</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+<Game>
+<id>2986</id>
+<GameTitle>Rainbow Islands: Story of the Bubble Bobble 2</GameTitle>
+<ReleaseDate>01/01/1993</ReleaseDate>
+<Platform>Sega Master System</Platform>
+</Game>
+</Data>
diff --git a/tests/games/test_games.c b/tests/games/test_games.c
index a27d24a..efdad2c 100644
--- a/tests/games/test_games.c
+++ b/tests/games/test_games.c
@@ -110,43 +110,75 @@ test_resolve_good_found (void)
 }
 
 static void
-test_resolve_thumbnail_found (void)
+test_resolve_thumbnail_found (GrlSource *source,
+                              GList *keys,
+                              GrlOperationOptions *options,
+                              const gchar *title,
+                              const gchar *mime,
+                              guint expected_thumbnail_index,
+                              const gchar *expected_thumbnail_url)
 {
   GError *error = NULL;
-  GList *keys;
   GrlMedia *media;
+  guint expected_n_thumbnails;
+
+  media = build_game_media (title);
+  grl_media_set_mime (media, mime);
+
+  grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_FULL);
+
+  grl_source_resolve_sync (source, media, keys, options, &error);
+
+  g_assert_no_error (error);
+
+  /* We should get a thumbnail */
+  expected_n_thumbnails = grl_data_length (GRL_DATA (media), GRL_METADATA_KEY_THUMBNAIL);
+  g_assert_cmpuint (expected_n_thumbnails, >, 0);
+  g_assert_cmpstr (grl_media_get_thumbnail_nth (media, expected_thumbnail_index),
+                   ==,
+                   expected_thumbnail_url);
+
+  g_object_unref (media);
+}
+
+static void
+test_resolve_thumbnails_found (void)
+{
+  GList *keys;
   GrlOperationOptions *options;
   GrlRegistry *registry;
   GrlSource *source;
-  guint expected_n_thumbnails;
 
   registry = grl_registry_get_default ();
   source = grl_registry_lookup_source (registry, THEGAMESDB);
   g_assert (source);
 
-  media = build_game_media ("Kirby & the Amazing Mirror");
-  grl_media_set_mime (media, "application/x-gba-rom");
-
   keys = grl_metadata_key_list_new (GRL_METADATA_KEY_THUMBNAIL,
                                     NULL);
 
   options = grl_operation_options_new (NULL);
   grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_FULL);
 
-  grl_source_resolve_sync (source, media, keys, options, &error);
+  test_resolve_thumbnail_found (source, keys, options,
+                                "Kirby & the Amazing Mirror",
+                                "application/x-gba-rom",
+                                0,
+                                "http://thegamesdb.net/banners/boxart/original/front/2336-1.png";);
 
-  g_assert_no_error (error);
+  test_resolve_thumbnail_found (source, keys, options,
+                                "Kirby's Dream Land",
+                                "application/x-gameboy-rom",
+                                0,
+                                "http://thegamesdb.net/banners/boxart/original/front/8706-1.jpg";);
 
-  /* We should get a thumbnail */
-  expected_n_thumbnails = grl_data_length (GRL_DATA (media), GRL_METADATA_KEY_THUMBNAIL);
-  g_assert_cmpuint (expected_n_thumbnails, ==, 1);
-  g_assert_cmpstr (grl_media_get_thumbnail_nth (media, 0),
-                   ==,
-                   "http://thegamesdb.net/banners/boxart/original/front/2336-1.png";);
+  test_resolve_thumbnail_found (source, keys, options,
+                                "Sonic the Hedgehog",
+                                "application/x-sms-rom",
+                                0,
+                                "http://thegamesdb.net/banners/boxart/original/front/3016-1.jpg";);
 
   g_list_free (keys);
   g_object_unref (options);
-  g_object_unref (media);
 }
 
 int
@@ -163,7 +195,7 @@ main(int argc, char **argv)
   test_setup ();
 
   g_test_add_func ("/thegamesdb/resolve/good-found", test_resolve_good_found);
-  g_test_add_func ("/thegamesdb/resolve/thumbnail-found", test_resolve_thumbnail_found);
+  g_test_add_func ("/thegamesdb/resolve/thumbnails-found", test_resolve_thumbnails_found);
 
   gint result = g_test_run ();
 


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