pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gnome-desktop: Reenable tests in wip/gnome-desktop3



Module Name:	pkgsrc-wip
Committed By:	Dan Cîrnaț <dan%alt.md@localhost>
Pushed By:	cirnatdan
Date:		Wed Nov 4 09:44:44 2020 +0100
Changeset:	c986202f7397c2351b8cf7979ca75f8bf018328e

Modified Files:
	gnome-desktop3/distinfo
	gnome-desktop3/patches/patch-tests_wall-clock.c
	gnome-desktop3/patches/patch-tests_wallclock-reftest.c

Log Message:
gnome-desktop: Reenable tests in wip/gnome-desktop3

Previously disabled tests now converted to setlocale()
Also, builds on macOS

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=c986202f7397c2351b8cf7979ca75f8bf018328e

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gnome-desktop3/distinfo                            |  4 +-
 gnome-desktop3/patches/patch-tests_wall-clock.c    | 91 ++++++++++++++++++----
 .../patches/patch-tests_wallclock-reftest.c        | 62 +++++++++++----
 3 files changed, 122 insertions(+), 35 deletions(-)

diffs:
diff --git a/gnome-desktop3/distinfo b/gnome-desktop3/distinfo
index 57cc6170d4..dadbecbbb8 100644
--- a/gnome-desktop3/distinfo
+++ b/gnome-desktop3/distinfo
@@ -6,5 +6,5 @@ SHA512 (gnome-desktop-3.38.1.tar.xz) = b3927f0b8571d2ecb528dbe3e096e816e4e90333c
 Size (gnome-desktop-3.38.1.tar.xz) = 745400 bytes
 SHA1 (patch-libgnome-desktop_gnome-languages.c) = 88878085009e36be056b90cce43019095e6d9ddf
 SHA1 (patch-libgnome-desktop_gnome-wall-clock.c) = fb8da1dcb408a78cbc427c69d510eaf2ca8a2fe7
-SHA1 (patch-tests_wall-clock.c) = 8272a46ddfa26c1b72204e7d465a5907d01fc266
-SHA1 (patch-tests_wallclock-reftest.c) = 0e3c39623718f0f5a18f86545ba8e4823796a4db
+SHA1 (patch-tests_wall-clock.c) = c3f4cd354538ea4f549f87762b333cb00a92d18d
+SHA1 (patch-tests_wallclock-reftest.c) = 53cee07db779808b0d9b31f64529ee48c2252bda
diff --git a/gnome-desktop3/patches/patch-tests_wall-clock.c b/gnome-desktop3/patches/patch-tests_wall-clock.c
index 65e7bcb4de..d3c0d65376 100644
--- a/gnome-desktop3/patches/patch-tests_wall-clock.c
+++ b/gnome-desktop3/patches/patch-tests_wall-clock.c
@@ -2,25 +2,82 @@ $NetBSD$
 
 Disable tests that rely on uselocale()
 
---- tests/wall-clock.c.orig	2020-04-29 01:53:29.099934300 +0000
+--- tests/wall-clock.c.orig	2020-10-05 19:11:19.000000000 +0000
 +++ tests/wall-clock.c
-@@ -30,6 +30,7 @@
- #define SPACE "  "
- #define EN_SPACE " "
+@@ -23,6 +23,9 @@
+ #include <libgnome-desktop/gnome-wall-clock.h>
+ #include <locale.h>
+ #include <string.h>
++#ifdef __APPLE__
++#include <xlocale.h>
++#endif
  
