[glib] Enable contenttype test on W32, tweak it to pass (mostly)



commit ce985f13f475fbb2b1f8c7d5a1e5ff1fa12a8e81
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Sat May 2 23:46:06 2015 +0000

    Enable contenttype test on W32, tweak it to pass (mostly)
    
    * On W32 use a real directory (SYSTEMROOT) instead of '/etc/'
    * Disable test_symbolic_icon() as it can't be passed (symbolic icons are not
      really supported)
    
    * PowerPoint/Gettext test still fails, presumably because msvcrt qsort() moves
      the entires (both have the same priority)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735696

 gio/tests/Makefile.am   |    2 +-
 gio/tests/contenttype.c |   15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index cc7deb3..0553fdf 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -27,6 +27,7 @@ test_programs = \
        buffered-output-stream                  \
        cancellable                             \
        contexts                                \
+       contenttype                             \
        converter-stream                        \
        credentials                             \
        data-input-stream                       \
@@ -242,7 +243,6 @@ gdbus_daemon_SOURCES = \
 
 if OS_UNIX
 test_programs += \
-       contenttype                             \
        file                                    \
        gdbus-peer-object-manager               \
        gdbus-unix-addresses                    \
diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c
index 52487ca..8c08da6 100644
--- a/gio/tests/contenttype.c
+++ b/gio/tests/contenttype.c
@@ -18,6 +18,7 @@ test_guess (void)
 {
   gchar *res;
   gchar *expected;
+  gchar *existing_directory;
   gboolean uncertain;
   guchar data[] =
     "[Desktop Entry]\n"
@@ -25,7 +26,17 @@ test_guess (void)
     "Name=appinfo-test\n"
     "Exec=./appinfo-test --option\n";
 
-  res = g_content_type_guess ("/etc/", NULL, 0, &uncertain);
+#ifdef G_OS_WIN32
+  existing_directory = (gchar *) g_getenv ("SYSTEMROOT");
+
+  if (existing_directory)
+    existing_directory = g_strdup_printf ("%s/", existing_directory);
+#else
+  existing_directory = g_strdup ("/etc/");
+#endif
+
+  res = g_content_type_guess (existing_directory, NULL, 0, &uncertain);
+  g_free (existing_directory);
   expected = g_content_type_from_mime_type ("inode/directory");
   g_assert_content_type_equals (expected, res);
   g_assert (uncertain);
@@ -237,6 +248,7 @@ test_icon (void)
 static void
 test_symbolic_icon (void)
 {
+#ifndef G_OS_WIN32
   gchar *type;
   GIcon *icon;
 
@@ -271,6 +283,7 @@ test_symbolic_icon (void)
     }
   g_object_unref (icon);
   g_free (type);
+#endif
 }
 
 static void


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