[evolution-data-server] tests: Workaround libphonenumber behavior change



commit f74a0975f4bc6f2261e7823c34fbcee2edbf8745
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 10 15:33:57 2021 +0200

    tests: Workaround libphonenumber behavior change
    
    Turn off the sub-test, because different libphonenumber behaves
    differently. Having a (runtime) way to check the libphonenumber version
    it could be adapted in a better way.

 tests/libedata-book/data-test-utils.c                      | 1 +
 tests/libedata-book/test-book-cache-cursor-change-locale.c | 5 +++--
 tests/libedata-book/test-book-cache-utils.c                | 1 +
 tests/libedata-book/test-sqlite-cursor-change-locale.c     | 5 +++--
 4 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/tests/libedata-book/data-test-utils.c b/tests/libedata-book/data-test-utils.c
index 633771b0e..9b7c84a60 100644
--- a/tests/libedata-book/data-test-utils.c
+++ b/tests/libedata-book/data-test-utils.c
@@ -645,6 +645,7 @@ test_step (EbSqlCursorFixture *fixture,
                         * contact changes only happen because of e164 number interpretations.
                         */
                        if (e_phone_number_is_supported () &&
+                           assertion->count != -1 &&
                            assertion->count != n_locale_changes)
                                g_error (
                                        "Expected %d e164 numbers to change, %d actually changed.",
diff --git a/tests/libedata-book/test-book-cache-cursor-change-locale.c 
b/tests/libedata-book/test-book-cache-cursor-change-locale.c
index cce27a0b0..c98ecba38 100644
--- a/tests/libedata-book/test-book-cache-cursor-change-locale.c
+++ b/tests/libedata-book/test-book-cache-cursor-change-locale.c
@@ -84,7 +84,7 @@ main (gint argc,
                tcu_step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
                tcu_step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
 
-               /* When changing from fr_CA to de_DE, two numbers change:
+               /* Depending on the libphonenumber, when changing from fr_CA to de_DE, two numbers change:
                 *
                 * sorted-5:
                 *    049-2459-4393 is now parsed with the national number as 4924594393
@@ -92,8 +92,9 @@ main (gint argc,
                 * sorted-4:
                 *    12 245999 is now parsed with national number 12245999 instead of 2245999
                 *
+                * or only one. Skip this check, because a lack of a way to get the libphonenumber version.
                 */
-               tcu_step_test_change_locale (data, "de_DE.UTF-8", 2);
+               tcu_step_test_change_locale (data, "de_DE.UTF-8", -1);
                tcu_step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
                tcu_step_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
                tcu_step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
diff --git a/tests/libedata-book/test-book-cache-utils.c b/tests/libedata-book/test-book-cache-utils.c
index 6ff294596..7be44e4dc 100644
--- a/tests/libedata-book/test-book-cache-utils.c
+++ b/tests/libedata-book/test-book-cache-utils.c
@@ -579,6 +579,7 @@ test_step (TCUCursorFixture *fixture,
                         * contact changes only happen because of e164 number interpretations.
                         */
                        if (e_phone_number_is_supported () &&
+                           assertion->count != -1 &&
                            assertion->count != n_locale_changes)
                                g_error ("Expected %d e164 numbers to change, %d actually changed.",
                                        assertion->count, n_locale_changes);
diff --git a/tests/libedata-book/test-sqlite-cursor-change-locale.c 
b/tests/libedata-book/test-sqlite-cursor-change-locale.c
index 859857a39..65671d1df 100644
--- a/tests/libedata-book/test-sqlite-cursor-change-locale.c
+++ b/tests/libedata-book/test-sqlite-cursor-change-locale.c
@@ -87,7 +87,7 @@ main (gint argc,
                step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
                step_test_add_assertion (data, 5, 13, 12, 9,  19, 20);
 
-               /* When changing from fr_CA to de_DE, two numbers change:
+               /* Depending on the libphonenumber, when changing from fr_CA to de_DE, two numbers change:
                 *
                 * sorted-5:
                 *    049-2459-4393 is now parsed with the national number as 4924594393
@@ -95,8 +95,9 @@ main (gint argc,
                 * sorted-4:
                 *    12 245999 is now parsed with national number 12245999 instead of 2245999
                 *
+                * or only one. Skip this check, because a lack of a way to get the libphonenumber version.
                 */
-               step_test_change_locale (data, "de_DE.UTF-8", 2);
+               step_test_change_locale (data, "de_DE.UTF-8", -1);
                step_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
                step_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
                step_test_add_assertion (data, 5, 17, 16, 18, 10, 14);


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