eina: add test cases for various APIs in eina_quad module.

Summary:
Added test cases for all the APIs in einq_quad module

Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>

Reviewers: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2551

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Vivek Ellur 2015-05-26 18:31:55 +02:00 committed by Cedric BAIL
parent 4cb4a8c70a
commit 331068b84a
4 changed files with 68 additions and 1 deletions

View File

@ -309,7 +309,8 @@ tests/eina/eina_test_tmpstr.c \
tests/eina/eina_test_trash.c \
tests/eina/eina_test_lock.c \
tests/eina/eina_test_xattr.c \
tests/eina/eina_test_crc.c
tests/eina/eina_test_crc.c \
tests/eina/eina_test_quad.c
# tests/eina/eina_test_model.c

View File

@ -80,6 +80,7 @@ static const Eina_Test_Case etc[] = {
{ "Xattr", eina_test_xattr },
#endif
{"Crc", eina_test_crc },
{"Quad", eina_test_quad },
{ NULL, NULL }
};

View File

@ -65,5 +65,6 @@ void eina_test_abi(TCase *tc);
void eina_test_trash(TCase *tc);
void eina_test_xattr(TCase *tc);
void eina_test_crc(TCase *tc);
void eina_test_quad(TCase *tc);
#endif /* EINA_SUITE_H_ */

View File

@ -0,0 +1,64 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <stdio.h>
#include "eina_suite.h"
#include "Eina.h"
START_TEST(eina_quad_simple)
{
Eina_Rectangle r1;
Eina_Quad r2;
double x0, x1, x2, x3;
double y0, y1, y2, y3;
fail_if(!eina_init());
eina_quad_coords_set(&r2,
0.0, 5.0,
5.0, 0.0,
10.0, 5.0,
5.0, 10.0);
eina_quad_coords_get(&r2,
&x0, &y0,
&x1, &y1,
&x2, &y2,
&x3, &y3);
fail_if (r2.x0 != 0.0 || r2.y0 != 5.0
|| r2.x1 != 5.0 || r2.y1 != 0.0
|| r2.x2 != 10.0 || r2.y2 != 5.0
|| r2.x3 != 5.0 || r2.y3 != 10.0);
eina_quad_rectangle_to(&r2, &r1);
fail_if (r1.x != 0 || r1.y != 0
|| r1.w != 10 || r1.h != 10);
eina_quad_coords_set(&r2,
0.0, 0.0,
0.0, 0.0,
0.0, 0.0,
0.0, 0.0);
eina_quad_rectangle_to(&r2, &r1);
fail_if (r1.x != 0 || r1.y != 0
|| r1.w != 0 || r1.h != 0);
EINA_RECTANGLE_SET(&r1, 5, 10, 20, 30);
eina_quad_rectangle_from(&r2, &r1);
fail_if (r2.x0 != 5.0 || r2.y0 != 10.0
|| r2.x1 != 25.0 || r2.y1 != 10.0
|| r2.x2 != 25.0 || r2.y2 != 40.0
|| r2.x3 != 5.0 || r2.y3 != 40.0);
eina_shutdown();
}
END_TEST
void
eina_test_quad(TCase *tc)
{
tcase_add_test(tc, eina_quad_simple);
}