[pango/pango2-windows] testattributes: Fix test on Visual Studio




commit c22b8d11fdc3a9307034b85ac0acccbc10dd51bc
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jun 15 18:00:55 2022 +0800

    testattributes: Fix test on Visual Studio
    
    The %p format indentifier is handled differently on Visual Studio, and
    we must account for differences in 64-bit and 32-bit builds... :|

 tests/testattributes.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/tests/testattributes.c b/tests/testattributes.c
index 63f37bdd..1b1f8885 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -155,7 +155,18 @@ test_attributes_register (void)
   pango_attr_list_insert (list, attr2);
 
   str = pango_attr_list_to_string (list);
+
+#ifdef _MSC_VER
+/* The Visual Studio CRT handles the format of the output produced by %p differently... */
+/* See: https://stackoverflow.com/questions/2369541/where-is-p-useful-with-printf */
+# ifdef _WIN64
+  g_assert_cmpstr (str, ==, "0 4294967295 my-attribute 0000000000000043");
+# else
+  g_assert_cmpstr (str, ==, "0 4294967295 my-attribute 00000043");
+# endif
+#else
   g_assert_cmpstr (str, ==, "0 4294967295 my-attribute 0x43");
+#endif
   g_free (str);
 
   pango_attr_list_unref (list);


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