[gupnp] tests: Add test for #722696 (icon size request issue)
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] tests: Add test for #722696 (icon size request issue)
- Date: Fri, 18 Jul 2014 19:21:20 +0000 (UTC)
commit b6e316975e07c99aa56645584707df36b0250425
Author: Jussi Kukkonen <jku goto fi>
Date: Wed Jul 9 13:24:13 2014 +0300
tests: Add test for #722696 (icon size request issue)
https://bugzilla.gnome.org/show_bug.cgi?id=722696
tests/gtest/data/TestDevice.xml | 23 ++++++++++++++
tests/gtest/test-bugs.c | 62 +++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+), 0 deletions(-)
---
diff --git a/tests/gtest/data/TestDevice.xml b/tests/gtest/data/TestDevice.xml
index d210ee2..3d2749c 100644
--- a/tests/gtest/data/TestDevice.xml
+++ b/tests/gtest/data/TestDevice.xml
@@ -8,6 +8,29 @@
<friendlyName>GUPnP Regression Test Device</friendlyName>
<modelURL>http://gupnp.org/</modelURL>
<UDN>uuid:1234</UDN>
+<iconList>
+<icon>
+<mimetype>image/png</mimetype>
+<width>24</width>
+<height>24</height>
+<depth>24</depth>
+<url>/icon-24x24x24.png</url>
+</icon>
+<icon>
+<mimetype>image/png</mimetype>
+<width>48</width>
+<height>48</height>
+<depth>24</depth>
+<url>/icon-48x48x24.png</url>
+</icon>
+<icon>
+<mimetype>image/png</mimetype>
+<width>120</width>
+<height>120</height>
+<depth>24</depth>
+<url>/icon-120x120x24.png</url>
+</icon>
+</iconList>
<serviceList>
<service>
<serviceType>urn:test-gupnp-org:service:TestService:1</serviceType>
diff --git a/tests/gtest/test-bugs.c b/tests/gtest/test-bugs.c
index 38dc08d..8578c26 100644
--- a/tests/gtest/test-bugs.c
+++ b/tests/gtest/test-bugs.c
@@ -380,6 +380,67 @@ test_bgo_690400 (void)
g_object_unref (context);
}
+/* Test that correct icons are returned for various size requests.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=722696 */
+static void
+test_bgo_722696 (void)
+{
+ GUPnPContext *context = NULL;
+ GError *error = NULL;
+ GUPnPRootDevice *rd;
+ char *icon;
+ int width;
+
+ context = gupnp_context_new (NULL, "lo", 0, &error);
+ g_assert (context != NULL);
+ g_assert (error == NULL);
+
+ rd = gupnp_root_device_new (context, "TestDevice.xml", DATA_PATH);
+
+ /* prefer bigger */
+ width = -1;
+ icon = gupnp_device_info_get_icon_url (GUPNP_DEVICE_INFO (rd),
+ NULL,
+ -1, -1, -1,
+ TRUE,
+ NULL, NULL, &width, NULL);
+ g_assert_cmpint (width, ==, 120);
+ g_free (icon);
+
+ /* prefer smaller */
+ width = -1;
+ icon = gupnp_device_info_get_icon_url (GUPNP_DEVICE_INFO (rd),
+ NULL,
+ -1, -1, -1,
+ FALSE,
+ NULL, NULL, &width, NULL);
+ g_assert_cmpint (width, ==, 24);
+ g_free (icon);
+
+ /* prefer width <= 119 */
+ width = -1;
+ icon = gupnp_device_info_get_icon_url (GUPNP_DEVICE_INFO (rd),
+ NULL,
+ -1, 119, -1,
+ FALSE,
+ NULL, NULL, &width, NULL);
+ g_assert_cmpint (width, ==, 48);
+ g_free (icon);
+
+ /* prefer width >= 119 */
+ width = -1;
+ icon = gupnp_device_info_get_icon_url (GUPNP_DEVICE_INFO (rd),
+ NULL,
+ -1, 119, -1,
+ TRUE,
+ NULL, NULL, &width, NULL);
+ g_assert_cmpint (width, ==, 120);
+ g_free (icon);
+
+ g_object_unref (rd);
+ g_object_unref (context);
+}
+
int
main (int argc, char *argv[]) {
#if !GLIB_CHECK_VERSION(2,35,0)
@@ -389,6 +450,7 @@ main (int argc, char *argv[]) {
g_test_add_func ("/bugs/696762", test_bgo_696762);
g_test_add_func ("/bugs/678701", test_bgo_678701);
g_test_add_func ("/bugs/690400", test_bgo_690400);
+ g_test_add_func ("/bugs/722696", test_bgo_722696);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]