[gnome-desktop] tests: Further improve uselocale useage



commit ce3fe02a2e0d3d516b2970c6763a7af2136b9a49
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Feb 20 18:25:45 2019 -0600

    tests: Further improve uselocale useage

 tests/wallclock-reftest.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/tests/wallclock-reftest.c b/tests/wallclock-reftest.c
index 42783869..8ac630f2 100644
--- a/tests/wallclock-reftest.c
+++ b/tests/wallclock-reftest.c
@@ -439,18 +439,17 @@ test_ui_file (GFile         *file,
   GnomeWallClock *clock;
   GDateTime *datetime;
   char *str;
-  locale_t loc, set_locale;
+  locale_t loc, previous_locale;
 
   ui_file = g_file_get_path (file);
 
   locale = get_locale_for_file (ui_file);
   g_assert (locale);
   loc = newlocale (LC_ALL_MASK, locale, (locale_t) 0);
-  set_locale = uselocale (loc);
-  /*TODO: CI fails when I tried to use freelocale (loc); later */
-  g_assert_true (set_locale != (locale_t) 0);
+  previous_locale = uselocale (loc);
+  g_assert_true (previous_locale != (locale_t) 0);
 
-  clock = gnome_wall_clock_new();
+  clock = gnome_wall_clock_new ();
   datetime = g_date_time_new_local (2014, 5, 28, 23, 59, 59);
   str = gnome_wall_clock_string_for_datetime (clock,
                                              datetime,
@@ -460,6 +459,9 @@ test_ui_file (GFile         *file,
   g_date_time_unref (datetime);
   g_object_unref (clock);
 
+  uselocale (previous_locale);
+  freelocale (loc);
+
   provider = add_extra_css (ui_file, ".css");
 
   ui_image = snapshot_ui_file (ui_file, str);


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