[cairo-commit] test/cairo-test.h test/invalid-matrix.c
Jeff Muizelaar
jrmuizel at kemper.freedesktop.org
Wed Feb 4 06:39:32 PST 2009
test/cairo-test.h | 3 +++
test/invalid-matrix.c | 22 ++--------------------
2 files changed, 5 insertions(+), 20 deletions(-)
New commits:
commit 2676b3bdd6fbeef62d34c100718f76fe5bbe647d
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date: Tue Feb 3 14:18:44 2009 -0500
[test] Define INFINITY if it hasn't been defined.
This lets us use more of invalid-matrix on win32
diff --git a/test/cairo-test.h b/test/cairo-test.h
index a9dbf19..8e068f0 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -60,6 +60,9 @@ typedef unsigned __int64 uint64_t;
#include <math.h>
+/* remove this if you don't have IEEE754 floating point */
+#define HAVE_IEEE754
+
typedef enum cairo_test_status {
CAIRO_TEST_SUCCESS = 0,
CAIRO_TEST_NO_MEMORY,
diff --git a/test/invalid-matrix.c b/test/invalid-matrix.c
index 43dd6ed..62d3220 100644
--- a/test/invalid-matrix.c
+++ b/test/invalid-matrix.c
@@ -29,8 +29,8 @@
#include "cairo-test.h"
-#ifdef INFINITY
-#define HAVE_INFINITY 1
+#if defined(HAVE_IEEE754) && !defined(INFINITY)
+#define INFINITY (0./1.)
#endif
#if HAVE_FEDISABLEEXCEPT
@@ -79,12 +79,10 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
status = cairo_matrix_invert (&bogus);
CHECK_STATUS (status, "cairo_matrix_invert(NaN)");
-#if HAVE_INFINITY
inf.x0 = inf.xy = inf.xx = INFINITY;
inf.y0 = inf.yx = inf.yy = inf.xx;
status = cairo_matrix_invert (&inf);
CHECK_STATUS (status, "cairo_matrix_invert(infinity)");
-#endif
/* test cairo_matrix_invert with invalid matrix */
status = cairo_matrix_invert (&invalid);
@@ -111,7 +109,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_destroy (cr2);
CHECK_STATUS (status, "cairo_transform(NaN)");
-#if HAVE_INFINITY
/* test cairo_transform with â matrix */
cr2 = cairo_create (target);
cairo_transform (cr2, &inf);
@@ -119,7 +116,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
status = cairo_status (cr2);
cairo_destroy (cr2);
CHECK_STATUS (status, "cairo_transform(infinity)");
-#endif
/* test cairo_set_matrix with invalid matrix */
@@ -138,7 +134,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_destroy (cr2);
CHECK_STATUS (status, "cairo_set_matrix(NaN)");
-#if HAVE_INFINITY
/* test cairo_set_matrix with â matrix */
cr2 = cairo_create (target);
cairo_set_matrix (cr2, &inf);
@@ -146,7 +141,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
status = cairo_status (cr2);
cairo_destroy (cr2);
CHECK_STATUS (status, "cairo_set_matrix(infinity)");
-#endif
/* test cairo_set_font_matrix with invalid matrix */
@@ -171,7 +165,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_destroy (cr2);
CHECK_STATUS (status, "cairo_set_font_matrix(NaN)");
-#if HAVE_INFINITY
/* test cairo_set_font_matrix with â matrix */
cr2 = cairo_create (target);
cairo_set_font_matrix (cr2, &inf);
@@ -182,7 +175,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
status = cairo_status (cr2);
cairo_destroy (cr2);
CHECK_STATUS (status, "cairo_set_font_matrix(infinity)");
-#endif
/* test cairo_scaled_font_create with invalid matrix */
@@ -235,7 +227,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_font_options_destroy (font_options);
cairo_destroy (cr2);
-#if HAVE_INFINITY
/* test cairo_scaled_font_create with â matrix */
cr2 = cairo_create (target);
font_face = cairo_get_font_face (cr2);
@@ -260,7 +251,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_scaled_font_destroy (scaled_font);
cairo_font_options_destroy (font_options);
cairo_destroy (cr2);
-#endif
/* test cairo_pattern_set_matrix with invalid matrix */
@@ -277,14 +267,12 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
CHECK_STATUS (status, "cairo_pattern_set_matrix(NaN)");
cairo_pattern_destroy (pattern);
-#if HAVE_INFINITY
/* test cairo_pattern_set_matrix with â matrix */
pattern = cairo_pattern_create_rgb (1.0, 1.0, 1.0);
cairo_pattern_set_matrix (pattern, &inf);
status = cairo_pattern_status (pattern);
CHECK_STATUS (status, "cairo_pattern_set_matrix(infinity)");
cairo_pattern_destroy (pattern);
-#endif
/* test invalid transformations */
@@ -303,7 +291,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
CHECK_STATUS (status, "cairo_translate(NaN, 0)");
cairo_destroy (cr2);
-#if HAVE_INFINITY
cr2 = cairo_create (target);
cairo_translate (cr2, inf.xx, inf.yy);
CHECK_STATUS (status, "cairo_translate(â, â)");
@@ -318,7 +305,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_translate (cr2, inf.xx, 0);
CHECK_STATUS (status, "cairo_translate(â, 0)");
cairo_destroy (cr2);
-#endif
cr2 = cairo_create (target);
@@ -336,7 +322,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
CHECK_STATUS (status, "cairo_scale(NaN, 1)");
cairo_destroy (cr2);
-#if HAVE_INFINITY
cr2 = cairo_create (target);
cairo_scale (cr2, inf.xx, inf.yy);
CHECK_STATUS (status, "cairo_scale(â, â)");
@@ -351,7 +336,6 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
cairo_scale (cr2, inf.xx, 1);
CHECK_STATUS (status, "cairo_scale(â, 1)");
cairo_destroy (cr2);
-#endif
cr2 = cairo_create (target);
cairo_scale (cr2, bogus.xx, bogus.yy);
@@ -374,12 +358,10 @@ if ((status) == CAIRO_STATUS_SUCCESS) { \
CHECK_STATUS (status, "cairo_rotate(NaN)");
cairo_destroy (cr2);
-#if HAVE_INFINITY
cr2 = cairo_create (target);
cairo_rotate (cr2, inf.xx);
CHECK_STATUS (status, "cairo_rotate(â)");
cairo_destroy (cr2);
-#endif
return CAIRO_TEST_SUCCESS;
}
More information about the cairo-commit
mailing list