Evas 3d: Fix some issues in model test case

Fix some errors, check that file_set and file_save actually work
(rather than have them both fail and pass the test since 0 == 0),
fix temp paths and cleanup unused file.
This commit is contained in:
Jean-Philippe Andre 2015-12-29 15:02:52 +09:00
parent 92f17399a7
commit 60e6030f36
1 changed files with 16 additions and 9 deletions

View File

@ -42,19 +42,26 @@
it = eina_file_direct_ls(folder); \
EINA_ITERATOR_FOREACH(it, file) \
{ \
int set_ok, save_ok; \
mesh = eo_add(EVAS_CANVAS3D_MESH_CLASS, e); \
mesh2 = eo_add(EVAS_CANVAS3D_MESH_CLASS, e); \
fail_if(mesh == NULL); \
fail_if(mesh2 == NULL); \
snprintf(buffer, PATH_MAX, "%s", ext); \
eo_do(mesh, efl_file_set(file->path, NULL), \
efl_file_save(buffer, NULL, NULL)); \
eo_do(mesh2, efl_file_set(buffer, NULL)); \
snprintf(buffer, PATH_MAX, "%s%s", tmp, ext); \
eo_do(mesh, set_ok = efl_file_set(file->path, NULL), \
save_ok = efl_file_save(buffer, NULL, NULL)); \
fail_if(!set_ok); \
fail_if(!save_ok); \
eo_do(mesh2, set_ok = efl_file_set(buffer, NULL)); \
fail_if(!set_ok); \
res = _compare_meshes(mesh, mesh2); \
fail_if(res == 1); \
eo_do(mesh, efl_file_mmap_set(eina_file_open(file->path, 0), NULL), \
efl_file_save(buffer, NULL, NULL)); \
eo_do(mesh2, efl_file_mmap_set(eina_file_open(buffer, 0), NULL)); \
eo_do(mesh, set_ok = efl_file_mmap_set(eina_file_open(file->path, 0), NULL), \
save_ok = efl_file_save(buffer, NULL, NULL)); \
fail_if(!set_ok); \
fail_if(!save_ok); \
eo_do(mesh2, set_ok = efl_file_mmap_set(eina_file_open(buffer, 0), NULL)); \
fail_if(!set_ok); \
res = _compare_meshes(mesh, mesh2); \
fail_if(res == 1); \
eo_del(mesh2); \
@ -116,18 +123,18 @@ START_TEST(evas_object_mesh_loader_saver)
int res = 0, tmpfd;
const Eina_File_Direct_Info *file;
/* create tmp file name, assume tmp.eet and tmp.ply also work */
tmpfd = eina_file_mkstemp(file_mask, &tmp);
fail_if(tmpfd == -1);
fail_if(!!close(tmpfd));
snprintf(buffer, PATH_MAX, "%s", tmp);
CHECK_MESHES_IN_FOLDER(TESTS_OBJ_MESH_DIR, ".eet")
CHECK_MESHES_IN_FOLDER(TESTS_MD2_MESH_DIR, ".eet")
CHECK_MESHES_IN_FOLDER(TESTS_PLY_MESH_DIR, ".eet")
CHECK_MESHES_IN_FOLDER(TESTS_PLY_MESH_DIR, ".ply")
eina_iterator_free(it);
unlink(tmp);
evas_free(e);
evas_shutdown();