-+#if !defined(__NetBSD__)
- static void
- test_utf8_character (const char *utf8_char,
-                      const char *non_utf8_fallback)
-@@ -149,6 +150,7 @@ test_clock_format_setting (void)
- 	uselocale (save_locale);
- 	freelocale (locale);
+ #define COLON ":"
+ #define RATIO "∶"
+@@ -36,8 +39,7 @@ test_utf8_character (const char *utf8_ch
+ {
+ 	GDateTime  *datetime;
+ 	GnomeWallClock *clock;
+-	locale_t locale;
+-	locale_t save_locale;
++	g_autofree char *save_locale;
+ 	const char *str;
+ 
+ 	/* When testing that UTF8 locales don't use double spaces
+@@ -47,9 +49,9 @@ test_utf8_character (const char *utf8_ch
+ 
+ 	/* In the C locale, make sure the time string is formatted with regular
+          * colons */
+-	locale = newlocale (LC_ALL_MASK, "C", (locale_t) 0);
+-	g_assert_true (locale != (locale_t)0);
+-	save_locale = uselocale (locale);
++	save_locale = setlocale (LC_ALL_MASK, NULL);
++	g_assert_true (save_locale != NULL);
++	setlocale (LC_ALL_MASK, "C");
+ 	clock = gnome_wall_clock_new ();
+ 	str = gnome_wall_clock_string_for_datetime (clock,
+ 	                                            datetime,
+@@ -60,13 +62,7 @@ test_utf8_character (const char *utf8_ch
+ 	g_object_unref (clock);
+ 
+ 	/* In a UTF8 locale, we want ratio characters and no colons. */
+-	locale = newlocale (LC_ALL_MASK, "en_US.utf8", locale);
+-	if (locale == (locale_t)0) {
+-		g_test_message ("en_US.utf8 locale not found");
+-		g_test_fail ();
+-		return;
+-	}
+-	uselocale (locale);
++	setlocale (LC_ALL_MASK, "en_US.utf8");
+ 	clock = gnome_wall_clock_new ();
+ 	str = gnome_wall_clock_string_for_datetime (clock,
+ 	                                            datetime,
+@@ -78,13 +74,7 @@ test_utf8_character (const char *utf8_ch
+ 
+ 	/* ... and same thing with an RTL locale: should be formatted with
+          * ratio characters */
+-	locale = newlocale (LC_ALL_MASK, "he_IL.utf8", locale);
+-	if (locale == (locale_t)0) {
+-		g_test_message ("he_IL.utf8 locale not found");
+-		g_test_fail ();
+-		return;
+-	}
+-	uselocale (locale);
++	setlocale (LC_ALL_MASK, "he_IL.utf8");
+ 	clock = gnome_wall_clock_new ();
+ 	str = gnome_wall_clock_string_for_datetime (clock,
+ 	                                            datetime,
+@@ -97,8 +87,7 @@ test_utf8_character (const char *utf8_ch
+ 	g_date_time_unref (datetime);
+ 
+ 	/* Restore previous locale */
+-	uselocale (save_locale);
+-	freelocale (locale);
++	setlocale (LC_ALL_MASK, save_locale);
  }
-+#endif
  
- static gboolean
- on_notify_clock_timeout (gpointer user_data)
-@@ -194,6 +196,7 @@ test_notify_clock (void)
+ static void
+@@ -197,6 +186,7 @@ test_notify_clock (void)
  	g_object_unref (settings);
  }
  
@@ -28,7 +85,7 @@ Disable tests that rely on uselocale()
  static void
  test_weekday_setting (void)
  {
-@@ -245,6 +248,7 @@ test_weekday_setting (void)
+@@ -248,6 +238,7 @@ test_weekday_setting (void)
  	uselocale (save_locale);
  	freelocale (locale);
  }
@@ -36,7 +93,7 @@ Disable tests that rely on uselocale()
  
  int
  main (int   argc,
-@@ -254,11 +258,15 @@ main (int   argc,
+@@ -257,11 +248,15 @@ main (int   argc,
  
  	g_test_init (&argc, &argv, NULL);
  
diff --git a/gnome-desktop3/patches/patch-tests_wallclock-reftest.c b/gnome-desktop3/patches/patch-tests_wallclock-reftest.c
index 43c9e4dd87..ef65a43c6e 100644
--- a/gnome-desktop3/patches/patch-tests_wallclock-reftest.c
+++ b/gnome-desktop3/patches/patch-tests_wallclock-reftest.c
@@ -2,25 +2,55 @@ $NetBSD$
 
 Disable tests that rely on uselocale()
 
---- tests/wallclock-reftest.c.orig	2020-04-29 01:53:29.099934300 +0000
+--- tests/wallclock-reftest.c.orig	2020-10-05 19:11:19.000000000 +0000
 +++ tests/wallclock-reftest.c
-@@ -433,6 +433,7 @@ static void
- test_ui_file (GFile         *file,
-               gconstpointer  user_data)
- {
-+#if !defined(__NetBSD__)
-   char *ui_file, *reference_file, *locale;
-   cairo_surface_t *ui_image, *reference_image, *diff_image;
-   GtkStyleProvider *provider;
-@@ -494,6 +495,7 @@ test_ui_file (GFile         *file,
-     }
- 
-   remove_extra_css (provider);
+@@ -26,6 +26,9 @@
+ #include <gtk/gtk.h>
+ #define GNOME_DESKTOP_USE_UNSTABLE_API 1
+ #include <libgnome-desktop/gnome-wall-clock.h>
++#ifdef __APPLE__
++#include <xlocale.h>
 +#endif
- }
  
- static int
-@@ -612,3 +614,4 @@ main (int argc, char **argv)
+ static const char *output_dir = NULL;
+ 
+@@ -439,21 +442,15 @@ test_ui_file (GFile         *file,
+   GnomeWallClock *clock;
+   GDateTime *datetime;
+   char *str;
+-  locale_t loc, previous_locale;
++  g_autofree char *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);
+-  if (loc == (locale_t)0)
+-    {
+-      g_test_message ("locale '%s' not found", locale);
+-      g_test_fail();
+-      return;
+-    }
+-  previous_locale = uselocale (loc);
+-  g_assert_true (previous_locale != (locale_t) 0);
++  previous_locale = g_strdup (setlocale (LC_ALL_MASK, NULL));
++  g_assert_true (previous_locale != NULL);
++  setlocale (LC_ALL_MASK, locale);
+ 
+   clock = gnome_wall_clock_new ();
+   datetime = g_date_time_new_local (2014, 5, 28, 23, 59, 59);
+@@ -465,8 +462,7 @@ test_ui_file (GFile         *file,
+   g_date_time_unref (datetime);
+   g_object_unref (clock);
+ 
+-  uselocale (previous_locale);
+-  freelocale (loc);
++  setlocale (LC_ALL_MASK, previous_locale);
+ 
+   provider = add_extra_css (ui_file, ".css");
+ 
+@@ -616,3 +612,4 @@ main (int argc, char **argv)
  
    return g_test_run ();
  }


Home | Main Index | Thread Index | Old Index