cogl/tests: Compare matrices using array

We'll remove direct access to CoglMatrix struct fields, so update
the test to not access them already.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-08 19:36:13 -03:00
parent dc9c1f8983
commit 566b081cd7

View File

@ -15,24 +15,19 @@
g_assert_cmpfloat ((a), ==, (b)); \ g_assert_cmpfloat ((a), ==, (b)); \
} while (0) } while (0)
#define COMPARE_ELEMENT(a, b, idx) \
do { \
COMPARE_FLOATS (a[idx], b[idx]); \
} while (0)
#define COMPARE_MATRICES(a, b) \ #define COMPARE_MATRICES(a, b) \
do { \ do { \
COMPARE_FLOATS ((a)->xx, (b)->xx); \ const float *af = cogl_matrix_get_array (a);\
COMPARE_FLOATS ((a)->yx, (b)->yx); \ const float *bf = cogl_matrix_get_array (b);\
COMPARE_FLOATS ((a)->zx, (b)->zx); \ int i; \
COMPARE_FLOATS ((a)->wx, (b)->wx); \ \
COMPARE_FLOATS ((a)->xy, (b)->xy); \ for (i = 0; i < 16; i++) \
COMPARE_FLOATS ((a)->yy, (b)->yy); \ COMPARE_ELEMENT (af, bf, i); \
COMPARE_FLOATS ((a)->zy, (b)->zy); \
COMPARE_FLOATS ((a)->wy, (b)->wy); \
COMPARE_FLOATS ((a)->xz, (b)->xz); \
COMPARE_FLOATS ((a)->yz, (b)->yz); \
COMPARE_FLOATS ((a)->zz, (b)->zz); \
COMPARE_FLOATS ((a)->wz, (b)->wz); \
COMPARE_FLOATS ((a)->xw, (b)->xw); \
COMPARE_FLOATS ((a)->yw, (b)->yw); \
COMPARE_FLOATS ((a)->zw, (b)->zw); \
COMPARE_FLOATS ((a)->ww, (b)->ww); \
} while (0) } while (0)
void void