summaryrefslogtreecommitdiff
path: root/test/invalid-matrix.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-01-17 23:05:53 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-02-15 13:50:41 +0000
commitf40f24e272cf05a7a727217ae7a35844bf95f5d2 (patch)
treedec6d093203405d2d3c08072d7999b506f5a48b7 /test/invalid-matrix.c
parent896da0305a09e53518d6d1af6f58bbfaf3ddc89c (diff)
[test/invalid] Test cairo_translate() and friends for NaN safety.
Pass NaNs to cairo_translate() and friends and check that they raise an INVALID_MATRIX error.
Diffstat (limited to 'test/invalid-matrix.c')
-rw-r--r--test/invalid-matrix.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/invalid-matrix.c b/test/invalid-matrix.c
index 8a5a9bff..0f0ef0c5 100644
--- a/test/invalid-matrix.c
+++ b/test/invalid-matrix.c
@@ -202,6 +202,43 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_pattern_destroy (pattern);
+ /* test invalid transformations */
+ cr2 = cairo_create (target);
+ cairo_translate (cr2, bogus.xx, bogus.yy);
+ CHECK_STATUS (status, "cairo_translate(NaN, NaN)");
+ cairo_destroy (cr2);
+
+ cr2 = cairo_create (target);
+ cairo_translate (cr2, 0, bogus.yy);
+ CHECK_STATUS (status, "cairo_translate(0, NaN)");
+ cairo_destroy (cr2);
+
+ cr2 = cairo_create (target);
+ cairo_translate (cr2, bogus.xx, 0);
+ CHECK_STATUS (status, "cairo_translate(NaN, 0)");
+ cairo_destroy (cr2);
+
+
+ cr2 = cairo_create (target);
+ cairo_scale (cr2, bogus.xx, bogus.yy);
+ CHECK_STATUS (status, "cairo_scale(NaN, NaN)");
+ cairo_destroy (cr2);
+
+ cr2 = cairo_create (target);
+ cairo_scale (cr2, 1, bogus.yy);
+ CHECK_STATUS (status, "cairo_scale(1, NaN)");
+ cairo_destroy (cr2);
+
+ cr2 = cairo_create (target);
+ cairo_scale (cr2, bogus.xx, 1);
+ CHECK_STATUS (status, "cairo_scale(NaN, 1)");
+ cairo_destroy (cr2);
+
+ cr2 = cairo_create (target);
+ cairo_rotate (cr2, bogus.xx);
+ CHECK_STATUS (status, "cairo_rotate(NaN)");
+ cairo_destroy (cr2);
+
return CAIRO_TEST_SUCCESS;
}