Upload Tizen2.0 source
[framework/graphics/cairo.git] / TC / testcase / cairo-test.h
1 #ifndef _CAIRO_COMMON_H_
2 #define _CAIRO_COMMON_H_
3
4 //#include "cairo-boilerplate.h"
5
6 #include <stdarg.h>
7 #include <stdint.h>
8 #include <math.h>
9
10 #define MIN(a, b) ((a) < (b) ? (a) : (b))
11 #define MAX(a, b) ((a) > (b) ? (a) : (b))
12 #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
13
14 #define CAIRO_TEST_OUTPUT_DIR "output"
15 #define CAIRO_TEST_LOG_SUFFIX ".log"
16 #define CAIRO_TEST_FONT_FAMILY "DejaVu"
17
18 /* What is a fail and what isn't?
19  * When running the test suite we want to detect unexpected output. This
20  * can be caused by a change we have made to cairo itself, or a change
21  * in our environment. To capture this we classify the expected output into 3
22  * classes:
23  *
24  *   REF  -- Perfect output.
25  *           Might be different for each backend, due to slight implementation
26  *           differences.
27  *
28  *   NEW  -- A new failure. We have uncovered a bug within cairo and have
29  *           recorded the current failure (along with the expected output
30  *           if possible!) so we can detect any changes in our attempt to
31  *           fix the bug.
32  *
33  *  XFAIL -- An external failure. We believe the cairo output is perfect,
34  *           but an external renderer is causing gross failure.
35  *           (We also use this to capture current WONTFIX issues within cairo,
36  *           such as overflow in internal coordinates, so as not to distract
37  *           us when regression testing.)
38  *
39  *  If no REF is given for a test, then it is assumed to be XFAIL.
40  */
41 #define CAIRO_TEST_REF_SUFFIX ".ref"
42 #define CAIRO_TEST_XFAIL_SUFFIX ".xfail"
43 #define CAIRO_TEST_NEW_SUFFIX ".new"
44
45 #define CAIRO_TEST_OUT_SUFFIX ".out"
46 #define CAIRO_TEST_DIFF_SUFFIX ".diff"
47
48 #define CAIRO_TEST_PNG_EXTENSION ".png"
49 #define CAIRO_TEST_OUT_PNG CAIRO_TEST_OUT_SUFFIX CAIRO_TEST_PNG_EXTENSION
50 #define CAIRO_TEST_REF_PNG CAIRO_TEST_REF_SUFFIX CAIRO_TEST_PNG_EXTENSION
51 #define CAIRO_TEST_DIFF_PNG CAIRO_TEST_DIFF_SUFFIX CAIRO_TEST_PNG_EXTENSION
52
53 typedef enum cairo_test_status {
54     CAIRO_TEST_SUCCESS = 0,
55     CAIRO_TEST_NO_MEMORY,
56     CAIRO_TEST_FAILURE,
57     CAIRO_TEST_NEW,
58     CAIRO_TEST_XFAILURE,
59     CAIRO_TEST_ERROR,
60     CAIRO_TEST_CRASHED,
61     CAIRO_TEST_UNTESTED = 77 /* match automake's skipped exit status */
62 } cairo_test_status_t;
63
64 #define CAIRO_TEST_DOUBLE_EQUALS(a,b)  (fabs((a)-(b)) < 0.00001)
65
66 #endif