From 61a843e8244c0c0ffa6412eb544b89e2a5c038fa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 15 Jul 2022 23:08:28 -0400 Subject: [PATCH] gdk: Improve test coverage --- testsuite/gdk/image-data/image-float.tiff | Bin 0 -> 20941 bytes testsuite/gdk/image.c | 1 + testsuite/gdk/rgba.c | 28 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 testsuite/gdk/image-data/image-float.tiff diff --git a/testsuite/gdk/image-data/image-float.tiff b/testsuite/gdk/image-data/image-float.tiff new file mode 100644 index 0000000000000000000000000000000000000000..cdf42dd008f055c6f7a216c7083c96a7dbf733ee GIT binary patch literal 20941 zcmeI234B!LwZLyctEKw7+0EMDn-^`1wv)_E7L%B{R~8rgh^2saseP}LnMs(EOwySF zBCqfL6j5AIaYsZ&+!Yl!L`6kKrLNQkQ4#mus&&B?dFOv7XL55(fxN=+M;{5l%l*!` zobUV2e$Jf{Bld8%-`nZ`>!(0J1^Ow_Pl0|4^i!ap0?wb7?(g#4vt+oum%8u1^N#z$ z`|rDNy#BiT@#={l?T=TlcK`DB+pgmr;r;c!_uP*@{Lp>t%{LWheh{|x%x7H?2FGi! zzN+iN6NJI}%F8e7IOhn$;C$)D7j>L@%z5GY=iSdfJ=}Y0#lh~gD-U!3ylhnW9_wfF z)_#AZ-*c;036I-6p@;Xt{lD<;yLVp?{=NQMtM|t1{X7A;flHLo? z|4zrBdHPUK_z7PXe(cfF-V=|H^@P6)-*LO^-MM&gZ_%xLDg5lpl`0EQE?@3)uJv=@ zaklpRqlf4q`UAa|J@QKr8XJ92nemPIweutHjW^t&`gXybQ2fRls@w{Ie_YpZi2qyr{oy-0 z0NvpK!w)s73_SAi0ZLEN(>ONrj@xfndY(9a2lvV=u5f3b^*tRw@(9Ph^pZ>5v(Egk z!e^a%rrP5xuh>K3tLFV&d3)~cT@)4{6F+zMZ1?ojzOC>DbLOc1zxt}M!ti;@k!9ZX z*TodR{<`bjwO@YeUUzL&VX^g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 0 HcmV?d00001 diff --git a/testsuite/gdk/image.c b/testsuite/gdk/image.c index 1bfdcf001e..12b02c172d 100644 --- a/testsuite/gdk/image.c +++ b/testsuite/gdk/image.c @@ -129,6 +129,7 @@ main (int argc, char *argv[]) g_test_add_data_func ("/image/load/tiff", "image.tiff", test_load_image); g_test_add_data_func ("/image/load/tiff2", "image-unassoc.tiff", test_load_image); g_test_add_data_func ("/image/load/tiff3", "image-tile.tiff", test_load_image); + g_test_add_data_func ("/image/load/tiff4", "image-float.tiff", test_load_image); g_test_add_data_func ("/image/load/jpeg", "image.jpeg", test_load_image); g_test_add_data_func ("/image/load/jpeg2", "image-cmyk.jpeg", test_load_image); g_test_add_data_func ("/image/load/jpeg3", "image-gray.jpeg", test_load_image); diff --git a/testsuite/gdk/rgba.c b/testsuite/gdk/rgba.c index e6f691ed77..59f32f4126 100644 --- a/testsuite/gdk/rgba.c +++ b/testsuite/gdk/rgba.c @@ -178,6 +178,33 @@ test_color_parse_nonsense (void) res = gdk_rgba_parse (&color, "rgb(0,0,0) moo"); g_assert_false (res); + + res = gdk_rgba_parse (&color, "#XGB"); + g_assert_false (res); + + res = gdk_rgba_parse (&color, "#XGBQ"); + g_assert_false (res); + + res = gdk_rgba_parse (&color, "#AAAAXGBQ"); + g_assert_false (res); +} + +static void +test_color_hash (void) +{ + GdkRGBA color1; + GdkRGBA color2; + guint hash1, hash2; + + gdk_rgba_parse (&color1, "hsla (120, 255, 50%, 0.1)"); + gdk_rgba_parse (&color2, "rgb(0,0,0)"); + + hash1 = gdk_rgba_hash (&color1); + hash2 = gdk_rgba_hash (&color2); + + g_assert_cmpuint (hash1, !=, 0); + g_assert_cmpuint (hash2, !=, 0); + g_assert_cmpuint (hash1, !=, hash2); } int @@ -189,6 +216,7 @@ main (int argc, char *argv[]) g_test_add_func ("/rgba/parse/nonsense", test_color_parse_nonsense); g_test_add_func ("/rgba/to-string", test_color_to_string); g_test_add_func ("/rgba/copy", test_color_copy); + g_test_add_func ("/rgba/hash", test_color_hash); return g_test_run (); }