[pango/test-coverage: 2/15] tests: Add some color tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/test-coverage: 2/15] tests: Add some color tests
- Date: Sun, 27 Jun 2021 22:56:03 +0000 (UTC)
commit e94f4e3dc8ad3d3f363331009d2e3fa45fd5887a
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 26 14:52:24 2021 -0400
tests: Add some color tests
tests/testcolor.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
---
diff --git a/tests/testcolor.c b/tests/testcolor.c
index 62bbe4bf..6f2a3328 100644
--- a/tests/testcolor.c
+++ b/tests/testcolor.c
@@ -122,12 +122,40 @@ test_color (void)
test_one_color (spec);
}
+static void
+test_color_copy (void)
+{
+ PangoColor orig = { 0, 200, 5000 };
+ PangoColor *copy;
+
+ copy = pango_color_copy (&orig);
+
+ g_assert_cmpint (orig.red, ==, copy->red);
+ g_assert_cmpint (orig.green, ==, copy->green);
+ g_assert_cmpint (orig.blue, ==, copy->blue);
+
+ pango_color_free (copy);
+}
+
+static void
+test_color_serialize (void)
+{
+ PangoColor orig = { 0, 200, 5000 };
+ char *string;
+
+ string = pango_color_to_string (&orig);
+
+ g_assert_cmpstr (string, ==, "#000000c81388");
+}
+
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/color/parse", test_color);
+ g_test_add_func ("/color/copy", test_color_copy);
+ g_test_add_func ("/color/serialize", test_color_serialize);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]