Package: colord / 1.4.5-3

fix-float-comparison-in-tests.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
commit 1c18eed8d8c416a37913e38b0b00c415e18ce79f
Author: Christopher James Halse Rogers <raof@ubuntu.com>
Date:   Wed Nov 11 17:13:19 2020 +1100

    tests: Don't use exact floating point comparisons.
    
    The tests asserting that cd_icc_get_version are exactly equal to 3.4 or
    2.09 fail on (at least) i386, armel, and s390x because floating point is
    hateful.
    
    Signed-off-by: Christopher James Halse Rogers <raof@ubuntu.com>

diff --git a/lib/colord/cd-test-private.c b/lib/colord/cd-test-private.c
index 4b16ca53..231c4aed 100644
--- a/lib/colord/cd-test-private.c
+++ b/lib/colord/cd-test-private.c
@@ -1494,7 +1494,7 @@ colord_icc_func (void)
 	/* check profile properties */
 	g_assert_cmpint (cd_icc_get_size (icc), ==, 25244);
 	g_assert_cmpstr (cd_icc_get_checksum (icc), ==, "9ace8cce8baac8d492a93a2a232d7702");
-	g_assert_cmpfloat (cd_icc_get_version (icc), ==, 3.4);
+	g_assert_cmpfloat_with_epsilon (cd_icc_get_version (icc), 3.4, 0.01);
 	g_assert (g_str_has_suffix (cd_icc_get_filename (icc), "ibm-t61.icc"));
 	g_assert_cmpint (cd_icc_get_kind (icc), ==, CD_PROFILE_KIND_DISPLAY_DEVICE);
 	g_assert_cmpint (cd_icc_get_colorspace (icc), ==, CD_COLORSPACE_RGB);
@@ -1727,7 +1727,7 @@ colord_icc_save_func (void)
 	g_object_unref (file);
 
 	/* verify changed values */
-	g_assert_cmpfloat (cd_icc_get_version (icc), ==, 2.09);
+	g_assert_cmpfloat_with_epsilon (cd_icc_get_version (icc), 2.09, 0.001);
 	g_assert_cmpint (cd_icc_get_kind (icc), ==, CD_PROFILE_KIND_OUTPUT_DEVICE);
 	g_assert_cmpint (cd_icc_get_colorspace (icc), ==, CD_COLORSPACE_XYZ);
 	g_assert_cmpstr (cd_icc_get_metadata_item (icc, "SelfTest"), ==, "true");