[gtk/test-coverage: 4/7] gdk: Improve test coverage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/test-coverage: 4/7] gdk: Improve test coverage
- Date: Sat, 16 Jul 2022 13:44:04 +0000 (UTC)
commit 61a843e8244c0c0ffa6412eb544b89e2a5c038fa
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 15 23:08:28 2022 -0400
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(+)
---
diff --git a/testsuite/gdk/image-data/image-float.tiff b/testsuite/gdk/image-data/image-float.tiff
new file mode 100644
index 0000000000..cdf42dd008
Binary files /dev/null and b/testsuite/gdk/image-data/image-float.tiff differ
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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]