summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_matrix.c
blob: e8fb89185d31fc365a20b929a9918ce8d9580688 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#include "../../lib/evas/include/evas_common_private.h"
#include "../../lib/evas/include/evas_private.h"

#include "evas_suite.h"
#include "evas_tests_helpers.h"

START_TEST(evas_matrix)
{
   Eina_Vector3 position;
   Eina_Quaternion orientation;
   Eina_Vector3 scale;
   Eina_Matrix4 mat;

   eina_vector3_set(&position, 5.0, 3.0, 2.0);
   eina_quaternion_set(&orientation, 30.0, 1.0, 0.0, 0.0);
   eina_vector3_set(&scale, 1.0, 2.0, 1.0);

   evas_mat4_build(&mat, &position, &orientation, &scale);
   fail_if((mat.xx != -1) || (mat.xy != 60) ||
           (mat.wx != 5) || (mat.wy != 3) ||
           (mat.wz != 2) || (mat.ww != 1));

   evas_mat4_inverse_build(&mat, &position, &orientation, &scale);
   fail_if((mat.xx - 0.99 < DBL_EPSILON) || (mat.xy - 0.0 < DBL_EPSILON) ||
           (mat.yx -0.0 < DBL_EPSILON) || (mat.yy -0.49 < DBL_EPSILON));
}
END_TEST

void evas_test_matrix(TCase *tc)
{
   (void) _setup_evas;
   tcase_add_test(tc, evas_matrix);
}