tests: add evas_map test

Reviewers: raster, Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12295
This commit is contained in:
Shinwoo Kim 2021-10-12 08:36:23 +01:00 committed by Carsten Haitzler (Rasterman)
parent 84b7e13add
commit 2728408cd1
4 changed files with 65 additions and 0 deletions

View File

@ -25,6 +25,7 @@ static const Efl_Test_Case etc[] = {
{ "Object Smart", evas_test_object_smart },
{ "Events", evas_test_events },
{ "Efl Canvas Animation", efl_test_canvas_animation },
{ "Map", evas_test_map },
{ NULL, NULL }
};

View File

@ -19,5 +19,6 @@ void evas_test_evasgl(TCase *tc);
void evas_test_object_smart(TCase *tc);
void evas_test_events(TCase *tc);
void efl_test_canvas_animation(TCase *tc);
void evas_test_map(TCase *tc);
#endif /* _EVAS_SUITE_H */

View File

@ -0,0 +1,62 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <Evas.h>
#include <Ecore_Evas.h>
#include <Ecore.h>
#include "evas_suite.h"
EFL_START_TEST(evas_object_map_api)
{
Evas_Coord x, y, z;
Evas_Map *map = evas_map_new(4);
ck_assert_int_eq(evas_map_count_get(map), 4);
evas_map_alpha_set(map, EINA_TRUE);
ck_assert(evas_map_alpha_get(map));
evas_map_alpha_set(map, EINA_FALSE);
ck_assert(!evas_map_alpha_get(map));
evas_map_smooth_set(map, EINA_TRUE);
ck_assert(evas_map_smooth_get(map));
evas_map_smooth_set(map, EINA_FALSE);
ck_assert(!evas_map_smooth_get(map));
evas_map_util_object_move_sync_set(map, EINA_TRUE);
ck_assert(evas_map_util_object_move_sync_get(map));
evas_map_util_object_move_sync_set(map, EINA_FALSE);
ck_assert(!evas_map_util_object_move_sync_get(map));
evas_map_point_coord_set(map, 0, 10, 20, 30);
evas_map_point_coord_get(map, 0, &x, &y, &z);
ck_assert((x == 10) && (y == 20) && (z == 30));
evas_map_point_coord_set(map, 1, 40, 50, 60);
evas_map_point_coord_get(map, 1, &x, &y, &z);
ck_assert((x == 40) && (y == 50) && (z == 60));
evas_map_point_coord_set(map, 2, 70, 80, 90);
evas_map_point_coord_get(map, 2, &x, &y, &z);
ck_assert((x == 70) && (y == 80) && (z == 90));
evas_map_point_coord_set(map, 3, 100, 110, 120);
evas_map_point_coord_get(map, 3, &x, &y, &z);
ck_assert((x == 100) && (y == 110) && (z == 120));
}
EFL_END_TEST
void evas_test_map(TCase *tc)
{
tcase_add_test(tc, evas_object_map_api);
}

View File

@ -21,6 +21,7 @@ evas_suite_src = [
'efl_test_canvas2.c',
'efl_test_canvas3.c',
'efl_canvas_animation.c',
'evas_test_map.c',
]
evas_suite = executable('evas_suite',