[glib/win32-enhance-gtimezone: 54/54] glib/tests/gdatetime.c: Fix TZ envvar test on Windows



commit 0bc9ec94621d50595df48660f5d4fe5edce5fafc
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Jun 13 16:53:45 2019 +0800

    glib/tests/gdatetime.c: Fix TZ envvar test on Windows
    
    Windows does not recognize the "America/Recife" as a valid timezone
    identifier, so setting the TZ envvar to that will result in "UTC" to
    be returned on Windows.
    
    Instead, set TZ to be the Windows equivilant "SA Eastern Standard
    Time", and see whether that is indeed our identifier when we create the
    GTimeZone using that.

 glib/tests/gdatetime.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
index 06d61a529..891b10b21 100644
--- a/glib/tests/gdatetime.c
+++ b/glib/tests/gdatetime.c
@@ -2437,12 +2437,21 @@ test_identifier (void)
   g_time_zone_unref (tz);
 
   /* Local timezone tests. */
+#ifdef G_OS_WIN32
+  if (g_setenv ("TZ", "SA Eastern Standard Time", TRUE))
+    {
+      tz = g_time_zone_new_local ();
+      g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "SA Eastern Standard Time");
+      g_time_zone_unref (tz);
+    }
+#else
   if (g_setenv ("TZ", "America/Recife", TRUE))
     {
       tz = g_time_zone_new_local ();
       g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "America/Recife");
       g_time_zone_unref (tz);
     }
+#endif
 
   if (g_setenv ("TZ", "some rubbish", TRUE))
     {


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