summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/ecore/ecore_suite.c3
-rw-r--r--src/tests/ecore/ecore_test_ecore.c7
-rw-r--r--src/tests/ecore/ecore_test_ecore_file.c47
-rw-r--r--src/tests/ecore/ecore_test_timer.c130
-rw-r--r--src/tests/ecore/efl_app_test_loop_timer.c184
-rw-r--r--src/tests/ecore_audio_cxx/cxx_compile_test.cc15
-rw-r--r--src/tests/ecore_cxx/cxx_compile_test.cc15
-rw-r--r--src/tests/ecore_cxx/ecore_cxx_suite.cc15
-rw-r--r--src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc15
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_suite.c7
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_suite.h13
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_display.c152
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_ecore_wl2.c11
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_input.c109
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_surface.c56
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_window.c855
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_tests_helper_egl.h42
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_tests_helpers.h44
-rw-r--r--src/tests/ecore_wl2/meson.build14
-rw-r--r--src/tests/edje/data/test_textblock.edc41
-rw-r--r--src/tests/edje/edje_test_text.c76
-rw-r--r--src/tests/edje_cxx/cxx_compile_test.cc15
-rw-r--r--src/tests/eet_cxx/eet_cxx_suite.cc15
-rw-r--r--src/tests/eet_cxx/eet_cxx_test_descriptors.cc15
-rw-r--r--src/tests/efl/efl_test_composite_model.c126
-rw-r--r--src/tests/efl/efl_test_container_model.c1
-rw-r--r--src/tests/efl_mono/Array.cs189
-rw-r--r--src/tests/efl_mono/BasicDirection.cs16
-rw-r--r--src/tests/efl_mono/Eina.cs756
-rw-r--r--src/tests/efl_mono/EinaTestData.cs68
-rw-r--r--src/tests/efl_mono/Eldbus.cs17
-rw-r--r--src/tests/efl_mono/Eo.cs163
-rw-r--r--src/tests/efl_mono/EoConstruction.cs15
-rw-r--r--src/tests/efl_mono/EoPromises.cs23
-rw-r--r--src/tests/efl_mono/Errors.cs28
-rw-r--r--src/tests/efl_mono/Events.cs43
-rw-r--r--src/tests/efl_mono/FunctionPointerMarshalling.cs18
-rw-r--r--src/tests/efl_mono/FunctionPointers.cs22
-rw-r--r--src/tests/efl_mono/Hash.cs3
-rw-r--r--src/tests/efl_mono/Inheritance.cs31
-rw-r--r--src/tests/efl_mono/List.cs193
-rw-r--r--src/tests/efl_mono/Main.cs35
-rw-r--r--src/tests/efl_mono/Model.cs16
-rw-r--r--src/tests/efl_mono/Parts.cs38
-rw-r--r--src/tests/efl_mono/Promises.cs39
-rw-r--r--src/tests/efl_mono/Strbuf.cs21
-rw-r--r--src/tests/efl_mono/Strings.cs46
-rw-r--r--src/tests/efl_mono/StructHelpers.cs31
-rw-r--r--src/tests/efl_mono/Structs.cs118
-rw-r--r--src/tests/efl_mono/TestUtils.cs15
-rw-r--r--src/tests/efl_mono/Value.cs115
-rw-r--r--src/tests/efl_mono/ValueEolian.cs34
-rw-r--r--src/tests/efl_mono/dummy_child.c15
-rw-r--r--src/tests/efl_mono/dummy_constructible_object.c15
-rw-r--r--src/tests/efl_mono/dummy_event_manager.c15
-rw-r--r--src/tests/efl_mono/dummy_inherit_helper.c15
-rw-r--r--src/tests/efl_mono/dummy_interfaces.c15
-rw-r--r--src/tests/efl_mono/dummy_numberwrapper.c15
-rw-r--r--src/tests/efl_mono/dummy_part_holder.c15
-rw-r--r--src/tests/efl_mono/dummy_test_object.c60
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo7
-rw-r--r--src/tests/efl_mono/efl_sharp_test_suite.csproj.in39
-rw-r--r--src/tests/efl_mono/eolian_mono_suite.cc61
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.h15
-rw-r--r--src/tests/efl_mono/meson.build160
-rw-r--r--src/tests/eina/eina_test_accessor.c32
-rw-r--r--src/tests/eina/eina_test_log.c4
-rw-r--r--src/tests/eina/eina_test_matrix.c14
-rw-r--r--src/tests/eina/eina_test_slstr.c2
-rw-r--r--src/tests/eina_cxx/eina_cxx_suite.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_accessor.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_error.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_inarray.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_inlist.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_iterator.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_log.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_optional.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_ptrarray.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_ptrlist.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_stringshare.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_thread.cc15
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_value.cc15
-rw-r--r--src/tests/eldbus_cxx/eldbus_cxx_suite.cc15
-rw-r--r--src/tests/eldbus_cxx/eldbus_cxx_test_eldbus_client.cc15
-rw-r--r--src/tests/eldbus_cxx/eldbus_cxx_test_eldbus_connect.cc15
-rw-r--r--src/tests/elementary/efl_ui_suite.c9
-rw-r--r--src/tests/elementary/efl_ui_suite.h5
-rw-r--r--src/tests/elementary/efl_ui_test_collection_view.c160
-rw-r--r--src/tests/elementary/efl_ui_test_config.c1
-rw-r--r--src/tests/elementary/efl_ui_test_grid.c7
-rw-r--r--src/tests/elementary/efl_ui_test_layout.c47
-rw-r--r--src/tests/elementary/efl_ui_test_list_collection.c4
-rw-r--r--src/tests/elementary/efl_ui_test_position_manager_common.c1
-rw-r--r--src/tests/elementary/efl_ui_test_relative_container.c (renamed from src/tests/elementary/efl_ui_test_relative_layout.c)58
-rw-r--r--src/tests/elementary/efl_ui_test_scroller.c51
-rw-r--r--src/tests/elementary/efl_ui_test_select_model.c13
-rw-r--r--src/tests/elementary/efl_ui_test_spin_button.c56
-rw-r--r--src/tests/elementary/efl_ui_test_spotlight.c115
-rw-r--r--src/tests/elementary/efl_ui_test_text.c227
-rw-r--r--src/tests/elementary/efl_ui_test_timepicker.c45
-rw-r--r--src/tests/elementary/efl_ui_test_vg_animation.c122
-rw-r--r--src/tests/elementary/elm_cxx_suite.cc15
-rw-r--r--src/tests/elementary/elm_test_check.c68
-rw-r--r--src/tests/elementary/elm_test_entry.c73
-rw-r--r--src/tests/elementary/elm_test_genlist.c194
-rw-r--r--src/tests/elementary/elm_test_layout.c62
-rw-r--r--src/tests/elementary/emoji_wink.json1
-rw-r--r--src/tests/elementary/meson.build5
-rw-r--r--src/tests/elementary/spec/efl_test_basics.c98
-rw-r--r--src/tests/elementary/spec/efl_test_clickable.c6
-rw-r--r--src/tests/elementary/spec/efl_test_content.c10
-rw-r--r--src/tests/elementary/spec/efl_test_format.c4
-rw-r--r--src/tests/elementary/spec/efl_test_gfx_view.c2
-rw-r--r--src/tests/elementary/spec/efl_test_multi_selectable.c84
-rw-r--r--src/tests/elementary/spec/efl_test_pack.c2
-rw-r--r--src/tests/elementary/spec/efl_test_pack_linear.c142
-rw-r--r--src/tests/elementary/spec/efl_test_range_display.c4
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.c56
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.h2
-rwxr-xr-xsrc/tests/elementary/spec/generator.py2
-rw-r--r--src/tests/elementary/spec/meson.build3
-rw-r--r--src/tests/elementary/suite_helpers.c97
-rw-r--r--src/tests/elementary/suite_helpers.h10
-rw-r--r--src/tests/elementary_cxx/cxx_compile_test.cc15
-rw-r--r--src/tests/elementary_cxx/cxx_dummy_compile_test.cc15
-rw-r--r--src/tests/elocation/elocation_suite.c235
-rw-r--r--src/tests/eo/suite/eo_test_event.c35
-rw-r--r--src/tests/eo_cxx/eo_cxx_suite.cc15
-rw-r--r--src/tests/eolian/data/docs_ref.h18
-rw-r--r--src/tests/eolian/data/eo_docs.eo4
-rw-r--r--src/tests/eolian/data/function_as_argument_ref.h2
-rw-r--r--src/tests/eolian/data/struct_ref.h2
-rw-r--r--src/tests/eolian/data/typedef_ref.h2
-rw-r--r--src/tests/eolian/eolian_parsing.c3
-rw-r--r--src/tests/eolian_cxx/complex_cxx.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_suite.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_address_of.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_binding.cc141
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_cyclic.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_documentation.cc19
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_generate.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_inheritance.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_parse.cc15
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc15
-rw-r--r--src/tests/eolian_cxx/name_name_cxx.cc15
-rw-r--r--src/tests/eolian_cxx/property_holder.eo42
-rw-r--r--src/tests/eolian_js/test_object.eo2
-rw-r--r--src/tests/evas/efl_canvas_animation.c91
-rw-r--r--src/tests/evas/evas_buffer_helper.c199
-rw-r--r--src/tests/evas/evas_buffer_helper.h32
-rw-r--r--src/tests/evas/evas_suite.c1
-rw-r--r--src/tests/evas/evas_suite.h1
-rw-r--r--src/tests/evas/evas_test_mesh.c124
-rw-r--r--src/tests/evas/evas_test_object.c158
-rw-r--r--src/tests/evas/evas_test_object_smart.c2
-rw-r--r--src/tests/evas/evas_test_textblock.c800
-rw-r--r--src/tests/evas/fonts/NotoColorEmoji.ttfbin7297112 -> 0 bytes
-rw-r--r--src/tests/evas/fonts/NotoEmoji-Regular.ttfbin418804 -> 0 bytes
-rw-r--r--src/tests/evas/meson.build2
-rw-r--r--src/tests/evas_cxx/cxx_compile_test.cc15
160 files changed, 7327 insertions, 1499 deletions
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 53c6bbb..b9248a8 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -60,6 +60,9 @@ SUITE_INIT(ecore)
60{ 60{
61 timeout_reached = 0; 61 timeout_reached = 0;
62 ck_assert_int_eq(ecore_init(), 1); 62 ck_assert_int_eq(ecore_init(), 1);
63#ifdef HAVE_FORK
64 if (eina_streq(getenv("CK_FORK"), "no")) return;
65#endif
63 timeout = ecore_timer_add(5.0, timeout_cb, NULL); 66 timeout = ecore_timer_add(5.0, timeout_cb, NULL);
64 ck_assert_msg(!!timeout, "timeout timer creation failed!"); 67 ck_assert_msg(!!timeout, "timeout timer creation failed!");
65} 68}
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index 6439bc3..66544d0 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -461,9 +461,16 @@ EFL_START_TEST(ecore_test_ecore_app)
461 int argc_out = 0; 461 int argc_out = 0;
462 char **argv_out = NULL; 462 char **argv_out = NULL;
463 463
464 int pargc;
465 char **pargv;
466
467 ecore_app_args_get(&pargc, &pargv);
468
464 ecore_app_args_set(argc_in, argv_in); 469 ecore_app_args_set(argc_in, argv_in);
465 ecore_app_args_get(&argc_out, &argv_out); 470 ecore_app_args_get(&argc_out, &argv_out);
466 471
472 ecore_app_args_set(pargc, (const char**)pargv);
473
467 fail_if(argc_in != argc_out); 474 fail_if(argc_in != argc_out);
468 int i; 475 int i;
469 for (i = 0; i < argc_out; i++) 476 for (i = 0; i < argc_out; i++)
diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c
index b897fdd..e41ce02 100644
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ b/src/tests/ecore/ecore_test_ecore_file.c
@@ -196,9 +196,7 @@ EFL_START_TEST(ecore_test_ecore_file_operations)
196 196
197 src_dir = get_tmp_dir(); 197 src_dir = get_tmp_dir();
198 fail_if(!src_dir); 198 fail_if(!src_dir);
199 strcat(dir, src_dir); 199 snprintf(dir, sizeof(dir), "%s/%s", src_dir, dirs[2]);
200 strcat(dir, "/");
201 strcat(dir, dirs[2]);
202 res = ecore_file_mkpath(dir); 200 res = ecore_file_mkpath(dir);
203 fail_if(res != EINA_TRUE); 201 fail_if(res != EINA_TRUE);
204 res = ecore_file_recursive_rm(src_dir); 202 res = ecore_file_recursive_rm(src_dir);
@@ -265,18 +263,14 @@ EFL_START_TEST(ecore_test_ecore_file_operations)
265 263
266 src_dir = get_tmp_dir(); 264 src_dir = get_tmp_dir();
267 fail_if(!src_dir); 265 fail_if(!src_dir);
268 strcpy(dir, src_dir); 266 snprintf(dir, sizeof(dir), "%s/%s", src_dir, dirs[0]);
269 strcat(dir, "/");
270 strcat(dir, dirs[0]);
271 fail_if(ecore_file_mkdir(dir) != EINA_TRUE); 267 fail_if(ecore_file_mkdir(dir) != EINA_TRUE);
272 268
273 fail_if(ecore_file_mkdirs(NULL) != -1); 269 fail_if(ecore_file_mkdirs(NULL) != -1);
274 for (i = 0; i < 3; i++) 270 for (i = 0; i < 3; i++)
275 { 271 {
276 char tmp[PATH_MAX]; 272 char tmp[PATH_MAX];
277 strcpy(tmp, src_dir); 273 snprintf(tmp, sizeof(tmp), "%s/%s", src_dir, dirs2[i]);
278 strcat(tmp, "/");
279 strcat(tmp, dirs2[i]);
280 dirs2[i] = strdup(tmp); 274 dirs2[i] = strdup(tmp);
281 } 275 }
282 fail_if(ecore_file_mkdirs((const char **)dirs2) != 3); 276 fail_if(ecore_file_mkdirs((const char **)dirs2) != 3);
@@ -403,11 +397,8 @@ EFL_START_TEST(ecore_test_ecore_file_path)
403 397
404 src_dir = getenv("PATH"); 398 src_dir = getenv("PATH");
405 fail_if(!src_dir); 399 fail_if(!src_dir);
406 path = malloc(strlen(src_dir) + strlen(dup_dir) + 1); 400 path = malloc(strlen(src_dir) + strlen(dup_dir) + 2);
407 *path = '\0'; 401 snprintf(path, strlen(src_dir) + strlen(dup_dir) + 2, "%s:%s", src_dir, dirname(dup_dir));
408 strcat(path, src_dir);
409 strcat(path, ":");
410 strcat(path, dirname(dup_dir));
411 ret = setenv("PATH", path, 1); 402 ret = setenv("PATH", path, 1);
412 fail_if(ret != 0); 403 fail_if(ret != 0);
413 free(dup_dir); 404 free(dup_dir);
@@ -416,11 +407,25 @@ EFL_START_TEST(ecore_test_ecore_file_path)
416 ret = ecore_file_init(); 407 ret = ecore_file_init();
417 408
418 res = ecore_file_app_installed(dest_file); 409 res = ecore_file_app_installed(dest_file);
410 if (!res)
411 {
412 /* attempt to mitigate cascading failures */
413 ret = setenv("PATH", src_dir, 1);
414 fail_if(ret != 0);
415 }
419 fail_if(res != EINA_TRUE); 416 fail_if(res != EINA_TRUE);
420 res = ecore_file_app_installed(src_file); 417 res = ecore_file_app_installed(src_file);
418 if (!res)
419 {
420 /* attempt to mitigate cascading failures */
421 ret = setenv("PATH", src_dir, 1);
422 fail_if(ret != 0);
423 }
421 fail_if(res != EINA_TRUE); 424 fail_if(res != EINA_TRUE);
422 list = NULL; 425 list = NULL;
423 list = ecore_file_app_list(); 426 list = ecore_file_app_list();
427 ret = setenv("PATH", src_dir, 1);
428 fail_if(ret != 0);
424 fd = 0; 429 fd = 0;
425 EINA_LIST_FOREACH(list, l, path) 430 EINA_LIST_FOREACH(list, l, path)
426 { 431 {
@@ -433,8 +438,6 @@ EFL_START_TEST(ecore_test_ecore_file_path)
433 fail_if(fd == 0); 438 fail_if(fd == 0);
434 EINA_LIST_FREE(list, dup_dir) 439 EINA_LIST_FREE(list, dup_dir)
435 free(dup_dir); 440 free(dup_dir);
436 ret = setenv("PATH", src_dir, 1);
437 fail_if(ret != 0);
438 441
439 fail_if(ecore_file_remove(src_file) != EINA_TRUE); 442 fail_if(ecore_file_remove(src_file) != EINA_TRUE);
440 443
@@ -468,9 +471,7 @@ EFL_START_TEST(ecore_test_ecore_file_monitor)
468 mon = ecore_file_monitor_add(realp, file_monitor_cb, NULL); 471 mon = ecore_file_monitor_add(realp, file_monitor_cb, NULL);
469 fail_if(mon == NULL); 472 fail_if(mon == NULL);
470 473
471 strcat(file_name, src_dir); 474 snprintf(file_name, sizeof(file_name), "%s/%s", src_dir, file);
472 strcat(file_name, "/");
473 strcat(file_name, file);
474 _writeToFile(file_name, random_text); 475 _writeToFile(file_name, random_text);
475 _writeToFile(file_name, random_text); 476 _writeToFile(file_name, random_text);
476 477
@@ -483,9 +484,7 @@ EFL_START_TEST(ecore_test_ecore_file_monitor)
483 res = ecore_file_remove(file_name); 484 res = ecore_file_remove(file_name);
484 fail_if(res != EINA_TRUE); 485 fail_if(res != EINA_TRUE);
485 486
486 strcat(dir_name, src_dir); 487 snprintf(dir_name, sizeof(dir_name), "%s/%s", src_dir, sub_dir[0]);
487 strcat(dir_name, "/");
488 strcat(dir_name, sub_dir[0]);
489 res = ecore_file_rmdir(dir_name); 488 res = ecore_file_rmdir(dir_name);
490 fail_if(res != EINA_TRUE); 489 fail_if(res != EINA_TRUE);
491 490
@@ -519,9 +518,7 @@ EFL_START_TEST(ecore_test_ecore_file_download)
519 download_file = ecore_file_file_get(download_url); //example.com 518 download_file = ecore_file_file_get(download_url); //example.com
520 fail_if(!download_file); 519 fail_if(!download_file);
521 fail_if(!ecore_file_download_protocol_available("http://")); 520 fail_if(!ecore_file_download_protocol_available("http://"));
522 strcat(dest_name, download_dir); 521 snprintf(dest_name, sizeof(dest_name), "%s/%s", download_dir, download_file);
523 strcat(dest_name, "/");
524 strcat(dest_name, download_file);
525 522
526 res = ecore_file_download("xxyyzz", dest_name, completion_cb, 523 res = ecore_file_download("xxyyzz", dest_name, completion_cb,
527 progress_cb, NULL, &job); 524 progress_cb, NULL, &job);
diff --git a/src/tests/ecore/ecore_test_timer.c b/src/tests/ecore/ecore_test_timer.c
index 222c415..b295738 100644
--- a/src/tests/ecore/ecore_test_timer.c
+++ b/src/tests/ecore/ecore_test_timer.c
@@ -288,6 +288,134 @@ EFL_START_TEST(ecore_test_timer_in_order)
288} 288}
289EFL_END_TEST 289EFL_END_TEST
290 290
291EFL_START_TEST(ecore_test_timer_iteration)
292{
293 Ecore_Timer *timer;
294 count = 0;
295 /* verify that timers expire after exactly one loop iteration */
296 ecore_timer_add(0, _timer_cb, (void *) 1);
297 ecore_main_loop_iterate();
298 /* timers should not expire for one loop iteration */
299 ck_assert_int_eq(count, 0);
300 ecore_main_loop_iterate();
301 /* timers should expire after one loop iteration */
302 ck_assert_int_eq(count, 1);
303
304 /* verify multiple timer expiration in single mainloop iteration */
305 ecore_timer_add(0, _timer_cb, (void *) 2);
306 ecore_timer_add(0, _timer_cb, (void *) 3);
307 ecore_main_loop_iterate();
308 /* timers should not expire for one loop iteration */
309 ck_assert_int_eq(count, 1);
310 ecore_timer_add(0, _timer_cb, (void *) 4);
311 ecore_main_loop_iterate();
312 /* all pending and instantiated timers should expire after exactly one loop iteration */
313 ck_assert_int_eq(count, 3);
314 ecore_main_loop_iterate();
315 /* this should not interfere with successive timer processing */
316 ck_assert_int_eq(count, 4);
317
318 /* verify out-of-order timer processing solely based on timer times */
319 timer = ecore_timer_add(1, _timer_cb, (void *) 6);
320 ecore_main_loop_iterate();
321 ck_assert_int_eq(count, 4);
322 ecore_timer_add(0, _timer_cb, (void *) 5);
323 ecore_main_loop_iterate();
324 ck_assert_int_eq(count, 4);
325 /* timer should expire after exactly 2 iterations */
326 ecore_main_loop_iterate();
327 ck_assert_int_eq(count, 5);
328 ecore_timer_interval_set(timer, 0);
329 ecore_timer_reset(timer);
330 /* timer should expire after exactly 2 iterations since it becomes un-instantiated now */
331 ecore_main_loop_iterate();
332 ecore_main_loop_iterate();
333 ck_assert_int_eq(count, 6);
334}
335EFL_END_TEST
336
337static Eina_Bool
338_recursion()
339{
340 static unsigned int recurse = 0;
341 static Ecore_Timer *timer;
342
343 switch (recurse++)
344 {
345 case 0:
346 /* verify multiple timer expiration in single mainloop iteration */
347 ecore_timer_add(0, _timer_cb, (void *) 2);
348 ecore_timer_add(0, _timer_cb, (void *) 3);
349 ecore_main_loop_iterate();
350 ecore_main_loop_iterate();
351 ck_assert_int_eq(count, 6);
352 ecore_main_loop_quit();
353 break;
354 case 1:
355 /* timers should not expire for one loop iteration */
356 ck_assert_int_eq(count, 1);
357 ecore_timer_add(0, _timer_cb, (void *) 4);
358 ecore_main_loop_iterate();
359 ecore_main_loop_iterate();
360 break;
361 case 2:
362 /* all pending and instantiated timers should expire after exactly one loop iteration */
363 ck_assert_int_eq(count, 3);
364 ecore_main_loop_iterate();
365 ecore_main_loop_iterate();
366 break;
367 case 3:
368 /* this should not interfere with successive timer processing */
369 ck_assert_int_eq(count, 4);
370
371 /* verify out-of-order timer processing solely based on timer times */
372 timer = ecore_timer_add(1, _timer_cb, (void *) 6);
373 ecore_main_loop_iterate();
374 ecore_main_loop_iterate();
375 break;
376 case 4:
377 ck_assert_int_eq(count, 4);
378 ecore_timer_add(0, _timer_cb, (void *) 5);
379 ecore_main_loop_iterate();
380 ecore_main_loop_iterate();
381 break;
382 case 5:
383 ck_assert_int_eq(count, 4);
384 /* timer should expire after exactly 2 iterations */
385 ecore_main_loop_iterate();
386 ecore_main_loop_iterate();
387 break;
388 case 6:
389 ck_assert_int_eq(count, 5);
390 ecore_timer_interval_set(timer, 0);
391 ecore_timer_reset(timer);
392 /* timer should expire after exactly 2 iterations since it becomes un-instantiated now */
393 ecore_main_loop_iterate();
394 ecore_main_loop_iterate();
395 break;
396 case 7:
397 ecore_main_loop_iterate();
398 ecore_main_loop_iterate();
399 break;
400 }
401 return EINA_FALSE;
402}
403
404EFL_START_TEST(ecore_test_timer_recursion)
405{
406 Eina_Bool crit = eina_log_abort_on_critical_get();
407 int critlevel = eina_log_abort_on_critical_level_get();
408 count = 1;
409 eina_log_abort_on_critical_set(1);
410 eina_log_abort_on_critical_level_set(1);
411 ecore_timer_add(0, _recursion, NULL);
412 ecore_main_loop_begin();
413 ck_assert_int_eq(count, 6);
414 eina_log_abort_on_critical_set(crit);
415 eina_log_abort_on_critical_level_set(critlevel);
416}
417EFL_END_TEST
418
291void ecore_test_timer(TCase *tc) 419void ecore_test_timer(TCase *tc)
292{ 420{
293 tcase_add_test(tc, ecore_test_timers); 421 tcase_add_test(tc, ecore_test_timers);
@@ -295,4 +423,6 @@ void ecore_test_timer(TCase *tc)
295 tcase_add_test(tc, ecore_test_timer_valid_callbackfunc); 423 tcase_add_test(tc, ecore_test_timer_valid_callbackfunc);
296 tcase_add_test(tc, ecore_test_ecore_main_loop_timer); 424 tcase_add_test(tc, ecore_test_ecore_main_loop_timer);
297 tcase_add_test(tc, ecore_test_timer_in_order); 425 tcase_add_test(tc, ecore_test_timer_in_order);
426 tcase_add_test(tc, ecore_test_timer_iteration);
427 tcase_add_test(tc, ecore_test_timer_recursion);
298} 428}
diff --git a/src/tests/ecore/efl_app_test_loop_timer.c b/src/tests/ecore/efl_app_test_loop_timer.c
index e866689..fecc6a3 100644
--- a/src/tests/ecore/efl_app_test_loop_timer.c
+++ b/src/tests/ecore/efl_app_test_loop_timer.c
@@ -71,6 +71,188 @@ EFL_START_TEST(efl_app_test_loop_timer_invalid)
71} 71}
72EFL_END_TEST 72EFL_END_TEST
73 73
74
75
76static int count = 0;
77
78static void
79_timer_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
80{
81 count++;
82}
83
84static void
85array_clean(Eina_Array *arr)
86{
87 Eo *t;
88
89 while ((t = eina_array_pop(arr)))
90 efl_del(t);
91}
92
93EFL_START_TEST(efl_loop_test_loop_timer_iteration)
94{
95 Eo *t, *loop;
96 Eina_Array *arr;
97
98 loop = efl_main_loop_get();
99 count = 0;
100 arr = eina_array_new(5);
101#define TIMER(duration) \
102 t = efl_add(EFL_LOOP_TIMER_CLASS, loop, \
103 efl_loop_timer_interval_set(efl_added, (duration)), \
104 efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TIMER_TICK, _timer_cb, NULL) \
105 ); \
106 eina_array_push(arr, t)
107 /* verify that timers expire after exactly one loop iteration */
108 TIMER(0);
109 efl_loop_iterate(loop);
110 /* timers should not expire for one loop iteration */
111 ck_assert_int_eq(count, 0);
112 efl_loop_iterate(loop);
113 /* timers should expire after one loop iteration */
114 ck_assert_int_eq(count, 1);
115 array_clean(arr);
116
117 count = 0;
118 /* verify multiple timer expiration in single mainloop iteration */
119 TIMER(0);
120 TIMER(0);
121 efl_loop_iterate(loop);
122 /* timers should not expire for one loop iteration */
123 ck_assert_int_eq(count, 0);
124 TIMER(0);
125 efl_loop_iterate(loop);
126 /* all pending and instantiated timers should expire after exactly one loop iteration */
127 ck_assert_int_eq(count, 2);
128 efl_loop_iterate(loop);
129 /* this should not interfere with successive timer processing */
130 ck_assert_int_eq(count, 5);
131 array_clean(arr);
132
133 count = 0;
134 /* verify out-of-order timer processing solely based on timer times */
135 TIMER(1);
136 efl_loop_iterate(loop);
137 ck_assert_int_eq(count, 0);
138 TIMER(0);
139 efl_loop_iterate(loop);
140 ck_assert_int_eq(count, 0);
141 /* timer should expire after exactly 2 iterations */
142 efl_loop_iterate(loop);
143 ck_assert_int_eq(count, 1);
144 efl_loop_timer_interval_set(eina_array_data_get(arr, 0), 0);
145 efl_loop_timer_reset(eina_array_data_get(arr, 0));
146 /* timer should expire after exactly 2 iterations since it becomes un-instantiated now */
147 efl_loop_iterate(loop);
148 efl_loop_iterate(loop);
149 ck_assert_int_eq(count, 4);
150 array_clean(arr);
151}
152EFL_END_TEST
153
154#undef TIMER
155#define TIMER(duration) \
156 efl_add(EFL_LOOP_TIMER_CLASS, loop, \
157 efl_loop_timer_interval_set(efl_added, (duration)), \
158 efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TIMER_TICK, _timer_del_cb, NULL) \
159 ); \
160
161static void
162_timer_del_cb(void *data EINA_UNUSED, const Efl_Event *ev)
163{
164 count++;
165 efl_del(ev->object);
166}
167
168
169static void
170_recursion(void *data EINA_UNUSED, const Efl_Event *ev)
171{
172 static unsigned int recurse = 0;
173 static Eo *timer;
174 Eo *loop = efl_main_loop_get();
175
176 switch (recurse++)
177 {
178 case 0:
179 /* verify multiple timer expiration in single mainloop iteration */
180 TIMER(0);
181 TIMER(0);
182 efl_loop_iterate(loop);
183 efl_loop_iterate(loop);
184 ck_assert_int_eq(count, 6);
185 efl_loop_quit(loop, EINA_VALUE_EMPTY);
186 break;
187 case 1:
188 /* timers should not expire for one loop iteration */
189 ck_assert_int_eq(count, 1);
190 TIMER(0);
191 efl_loop_iterate(loop);
192 efl_loop_iterate(loop);
193 break;
194 case 2:
195 /* all pending and instantiated timers should expire after exactly one loop iteration */
196 ck_assert_int_eq(count, 3);
197 efl_loop_iterate(loop);
198 efl_loop_iterate(loop);
199 break;
200 case 3:
201 /* this should not interfere with successive timer processing */
202 ck_assert_int_eq(count, 4);
203
204 /* verify out-of-order timer processing solely based on timer times */
205 timer = TIMER(1);
206 efl_loop_iterate(loop);
207 efl_loop_iterate(loop);
208 break;
209 case 4:
210 ck_assert_int_eq(count, 4);
211 TIMER(0);
212 efl_loop_iterate(loop);
213 efl_loop_iterate(loop);
214 break;
215 case 5:
216 ck_assert_int_eq(count, 4);
217 /* timer should expire after exactly 2 iterations */
218 efl_loop_iterate(loop);
219 efl_loop_iterate(loop);
220 break;
221 case 6:
222 ck_assert_int_eq(count, 5);
223 efl_loop_timer_interval_set(timer, 0);
224 efl_loop_timer_reset(timer);
225 /* timer should expire after exactly 2 iterations since it becomes un-instantiated now */
226 efl_loop_iterate(loop);
227 efl_loop_iterate(loop);
228 break;
229 case 7:
230 efl_loop_iterate(loop);
231 efl_loop_iterate(loop);
232 efl_del(ev->object);
233 break;
234 }
235}
236
237EFL_START_TEST(efl_loop_test_loop_timer_recursion)
238{
239 Eina_Bool crit = eina_log_abort_on_critical_get();
240 int critlevel = eina_log_abort_on_critical_level_get();
241 Eo *loop = efl_main_loop_get();
242 count = 1;
243 eina_log_abort_on_critical_set(1);
244 eina_log_abort_on_critical_level_set(1);
245 efl_add(EFL_LOOP_TIMER_CLASS, loop,
246 efl_loop_timer_interval_set(efl_added, 0),
247 efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TIMER_TICK, _recursion, NULL)
248 );
249 efl_loop_begin(loop);
250 ck_assert_int_eq(count, 6);
251 eina_log_abort_on_critical_set(crit);
252 eina_log_abort_on_critical_level_set(critlevel);
253}
254EFL_END_TEST
255
74void efl_app_test_efl_loop_timer(TCase *tc EINA_UNUSED) 256void efl_app_test_efl_loop_timer(TCase *tc EINA_UNUSED)
75{ 257{
76 /* XXX: this seems a silly test - that we del the loop object? 258 /* XXX: this seems a silly test - that we del the loop object?
@@ -78,4 +260,6 @@ void efl_app_test_efl_loop_timer(TCase *tc EINA_UNUSED)
78 */ 260 */
79 261
80 tcase_add_test(tc, efl_app_test_loop_timer_invalid); 262 tcase_add_test(tc, efl_app_test_loop_timer_invalid);
263 tcase_add_test(tc, efl_loop_test_loop_timer_iteration);
264 tcase_add_test(tc, efl_loop_test_loop_timer_recursion);
81} 265}
diff --git a/src/tests/ecore_audio_cxx/cxx_compile_test.cc b/src/tests/ecore_audio_cxx/cxx_compile_test.cc
index 2f1421e..8024491 100644
--- a/src/tests/ecore_audio_cxx/cxx_compile_test.cc
+++ b/src/tests/ecore_audio_cxx/cxx_compile_test.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include "config.h" 17# include "config.h"
3#endif 18#endif
diff --git a/src/tests/ecore_cxx/cxx_compile_test.cc b/src/tests/ecore_cxx/cxx_compile_test.cc
index 3c3bd55..0f0328d 100644
--- a/src/tests/ecore_cxx/cxx_compile_test.cc
+++ b/src/tests/ecore_cxx/cxx_compile_test.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include "config.h" 17# include "config.h"
3#endif 18#endif
diff --git a/src/tests/ecore_cxx/ecore_cxx_suite.cc b/src/tests/ecore_cxx/ecore_cxx_suite.cc
index 93b2685..86d7ddc 100644
--- a/src/tests/ecore_cxx/ecore_cxx_suite.cc
+++ b/src/tests/ecore_cxx/ecore_cxx_suite.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include <config.h> 17# include <config.h>
3#endif 18#endif
diff --git a/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc b/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc
index 749b8b0..8911e62 100644
--- a/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc
+++ b/src/tests/ecore_cxx/ecore_cxx_test_safe_call.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include <config.h> 17# include <config.h>
3#endif 18#endif
diff --git a/src/tests/ecore_wl2/ecore_wl2_suite.c b/src/tests/ecore_wl2/ecore_wl2_suite.c
index 623d601..90d16be 100644
--- a/src/tests/ecore_wl2/ecore_wl2_suite.c
+++ b/src/tests/ecore_wl2/ecore_wl2_suite.c
@@ -1,10 +1,4 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include "ecore_wl2_suite.h" 1#include "ecore_wl2_suite.h"
6#include "../efl_check.h"
7#include <Ecore_Wl2.h>
8 2
9static const Efl_Test_Case etc[] = 3static const Efl_Test_Case etc[] =
10{ 4{
@@ -13,7 +7,6 @@ static const Efl_Test_Case etc[] =
13 { "Display", ecore_wl2_test_display }, 7 { "Display", ecore_wl2_test_display },
14 { "Window", ecore_wl2_test_window }, 8 { "Window", ecore_wl2_test_window },
15 { "Input", ecore_wl2_test_input }, 9 { "Input", ecore_wl2_test_input },
16 { "Surface", ecore_wl2_test_surface },
17#endif 10#endif
18 { NULL, NULL } 11 { NULL, NULL }
19}; 12};
diff --git a/src/tests/ecore_wl2/ecore_wl2_suite.h b/src/tests/ecore_wl2/ecore_wl2_suite.h
index ce0e1b4..b429bdb 100644
--- a/src/tests/ecore_wl2/ecore_wl2_suite.h
+++ b/src/tests/ecore_wl2/ecore_wl2_suite.h
@@ -1,13 +1,20 @@
1#ifndef _ECORE_WL2_SUITE_H 1#ifndef _ECORE_WL2_SUITE_H
2# define _ECORE_WL2_SUITE_H 2# define _ECORE_WL2_SUITE_H
3 3
4# include <check.h> 4#ifdef HAVE_CONFIG_H
5# include "../efl_check.h" 5#include "config.h"
6#endif
7
8#include <check.h>
9#include "../efl_check.h"
10#include <stdio.h>
11#include <unistd.h>
12#include <Ecore.h>
13#include <Ecore_Wl2.h>
6 14
7void ecore_wl2_test_init(TCase *tc); 15void ecore_wl2_test_init(TCase *tc);
8void ecore_wl2_test_display(TCase *tc); 16void ecore_wl2_test_display(TCase *tc);
9void ecore_wl2_test_window(TCase *tc); 17void ecore_wl2_test_window(TCase *tc);
10void ecore_wl2_test_input(TCase *tc); 18void ecore_wl2_test_input(TCase *tc);
11void ecore_wl2_test_surface(TCase *tc);
12 19
13#endif 20#endif
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_display.c b/src/tests/ecore_wl2/ecore_wl2_test_display.c
index 7f6f4cc..3c6dfeb 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_display.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_display.c
@@ -1,16 +1,12 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#include <Eina.h>
8#include <Ecore.h>
9#include <Ecore_Wl2.h>
10
11#include "ecore_wl2_suite.h" 1#include "ecore_wl2_suite.h"
12#include "ecore_wl2_tests_helpers.h" 2#include "ecore_wl2_tests_helpers.h"
13 3
4static Ecore_Wl2_Display *
5_display_setup(void)
6{
7 return ecore_wl2_display_create(NULL);
8}
9
14EFL_START_TEST(wl2_display_create) 10EFL_START_TEST(wl2_display_create)
15{ 11{
16 Ecore_Wl2_Display *disp; 12 Ecore_Wl2_Display *disp;
@@ -164,6 +160,131 @@ EFL_START_TEST(wl2_display_inputs_get)
164} 160}
165EFL_END_TEST 161EFL_END_TEST
166 162
163EFL_START_TEST(wl2_display_compositor_version_get)
164{
165 Ecore_Wl2_Display *disp;
166 int ver;
167
168 disp = _display_connect();
169 ck_assert(disp != NULL);
170
171 ver = ecore_wl2_display_compositor_version_get(disp);
172 ck_assert_int_ne(ver, 0);
173}
174EFL_END_TEST
175
176Ecore_Wl2_Input *test_input;
177
178static Eina_Bool
179_test_input_find_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
180{
181 Test_Data *td = data;
182
183 /* NB: Enlightenment uses "seat0" here, but Weston uses "default" */
184 if (getenv("E_START"))
185 test_input = ecore_wl2_display_input_find_by_name(td->display, "seat0");
186 else
187 test_input = ecore_wl2_display_input_find_by_name(td->display, "default");
188
189 ck_assert(test_input != NULL);
190 test_input = NULL;
191
192 if (getenv("E_START"))
193 {
194 test_input = ecore_wl2_display_input_find(td->display, 13);
195 ck_assert(test_input != NULL);
196 }
197
198 ecore_main_loop_quit();
199
200 return ECORE_CALLBACK_PASS_ON;
201}
202
203EFL_START_TEST(wl2_display_input_find)
204{
205 Test_Data *td;
206
207 ecore_wl2_init();
208
209 td = calloc(1, sizeof(Test_Data));
210 td->width = WIDTH;
211 td->height = HEIGHT;
212
213 td->display = _display_connect();
214 ck_assert(td->display != NULL);
215
216 td->win = _window_create(td->display);
217 ck_assert(td->win != NULL);
218
219 ecore_wl2_window_show(td->win);
220
221 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
222 _test_input_find_configure_complete, td);
223
224 ecore_main_loop_begin();
225
226 ecore_wl2_shutdown();
227 free(td);
228}
229
230EFL_END_TEST
231
232EFL_START_TEST(wl2_display_flush)
233{
234 Ecore_Wl2_Display *disp;
235
236 disp = _display_connect();
237 ck_assert(disp != NULL);
238
239 //FIXME: Ambiguous way to check with code to make sure flushing was successful.
240 // We might think it's being verified by another TC that actually draws to the screen buffer ...
241 ecore_wl2_display_flush(disp);
242}
243EFL_END_TEST
244
245static Eina_Bool
246_test_sync_done(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
247{
248 Test_Data *td = data;
249 Eina_Bool ret;
250
251 ret = ecore_wl2_display_sync_is_done(td->display);
252
253 fail_if(ret == EINA_FALSE);
254
255 ecore_main_loop_quit();
256
257 return ECORE_CALLBACK_PASS_ON;
258}
259
260EFL_START_TEST(wl2_display_sync_is_done)
261{
262 Test_Data *td;
263
264 ecore_wl2_init();
265
266 td = calloc(1, sizeof(Test_Data));
267 td->width = WIDTH;
268 td->height = HEIGHT;
269
270 td->display = _display_connect();
271 ck_assert(td->display != NULL);
272
273 td->win = _window_create(td->display);
274 ck_assert(td->win != NULL);
275
276 ecore_wl2_window_show(td->win);
277
278 ecore_event_handler_add(ECORE_WL2_EVENT_SYNC_DONE,
279 _test_sync_done, td);
280
281 ecore_main_loop_begin();
282
283 ecore_wl2_shutdown();
284 free(td);
285}
286EFL_END_TEST
287
167void 288void
168ecore_wl2_test_display(TCase *tc) 289ecore_wl2_test_display(TCase *tc)
169{ 290{
@@ -184,9 +305,16 @@ ecore_wl2_test_display(TCase *tc)
184 tcase_add_test(tc, wl2_display_disconnect); 305 tcase_add_test(tc, wl2_display_disconnect);
185 tcase_add_test(tc, wl2_display_registry_get); 306 tcase_add_test(tc, wl2_display_registry_get);
186 tcase_add_test(tc, wl2_display_shm_get); 307 tcase_add_test(tc, wl2_display_shm_get);
187 tcase_add_test(tc, wl2_display_dmabuf_get);
188 tcase_add_test(tc, wl2_display_globals_get); 308 tcase_add_test(tc, wl2_display_globals_get);
189 tcase_add_test(tc, wl2_display_screen_size_get);
190 tcase_add_test(tc, wl2_display_inputs_get); 309 tcase_add_test(tc, wl2_display_inputs_get);
310 tcase_add_test(tc, wl2_display_compositor_version_get);
311 tcase_add_test(tc, wl2_display_input_find);
312 tcase_add_test(tc, wl2_display_flush);
313 tcase_add_test(tc, wl2_display_sync_is_done);
314 if (!getenv("E_START"))
315 {
316 tcase_add_test(tc, wl2_display_dmabuf_get);
317 tcase_add_test(tc, wl2_display_screen_size_get);
318 }
191 } 319 }
192} 320}
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_ecore_wl2.c b/src/tests/ecore_wl2/ecore_wl2_test_ecore_wl2.c
index 6ed6b73..d8049cd 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_ecore_wl2.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_ecore_wl2.c
@@ -1,14 +1,3 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7
8#include <Eina.h>
9#include <Ecore.h>
10#include <Ecore_Wl2.h>
11
12#include "ecore_wl2_suite.h" 1#include "ecore_wl2_suite.h"
13 2
14EFL_START_TEST(ecore_wl2_simple) 3EFL_START_TEST(ecore_wl2_simple)
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_input.c b/src/tests/ecore_wl2/ecore_wl2_test_input.c
index 73056a7..3c0330a 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_input.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_input.c
@@ -1,23 +1,5 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#include <Eina.h>
8#include <Ecore.h>
9#include <Ecore_Wl2.h>
10
11#include "ecore_wl2_suite.h" 1#include "ecore_wl2_suite.h"
12 2#include "ecore_wl2_tests_helpers.h"
13static Ecore_Wl2_Display *
14_display_connect(void)
15{
16 Ecore_Wl2_Display *disp;
17
18 disp = ecore_wl2_display_connect(NULL);
19 return disp;
20}
21 3
22EFL_START_TEST(wl2_input_seat_get) 4EFL_START_TEST(wl2_input_seat_get)
23{ 5{
@@ -102,7 +84,9 @@ EFL_START_TEST(wl2_input_keymap_get)
102 84
103 EINA_ITERATOR_FOREACH(itr, input) 85 EINA_ITERATOR_FOREACH(itr, input)
104 { 86 {
105 ck_assert(ecore_wl2_input_keymap_get(input) != NULL); 87 if (ecore_wl2_input_seat_capabilities_get(input) ==
88 ECORE_WL2_SEAT_CAPABILITIES_KEYBOARD)
89 ck_assert(ecore_wl2_input_keymap_get(input) != NULL);
106 } 90 }
107 91
108 eina_iterator_free(itr); 92 eina_iterator_free(itr);
@@ -130,6 +114,89 @@ EFL_START_TEST(wl2_input_name_get)
130} 114}
131EFL_END_TEST 115EFL_END_TEST
132 116
117static Eina_Bool
118_test_input_seat_capa_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
119{
120 Test_Data *td = data;
121 Ecore_Wl2_Input *input;
122 Eina_Iterator *itr;
123
124 itr = ecore_wl2_display_inputs_get(td->display);
125 ck_assert(itr != NULL);
126
127 EINA_ITERATOR_FOREACH(itr, input)
128 {
129 Ecore_Wl2_Seat_Capabilities cap = ECORE_WL2_SEAT_CAPABILITIES_NONE;
130
131 cap = ecore_wl2_input_seat_capabilities_get(input);
132 ck_assert(cap != ECORE_WL2_SEAT_CAPABILITIES_NONE);
133 }
134
135 eina_iterator_free(itr);
136
137 ecore_main_loop_quit();
138
139 return ECORE_CALLBACK_PASS_ON;
140}
141
142EFL_START_TEST(wl2_input_seat_capabilities)
143{
144 Test_Data *td;
145
146 ecore_wl2_init();
147
148 td = calloc(1, sizeof(Test_Data));
149 td->width = WIDTH;
150 td->height = HEIGHT;
151
152 td->display = _display_connect();
153 ck_assert(td->display != NULL);
154
155 td->win = _window_create(td->display);
156 ck_assert(td->win != NULL);
157
158 ecore_wl2_window_show(td->win);
159
160 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
161 _test_input_seat_capa_configure_complete, td);
162
163 ecore_main_loop_begin();
164
165 ecore_wl2_shutdown();
166 free(td);
167
168}
169EFL_END_TEST
170
171EFL_START_TEST(wl2_input_pointer_xy)
172{
173 Ecore_Wl2_Display *disp;
174 Ecore_Wl2_Input *input;
175 Eina_Iterator *itr;
176
177 disp = _display_connect();
178 ck_assert(disp != NULL);
179
180 itr = ecore_wl2_display_inputs_get(disp);
181 ck_assert(itr != NULL);
182
183 EINA_ITERATOR_FOREACH(itr, input)
184 {
185 if (ecore_wl2_input_seat_capabilities_get(input) ==
186 ECORE_WL2_SEAT_CAPABILITIES_POINTER)
187 {
188 int x = 0, y = 0;
189
190 ecore_wl2_input_pointer_xy_get(input, &x, &y);
191 ck_assert_int_ne(x, 0);
192 ck_assert_int_ne(y, 0);
193 }
194 }
195
196 eina_iterator_free(itr);
197}
198EFL_END_TEST
199
133void 200void
134ecore_wl2_test_input(TCase *tc) 201ecore_wl2_test_input(TCase *tc)
135{ 202{
@@ -140,5 +207,7 @@ ecore_wl2_test_input(TCase *tc)
140 tcase_add_test(tc, wl2_input_display_get); 207 tcase_add_test(tc, wl2_input_display_get);
141 tcase_add_test(tc, wl2_input_keymap_get); 208 tcase_add_test(tc, wl2_input_keymap_get);
142 tcase_add_test(tc, wl2_input_name_get); 209 tcase_add_test(tc, wl2_input_name_get);
210 tcase_add_test(tc, wl2_input_seat_capabilities);
211 tcase_add_test(tc, wl2_input_pointer_xy);
143 } 212 }
144} 213}
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_surface.c b/src/tests/ecore_wl2/ecore_wl2_test_surface.c
deleted file mode 100644
index f4252e1..0000000
--- a/src/tests/ecore_wl2/ecore_wl2_test_surface.c
+++ /dev/null
@@ -1,56 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#include <Eina.h>
8#include <Ecore.h>
9#include <Ecore_Wl2.h>
10
11#include "ecore_wl2_suite.h"
12
13static Ecore_Wl2_Display *
14_display_connect(void)
15{
16 Ecore_Wl2_Display *disp;
17
18 disp = ecore_wl2_display_connect(NULL);
19 return disp;
20}
21
22static Ecore_Wl2_Window *
23_window_create(Ecore_Wl2_Display *disp)
24{
25 Ecore_Wl2_Window *win;
26
27 win = ecore_wl2_window_new(disp, NULL, 100, 100, 500, 500);
28 return win;
29}
30
31EFL_START_TEST(wl2_surface_create)
32{
33 Ecore_Wl2_Display *disp;
34 Ecore_Wl2_Window *win;
35 Ecore_Wl2_Surface *surf;
36
37 disp = _display_connect();
38 ck_assert(disp != NULL);
39
40 win = _window_create(disp);
41 ck_assert(win != NULL);
42
43 surf = ecore_wl2_surface_create(win, EINA_FALSE);
44 ck_assert(surf != NULL);
45}
46EFL_END_TEST
47
48void
49ecore_wl2_test_surface(TCase *tc)
50{
51 if (getenv("WAYLAND_DISPLAY"))
52 {
53 /* surface tests can only run if there is an existing compositor */
54 tcase_add_test(tc, wl2_surface_create);
55 }
56}
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c
index 948def8..b166b4b 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_window.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c
@@ -1,31 +1,14 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#include <Eina.h>
8#include <Ecore.h>
9#include <Ecore_Wl2.h>
10
11#include "ecore_wl2_suite.h" 1#include "ecore_wl2_suite.h"
2#include "ecore_wl2_tests_helpers.h"
12 3
13static Ecore_Wl2_Display * 4#ifdef GL_GLES
14_display_connect(void) 5#include "ecore_wl2_tests_helper_egl.h"
15{ 6#endif
16 Ecore_Wl2_Display *disp;
17
18 disp = ecore_wl2_display_connect(NULL);
19 return disp;
20}
21 7
22static Ecore_Wl2_Window * 8static struct wl_surface *
23_window_create(Ecore_Wl2_Display *disp) 9_surface_get(Ecore_Wl2_Window *win)
24{ 10{
25 Ecore_Wl2_Window *win; 11 return ecore_wl2_window_surface_get(win);
26
27 win = ecore_wl2_window_new(disp, NULL, 100, 100, 500, 500);
28 return win;
29} 12}
30 13
31EFL_START_TEST(wl2_window_new) 14EFL_START_TEST(wl2_window_new)
@@ -64,7 +47,7 @@ EFL_START_TEST(wl2_window_surface_test)
64} 47}
65EFL_END_TEST 48EFL_END_TEST
66 49
67EFL_START_TEST(wl2_window_rotation_get) 50EFL_START_TEST(wl2_window_rotation)
68{ 51{
69 Ecore_Wl2_Display *disp; 52 Ecore_Wl2_Display *disp;
70 Ecore_Wl2_Window *win; 53 Ecore_Wl2_Window *win;
@@ -78,14 +61,18 @@ EFL_START_TEST(wl2_window_rotation_get)
78 61
79 rot = ecore_wl2_window_rotation_get(win); 62 rot = ecore_wl2_window_rotation_get(win);
80 ck_assert_int_ge(rot, 0); 63 ck_assert_int_ge(rot, 0);
64
65 ecore_wl2_window_rotation_set(win, 90);
66
67 rot = ecore_wl2_window_rotation_get(win);
68 fail_if(rot != 90);
81} 69}
82EFL_END_TEST 70EFL_END_TEST
83 71
84EFL_START_TEST(wl2_window_output_find) 72EFL_START_TEST(wl2_window_display_get)
85{ 73{
86 Ecore_Wl2_Display *disp; 74 Ecore_Wl2_Display *disp;
87 Ecore_Wl2_Window *win; 75 Ecore_Wl2_Window *win;
88 Ecore_Wl2_Output *out;
89 76
90 disp = _display_connect(); 77 disp = _display_connect();
91 ck_assert(disp != NULL); 78 ck_assert(disp != NULL);
@@ -93,16 +80,15 @@ EFL_START_TEST(wl2_window_output_find)
93 win = _window_create(disp); 80 win = _window_create(disp);
94 ck_assert(win != NULL); 81 ck_assert(win != NULL);
95 82
96 out = ecore_wl2_window_output_find(win); 83 ck_assert(ecore_wl2_window_display_get(win) != NULL);
97 ck_assert(out != NULL);
98} 84}
99EFL_END_TEST 85EFL_END_TEST
100 86
101EFL_START_TEST(wl2_window_aux_hints_supported_get) 87EFL_START_TEST(wl2_window_alpha)
102{ 88{
103 Ecore_Wl2_Display *disp; 89 Ecore_Wl2_Display *disp;
104 Ecore_Wl2_Window *win; 90 Ecore_Wl2_Window *win;
105 Eina_List *l; 91 Eina_Bool alpha = EINA_FALSE;
106 92
107 disp = _display_connect(); 93 disp = _display_connect();
108 ck_assert(disp != NULL); 94 ck_assert(disp != NULL);
@@ -110,15 +96,18 @@ EFL_START_TEST(wl2_window_aux_hints_supported_get)
110 win = _window_create(disp); 96 win = _window_create(disp);
111 ck_assert(win != NULL); 97 ck_assert(win != NULL);
112 98
113 l = ecore_wl2_window_aux_hints_supported_get(win); 99 ecore_wl2_window_alpha_set(win, EINA_TRUE);
114 ck_assert(l != NULL); 100
101 alpha = ecore_wl2_window_alpha_get(win);
102 fail_if(alpha != EINA_TRUE);
115} 103}
116EFL_END_TEST 104EFL_END_TEST
117 105
118EFL_START_TEST(wl2_window_display_get) 106EFL_START_TEST(wl2_window_floating_mode)
119{ 107{
120 Ecore_Wl2_Display *disp; 108 Ecore_Wl2_Display *disp;
121 Ecore_Wl2_Window *win; 109 Ecore_Wl2_Window *win;
110 Eina_Bool f = EINA_FALSE;
122 111
123 disp = _display_connect(); 112 disp = _display_connect();
124 ck_assert(disp != NULL); 113 ck_assert(disp != NULL);
@@ -126,7 +115,771 @@ EFL_START_TEST(wl2_window_display_get)
126 win = _window_create(disp); 115 win = _window_create(disp);
127 ck_assert(win != NULL); 116 ck_assert(win != NULL);
128 117
129 ck_assert(ecore_wl2_window_display_get(win) != NULL); 118 ecore_wl2_window_floating_mode_set(win, EINA_TRUE);
119
120 f = ecore_wl2_window_floating_mode_get(win);
121 fail_if(f != EINA_TRUE);
122}
123EFL_END_TEST
124
125EFL_START_TEST(wl2_window_focus_skip)
126{
127 Ecore_Wl2_Display *disp;
128 Ecore_Wl2_Window *win;
129 Eina_Bool skip = EINA_FALSE;
130
131 disp = _display_connect();
132 ck_assert(disp != NULL);
133
134 win = _window_create(disp);
135 ck_assert(win != NULL);
136
137 ecore_wl2_window_focus_skip_set(win, EINA_TRUE);
138
139 skip = ecore_wl2_window_focus_skip_get(win);
140 fail_if(skip != EINA_TRUE);
141}
142EFL_END_TEST
143
144EFL_START_TEST(wl2_window_fullscreen)
145{
146 Ecore_Wl2_Display *disp;
147 Ecore_Wl2_Window *win;
148 Eina_Bool full = EINA_FALSE;
149
150 disp = _display_connect();
151 ck_assert(disp != NULL);
152
153 win = _window_create(disp);
154 ck_assert(win != NULL);
155
156 ecore_wl2_window_fullscreen_set(win, EINA_TRUE);
157
158 full = ecore_wl2_window_fullscreen_get(win);
159 fail_if(full != EINA_TRUE);
160}
161EFL_END_TEST
162
163EFL_START_TEST(wl2_window_maximize)
164{
165 Ecore_Wl2_Display *disp;
166 Ecore_Wl2_Window *win;
167 Eina_Bool m = EINA_FALSE;
168
169 disp = _display_connect();
170 ck_assert(disp != NULL);
171
172 win = _window_create(disp);
173 ck_assert(win != NULL);
174
175 ecore_wl2_window_maximized_set(win, EINA_TRUE);
176
177 m = ecore_wl2_window_maximized_get(win);
178 fail_if(m != EINA_TRUE);
179}
180EFL_END_TEST
181
182EFL_START_TEST(wl2_window_preferred_rot)
183{
184 Ecore_Wl2_Display *disp;
185 Ecore_Wl2_Window *win;
186 int rot = 0;
187
188 disp = _display_connect();
189 ck_assert(disp != NULL);
190
191 win = _window_create(disp);
192 ck_assert(win != NULL);
193
194 ecore_wl2_window_preferred_rotation_set(win, 90);
195
196 rot = ecore_wl2_window_preferred_rotation_get(win);
197 fail_if(rot != 90);
198}
199EFL_END_TEST
200
201EFL_START_TEST(wl2_window_rotation_app)
202{
203 Ecore_Wl2_Display *disp;
204 Ecore_Wl2_Window *win;
205 Eina_Bool r = EINA_FALSE;
206
207 disp = _display_connect();
208 ck_assert(disp != NULL);
209
210 win = _window_create(disp);
211 ck_assert(win != NULL);
212
213 ecore_wl2_window_rotation_app_set(win, EINA_TRUE);
214
215 r = ecore_wl2_window_rotation_app_get(win);
216 fail_if(r != EINA_TRUE);
217}
218EFL_END_TEST
219
220EFL_START_TEST(wl2_wm_window_rotation_app)
221{
222 Ecore_Wl2_Display *disp;
223 Ecore_Wl2_Window *win;
224 Eina_Bool r = EINA_FALSE;
225
226 disp = _display_connect();
227 ck_assert(disp != NULL);
228
229 win = _window_create(disp);
230 ck_assert(win != NULL);
231
232 ecore_wl2_window_wm_rotation_supported_set(win, EINA_TRUE);
233
234 r = ecore_wl2_window_wm_rotation_supported_get(win);
235 fail_if(r != EINA_TRUE);
236}
237EFL_END_TEST
238
239EFL_START_TEST(wl2_window_geometry)
240{
241 Ecore_Wl2_Display *disp;
242 Ecore_Wl2_Window *win;
243 int x, y, w, h;
244
245 disp = _display_connect();
246 ck_assert(disp != NULL);
247
248 win = _window_create(disp);
249 ck_assert(win != NULL);
250
251 ecore_wl2_window_geometry_set(win, 10, 10, 100, 100);
252
253 ecore_wl2_window_geometry_get(win, &x, &y, &w, &h);
254
255 fail_if(x != 10);
256 fail_if(y != 10);
257 fail_if(w != 100);
258 fail_if(h != 100);
259}
260EFL_END_TEST
261
262EFL_START_TEST(wl2_window_type)
263{
264 Ecore_Wl2_Display *disp;
265 Ecore_Wl2_Window *win;
266 Ecore_Wl2_Window_Type type = ECORE_WL2_WINDOW_TYPE_NONE;
267
268 disp = _display_connect();
269 ck_assert(disp != NULL);
270
271 win = _window_create(disp);
272 ck_assert(win != NULL);
273
274 ecore_wl2_window_type_set(win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
275
276 type = ecore_wl2_window_type_get(win);
277 fail_if(type != ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
278}
279EFL_END_TEST
280
281#ifdef GL_GLES
282static void
283_test_activated_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
284{
285 Test_Data *td = data;
286
287 td->frame_callback_count++;
288 if (td->frame_callback_count % 4 == 0)
289 glClearColor(0.0, 1.0, 0.0, 0.0);
290 else if (td->frame_callback_count % 4 == 1)
291 glClearColor(0.0, 0.0, 1.0, 0.0);
292 else if (td->frame_callback_count % 4 == 2)
293 glClearColor(0.0, 0.0, 0.0, 1.0);
294 else
295 glClearColor(1.0, 0.0, 0.0, 0.0);
296 glClear(GL_COLOR_BUFFER_BIT);
297 glFlush();
298
299 eglSwapBuffers(td->egl_display, td->egl_surface);
300
301 ecore_wl2_window_commit(td->win, EINA_TRUE);
302}
303
304static Eina_Bool
305_test_activated_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
306{
307 Test_Data *td = data;
308
309 td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_activated_frame_cb, td);
310 ecore_wl2_window_commit(td->win, EINA_TRUE);
311
312 return ECORE_CALLBACK_PASS_ON;
313}
314
315static Eina_Bool
316_test_activated_window_activate(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
317{
318 //TC Pass
319 ecore_main_loop_quit();
320
321 return ECORE_CALLBACK_PASS_ON;
322}
323
324EFL_START_TEST(wl2_window_activated)
325{
326 Test_Data *td;
327
328 ecore_wl2_init();
329
330 td = calloc(1, sizeof(Test_Data));
331 td->width = WIDTH;
332 td->height = HEIGHT;
333 td->frame_callback_count = 0;
334
335 td->display = _display_connect();
336 ck_assert(td->display != NULL);
337
338 td->win = _window_create(td->display);
339 ck_assert(td->win != NULL);
340
341 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
342
343 td->surface = _surface_get(td->win);
344 ck_assert(td->surface != NULL);
345
346 ecore_wl2_window_show(td->win);
347
348 _init_egl(td);
349 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
350 _test_activated_configure_complete, td);
351 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ACTIVATE,
352 _test_activated_window_activate, NULL);
353
354 ecore_main_loop_begin();
355
356 _term_egl(td);
357 ecore_wl2_shutdown();
358 free(td);
359}
360EFL_END_TEST
361#else
362EFL_START_TEST(wl2_window_activated)
363{
364 fail_if("No GL enabled GL should be enabled for API test");
365}
366EFL_END_TEST
367#endif
368
369EFL_START_TEST(wl2_window_aspect)
370{
371 Ecore_Wl2_Display *disp;
372 Ecore_Wl2_Window *win;
373 int w, h;
374 unsigned int aspect;
375
376 disp = _display_connect();
377 ck_assert(disp != NULL);
378
379 win = _window_create(disp);
380 ck_assert(win != NULL);
381
382 ecore_wl2_window_aspect_set(win, 1, 1, 3);
383 ecore_wl2_window_aspect_get(win, &w, &h, &aspect);
384
385 fail_if(w != 1);
386 fail_if(h != 1);
387 fail_if(aspect != 3);
388}
389EFL_END_TEST
390
391EFL_START_TEST(wl2_window_title)
392{
393 Ecore_Wl2_Display *disp;
394 Ecore_Wl2_Window *win;
395 const char *title;
396
397 disp = _display_connect();
398 ck_assert(disp != NULL);
399
400 win = _window_create(disp);
401 ck_assert(win != NULL);
402
403 ecore_wl2_window_title_set(win, "TEST");
404 title = ecore_wl2_window_title_get(win);
405
406 fail_if(strcmp(title, "TEST"));
407}
408EFL_END_TEST
409
410EFL_START_TEST(wl2_window_class)
411{
412 Ecore_Wl2_Display *disp;
413 Ecore_Wl2_Window *win;
414 const char *class;
415
416 disp = _display_connect();
417 ck_assert(disp != NULL);
418
419 win = _window_create(disp);
420 ck_assert(win != NULL);
421
422 ecore_wl2_window_class_set(win, "TEST");
423 class = ecore_wl2_window_class_get(win);
424
425 fail_if(strcmp(class, "TEST"));
426}
427EFL_END_TEST
428
429EFL_START_TEST(wl2_window_available_rotation)
430{
431 Ecore_Wl2_Display *disp;
432 Ecore_Wl2_Window *win;
433 Eina_Bool ret;
434 int rots[2] = { 90, 180 };
435 int *ret_rots;
436 unsigned int ret_count;
437
438 disp = _display_connect();
439 ck_assert(disp != NULL);
440
441 win = _window_create(disp);
442 ck_assert(win != NULL);
443
444 ecore_wl2_window_available_rotations_set(win, rots, 2);
445
446 ret = ecore_wl2_window_available_rotations_get(win, &ret_rots, &ret_count);
447
448 fail_if(ret != EINA_TRUE);
449 fail_if(ret_rots[0] != 90);
450 fail_if(ret_rots[1] != 180);
451 fail_if(ret_count != 2);
452
453 free(ret_rots);
454}
455EFL_END_TEST
456
457EFL_START_TEST(wl2_window_role)
458{
459 Ecore_Wl2_Display *disp;
460 Ecore_Wl2_Window *win;
461 const char *role;
462
463 disp = _display_connect();
464 ck_assert(disp != NULL);
465
466 win = _window_create(disp);
467 ck_assert(win != NULL);
468
469 ecore_wl2_window_role_set(win, "TEST");
470 role = ecore_wl2_window_role_get(win);
471
472 fail_if(strcmp(role, "TEST"));
473}
474EFL_END_TEST
475
476EFL_START_TEST(wl2_window_input_region)
477{
478 Ecore_Wl2_Display *disp;
479 Ecore_Wl2_Window *win;
480 int x, y, w, h;
481
482 disp = _display_connect();
483 ck_assert(disp != NULL);
484
485 win = _window_create(disp);
486 ck_assert(win != NULL);
487
488 ecore_wl2_window_input_region_set(win, 10, 10, 100, 100);
489
490 ecore_wl2_window_input_region_get(win, &x, &y, &w, &h);
491 fail_if(x != 10);
492 fail_if(y != 10);
493 fail_if(w != 100);
494 fail_if(h != 100);
495}
496EFL_END_TEST
497
498EFL_START_TEST(wl2_window_opaque_region)
499{
500 Ecore_Wl2_Display *disp;
501 Ecore_Wl2_Window *win;
502 int x, y, w, h;
503
504 disp = _display_connect();
505 ck_assert(disp != NULL);
506
507 win = _window_create(disp);
508 ck_assert(win != NULL);
509
510 ecore_wl2_window_opaque_region_set(win, 10, 10, 100, 100);
511
512 ecore_wl2_window_opaque_region_get(win, &x, &y, &w, &h);
513 fail_if(x != 10);
514 fail_if(y != 10);
515 fail_if(w != 100);
516 fail_if(h != 100);
517}
518EFL_END_TEST
519
520EFL_START_TEST(wl2_window_popup_input)
521{
522 Ecore_Wl2_Display *disp;
523 Ecore_Wl2_Window *win;
524 Ecore_Wl2_Input *input;
525 Eina_Iterator *itr;
526
527 disp = _display_connect();
528 ck_assert(disp != NULL);
529
530 win = _window_create(disp);
531 ck_assert(win != NULL);
532
533 ecore_wl2_window_type_set(win, ECORE_WL2_WINDOW_TYPE_MENU);
534
535 itr = ecore_wl2_display_inputs_get(disp);
536 ck_assert(itr != NULL);
537
538 EINA_ITERATOR_FOREACH(itr, input)
539 {
540 if (ecore_wl2_input_seat_capabilities_get(input) !=
541 ECORE_WL2_SEAT_CAPABILITIES_POINTER)
542 continue;
543
544 ecore_wl2_window_popup_input_set(win, input);
545 fail_if(ecore_wl2_window_popup_input_get(win) != input);
546 break;
547 }
548
549 eina_iterator_free(itr);
550}
551EFL_END_TEST
552
553static void
554_test_commit_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
555{
556 Test_Data *td = data;
557 td->frame_callback_count++;
558 ecore_main_loop_quit();
559}
560
561static Eina_Bool
562_test_commit_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
563{
564 Test_Data *td = data;
565
566 td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_commit_frame_cb, td);
567 ecore_wl2_window_commit(td->win, EINA_TRUE);
568
569 return ECORE_CALLBACK_PASS_ON;
570}
571
572EFL_START_TEST(wl2_window_commit)
573{
574 Test_Data *td;
575
576 ecore_wl2_init();
577
578 td = calloc(1, sizeof(Test_Data));
579 td->width = WIDTH;
580 td->height = HEIGHT;
581 td->frame_callback_count = 0;
582
583 td->display = _display_connect();
584 ck_assert(td->display != NULL);
585
586 td->win = _window_create(td->display);
587 ck_assert(td->win != NULL);
588
589 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
590
591 td->surface = _surface_get(td->win);
592 ck_assert(td->surface != NULL);
593
594 ecore_wl2_window_show(td->win);
595
596 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
597 _test_commit_configure_complete, td);
598
599 ecore_main_loop_begin();
600
601 //Check if the frame callback was called properly by ecore_wl2_window_commit().
602 fail_if(td->frame_callback_count == 0);
603
604 ecore_wl2_shutdown();
605 free(td);
606}
607EFL_END_TEST
608
609static void
610_test_frame_callback_frame_cb(Ecore_Wl2_Window *win EINA_UNUSED, uint32_t timestamp EINA_UNUSED, void *data)
611{
612 Test_Data *td = data;
613 td->frame_callback_count++;
614 if (td->frame_callback_count == 1)
615 {
616 ecore_wl2_window_frame_callback_del(td->frame_callback_handler);
617 td->frame_callback_handler = NULL;
618 ecore_main_loop_quit();
619 }
620}
621
622static Eina_Bool
623_test_frame_callback_configure_complete(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
624{
625 Test_Data *td = data;
626
627 td->frame_callback_handler = ecore_wl2_window_frame_callback_add(td->win, _test_frame_callback_frame_cb, td);
628 ecore_wl2_window_commit(td->win, EINA_TRUE);
629
630 return ECORE_CALLBACK_PASS_ON;
631}
632
633EFL_START_TEST(wl2_window_frame_callback)
634{
635 Test_Data *td;
636
637 ecore_wl2_init();
638
639 td = calloc(1, sizeof(Test_Data));
640 td->width = WIDTH;
641 td->height = HEIGHT;
642 td->frame_callback_count = 0;
643
644 td->display = _display_connect();
645 ck_assert(td->display != NULL);
646
647 td->win = _window_create(td->display);
648 ck_assert(td->win != NULL);
649
650 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
651
652 td->surface = _surface_get(td->win);
653 ck_assert(td->surface != NULL);
654
655 ecore_wl2_window_show(td->win);
656
657 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
658 _test_frame_callback_configure_complete, td);
659
660 ecore_main_loop_begin();
661
662 //Check if the frame callback called after then it sets NULL or not.
663 fail_if(td->frame_callback_count != 1);
664 fail_if(td->frame_callback_handler != NULL);
665
666 ecore_wl2_shutdown();
667 free(td);
668}
669EFL_END_TEST
670
671EFL_START_TEST(wl2_window_free)
672{
673 Ecore_Wl2_Window *t_win;
674 Test_Data *td;
675
676 ecore_wl2_init();
677
678 td = calloc(1, sizeof(Test_Data));
679
680 td->display = _display_connect();
681 ck_assert(td->display != NULL);
682
683 td->win = _window_create(td->display);
684 ck_assert(td->win != NULL);
685
686 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
687
688 td->surface = _surface_get(td->win);
689 ck_assert(td->surface != NULL);
690
691 ecore_wl2_window_show(td->win);
692
693 t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface);
694
695 fail_if(td->win != t_win);
696
697 ecore_wl2_window_free(td->win);
698 t_win = ecore_wl2_display_window_find_by_surface(td->display, td->surface);
699
700 //Check the returned window with freed window.
701 fail_if(td->win == t_win);
702
703 ecore_wl2_shutdown();
704 free(td);
705}
706EFL_END_TEST
707
708static Eina_Bool
709_test_hide_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
710{
711 //TC pass
712 ecore_main_loop_quit();
713
714 return ECORE_CALLBACK_PASS_ON;
715}
716
717EFL_START_TEST(wl2_window_hide)
718{
719 Test_Data *td;
720
721 ecore_wl2_init();
722
723 td = calloc(1, sizeof(Test_Data));
724 td->width = WIDTH;
725 td->height = HEIGHT;
726 td->frame_callback_count = 0;
727
728 td->display = _display_connect();
729 ck_assert(td->display != NULL);
730
731 td->win = _window_create(td->display);
732 ck_assert(td->win != NULL);
733
734 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
735
736 td->surface = _surface_get(td->win);
737 ck_assert(td->surface != NULL);
738
739 ecore_wl2_window_show(td->win);
740
741 ecore_wl2_window_hide(td->win);
742 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_HIDE,
743 _test_hide_window_hide, NULL);
744
745 ecore_main_loop_begin();
746
747 ecore_wl2_shutdown();
748 free(td);
749}
750EFL_END_TEST
751
752EFL_START_TEST(wl2_window_shell_surface_exists)
753{
754 Test_Data *td;
755
756 ecore_wl2_init();
757
758 td = calloc(1, sizeof(Test_Data));
759 td->width = WIDTH;
760 td->height = HEIGHT;
761 td->frame_callback_count = 0;
762
763 td->display = _display_connect();
764 ck_assert(td->display != NULL);
765
766 td->win = _window_create(td->display);
767 ck_assert(td->win != NULL);
768
769 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
770
771 td->surface = _surface_get(td->win);
772 ck_assert(td->surface != NULL);
773
774 ecore_wl2_window_show(td->win);
775
776 //window_show function will create shell surface. then checks it.
777 fail_if(ecore_wl2_window_shell_surface_exists(td->win) == EINA_FALSE);
778
779 ecore_wl2_shutdown();
780 free(td);
781}
782EFL_END_TEST
783
784static Eina_Bool
785_test_show_window_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
786{
787 //TC pass
788 ecore_main_loop_quit();
789
790 return ECORE_CALLBACK_PASS_ON;
791}
792
793EFL_START_TEST(wl2_window_show)
794{
795 Test_Data *td;
796
797 ecore_wl2_init();
798
799 td = calloc(1, sizeof(Test_Data));
800 td->width = WIDTH;
801 td->height = HEIGHT;
802 td->frame_callback_count = 0;
803
804 td->display = _display_connect();
805 ck_assert(td->display != NULL);
806
807 td->win = _window_create(td->display);
808 ck_assert(td->win != NULL);
809
810 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
811
812 td->surface = _surface_get(td->win);
813 ck_assert(td->surface != NULL);
814
815 ecore_wl2_window_show(td->win);
816
817 td->handler = ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW,
818 _test_show_window_show, NULL);
819
820 ecore_main_loop_begin();
821
822 ecore_wl2_shutdown();
823 free(td);
824}
825EFL_END_TEST
826
827static Eina_Bool _window_configure_event_called = EINA_FALSE;
828
829static Eina_Bool
830_test_update_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
831{
832 _window_configure_event_called = EINA_TRUE;
833
834 return ECORE_CALLBACK_PASS_ON;
835}
836
837static Eina_Bool
838_test_update_window_configure_complete(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
839{
840 //Checks if the configure_complete calling before configure calling
841 //when ecore_wl2_window_update_begin() called.
842 fail_if(_window_configure_event_called == EINA_TRUE);
843
844 ecore_main_loop_quit();
845
846 return ECORE_CALLBACK_PASS_ON;
847}
848
849EFL_START_TEST(wl2_window_update_begin)
850{
851 Test_Data *td;
852
853 ecore_wl2_init();
854
855 td = calloc(1, sizeof(Test_Data));
856 td->width = WIDTH;
857 td->height = HEIGHT;
858 td->frame_callback_count = 0;
859
860 td->display = _display_connect();
861 ck_assert(td->display != NULL);
862
863 td->win = _window_create(td->display);
864 ck_assert(td->win != NULL);
865
866 ecore_wl2_window_type_set(td->win, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
867
868 td->surface = _surface_get(td->win);
869 ck_assert(td->surface != NULL);
870
871 ecore_wl2_window_show(td->win);
872
873 ecore_wl2_window_update_begin(td->win);
874 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE,
875 _test_update_window_configure, NULL);
876 ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE_COMPLETE,
877 _test_update_window_configure_complete, NULL);
878
879 ecore_main_loop_begin();
880
881 ecore_wl2_shutdown();
882 free(td);
130} 883}
131EFL_END_TEST 884EFL_END_TEST
132 885
@@ -138,10 +891,36 @@ ecore_wl2_test_window(TCase *tc)
138 /* window tests can only run if there is an existing compositor */ 891 /* window tests can only run if there is an existing compositor */
139 tcase_add_test(tc, wl2_window_new); 892 tcase_add_test(tc, wl2_window_new);
140 tcase_add_test(tc, wl2_window_surface_test); 893 tcase_add_test(tc, wl2_window_surface_test);
141 tcase_add_test(tc, wl2_window_rotation_get); 894 tcase_add_test(tc, wl2_window_rotation);
142 tcase_add_test(tc, wl2_window_output_find);
143 if (getenv("E_START")) 895 if (getenv("E_START"))
144 tcase_add_test(tc, wl2_window_aux_hints_supported_get); 896 {
897 tcase_add_test(tc, wl2_window_commit);
898 tcase_add_test(tc, wl2_window_frame_callback);
899 tcase_add_test(tc, wl2_window_free);
900 tcase_add_test(tc, wl2_window_hide);
901 tcase_add_test(tc, wl2_window_shell_surface_exists);
902 tcase_add_test(tc, wl2_window_show);
903 tcase_add_test(tc, wl2_window_update_begin);
904 tcase_add_test(tc, wl2_window_activated);
905 }
145 tcase_add_test(tc, wl2_window_display_get); 906 tcase_add_test(tc, wl2_window_display_get);
907 tcase_add_test(tc, wl2_window_alpha);
908 tcase_add_test(tc, wl2_window_floating_mode);
909 tcase_add_test(tc, wl2_window_focus_skip);
910 tcase_add_test(tc, wl2_window_fullscreen);
911 tcase_add_test(tc, wl2_window_maximize);
912 tcase_add_test(tc, wl2_window_preferred_rot);
913 tcase_add_test(tc, wl2_window_rotation_app);
914 tcase_add_test(tc, wl2_wm_window_rotation_app);
915 tcase_add_test(tc, wl2_window_geometry);
916 tcase_add_test(tc, wl2_window_type);
917 tcase_add_test(tc, wl2_window_available_rotation);
918 tcase_add_test(tc, wl2_window_aspect);
919 tcase_add_test(tc, wl2_window_class);
920 tcase_add_test(tc, wl2_window_title);
921 tcase_add_test(tc, wl2_window_role);
922 tcase_add_test(tc, wl2_window_input_region);
923 tcase_add_test(tc, wl2_window_opaque_region);
924 tcase_add_test(tc, wl2_window_popup_input);
146 } 925 }
147} 926}
diff --git a/src/tests/ecore_wl2/ecore_wl2_tests_helper_egl.h b/src/tests/ecore_wl2/ecore_wl2_tests_helper_egl.h
new file mode 100644
index 0000000..03da269
--- /dev/null
+++ b/src/tests/ecore_wl2/ecore_wl2_tests_helper_egl.h
@@ -0,0 +1,42 @@
1#ifndef ECORE_WL2_TEST_HELPER_EGL_H
2# define ECORE_WL2_TEST_HELPER_EGL_H
3
4#include <wayland-egl.h>
5#include <EGL/egl.h>
6#include <GLES2/gl2.h>
7
8static void
9_init_egl(Test_Data *td)
10{
11 eglBindAPI(EGL_OPENGL_API);
12 EGLint num_config;
13
14 EGLint attributes[] = {
15 EGL_RED_SIZE, 8,
16 EGL_GREEN_SIZE, 8,
17 EGL_BLUE_SIZE, 8,
18 EGL_NONE
19 };
20
21 td->egl_display = eglGetDisplay((EGLNativeDisplayType)ecore_wl2_display_get(td->display));
22 eglInitialize(td->egl_display, NULL, NULL);
23 eglChooseConfig(td->egl_display, attributes, &td->egl_conf, 1, &num_config);
24 td->egl_context = eglCreateContext(td->egl_display, td->egl_conf, EGL_NO_CONTEXT, NULL);
25
26 td->egl_window = wl_egl_window_create(td->surface, td->width, td->height);
27 td->egl_surface = eglCreateWindowSurface(td->egl_display,
28 td->egl_conf, td->egl_window, NULL);
29
30 eglMakeCurrent(td->egl_display, td->egl_surface, td->egl_surface, td->egl_context);
31}
32
33static void
34_term_egl(Test_Data *td)
35{
36 eglDestroySurface(td->egl_display, td->egl_surface);
37 wl_egl_window_destroy(td->egl_window);
38 eglDestroyContext(td->egl_display, td->egl_context);
39 eglTerminate(td->egl_display);
40}
41
42#endif
diff --git a/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h b/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h
index f897dc9..c1fe465 100644
--- a/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h
+++ b/src/tests/ecore_wl2/ecore_wl2_tests_helpers.h
@@ -1,24 +1,48 @@
1#ifndef ECORE_WL2_TEST_HELPERS_H 1#ifndef ECORE_WL2_TEST_HELPERS_H
2# define ECORE_WL2_TEST_HELPERS_H 2# define ECORE_WL2_TEST_HELPERS_H
3 3
4# include <Ecore_Wl2.h> 4#include <wayland-egl.h>
5 5
6static Ecore_Wl2_Display * 6#ifdef GL_GLES
7_display_setup(void) 7#include <EGL/egl.h>
8#include <GLES2/gl2.h>
9#endif
10
11#define WIDTH 480
12#define HEIGHT 360
13
14typedef struct _Test_Data
8{ 15{
9 Ecore_Wl2_Display *disp; 16 Ecore_Wl2_Display *display;
17 Ecore_Wl2_Window *win;
18 Ecore_Wl2_Frame_Cb_Handle *frame_callback_handler;
19 Ecore_Event_Handler *handler;
10 20
11 disp = ecore_wl2_display_create(NULL); 21 struct wl_surface *surface;
12 return disp; 22 struct wl_egl_window *egl_window;
13} 23
24 int width;
25 int height;
26 int frame_callback_count;
27
28#ifdef GL_GLES
29 EGLDisplay egl_display;
30 EGLConfig egl_conf;
31 EGLSurface egl_surface;
32 EGLContext egl_context;
33#endif
34} Test_Data;
14 35
15static Ecore_Wl2_Display * 36static Ecore_Wl2_Display *
16_display_connect(void) 37_display_connect(void)
17{ 38{
18 Ecore_Wl2_Display *disp; 39 return ecore_wl2_display_connect(NULL);
40}
19 41
20 disp = ecore_wl2_display_connect(NULL); 42static Ecore_Wl2_Window *
21 return disp; 43_window_create(Ecore_Wl2_Display *disp)
44{
45 return ecore_wl2_window_new(disp, NULL, 100, 100, WIDTH, HEIGHT);
22} 46}
23 47
24#endif 48#endif
diff --git a/src/tests/ecore_wl2/meson.build b/src/tests/ecore_wl2/meson.build
index c1d37cb..0e2445e 100644
--- a/src/tests/ecore_wl2/meson.build
+++ b/src/tests/ecore_wl2/meson.build
@@ -5,13 +5,21 @@ ecore_wl2_suite_src = [
5 'ecore_wl2_test_ecore_wl2.c', 5 'ecore_wl2_test_ecore_wl2.c',
6 'ecore_wl2_test_display.c', 6 'ecore_wl2_test_display.c',
7 'ecore_wl2_test_window.c', 7 'ecore_wl2_test_window.c',
8 'ecore_wl2_test_input.c', 8 'ecore_wl2_test_input.c'
9 'ecore_wl2_test_surface.c'
10] 9]
11 10
11wl2_test_gl_deps = []
12
13if get_option('opengl') == 'es-egl'
14 ecore_wl2_suite_src += 'ecore_wl2_tests_helper_egl.h'
15 wl2_test_gl_deps += dependency('egl')
16 wl2_test_gl_deps += dependency('gl')
17endif
18
12ecore_wl2_suite = executable('ecore_wl2_suite', 19ecore_wl2_suite = executable('ecore_wl2_suite',
13 ecore_wl2_suite_src, 20 ecore_wl2_suite_src,
14 dependencies: [ecore_wl2, ecore, check, wayland_protocol], 21 dependencies: [ecore_wl2, ecore, ecore_input, check, wayland_protocol, wayland_client, dependency('wayland-egl'), wl2_test_gl_deps],
22
15 c_args : [ 23 c_args : [
16 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', 24 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
17 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] 25 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
diff --git a/src/tests/edje/data/test_textblock.edc b/src/tests/edje/data/test_textblock.edc
index e8223e7..f7cc007 100644
--- a/src/tests/edje/data/test_textblock.edc
+++ b/src/tests/edje/data/test_textblock.edc
@@ -1,8 +1,21 @@
1collections { 1collections {
2 text_classes {
3 text_class {
4 name: "tc1";
5 font: "Serif";
6 size: 18;
7 }
8 }
2 styles { 9 styles {
3 style { name: "tb_style"; 10 style { name: "tb_style";
4 base: "font=Sans font_size=20 color=#fff"; 11 base: "font=Sans font_size=20 color=#fff";
5 } 12 }
13 style { name: "tb_tc_style";
14 base: "color=#ff0 text_class=tc1";
15 }
16 style { name: "tb_tc2_style";
17 base: "color=#0ff text_class=tc2";
18 }
6 } 19 }
7 group { name: "test_textblock"; 20 group { name: "test_textblock";
8 parts { 21 parts {
@@ -18,4 +31,32 @@ collections {
18 } 31 }
19 } 32 }
20 } 33 }
34 group { name: "test_tc_textblock";
35 parts {
36 part { name: "tb";
37 type: TEXTBLOCK;
38 description { state: "default" 0.0;
39 min: 300 300;
40 text {
41 text: "Hello World";
42 style: "tb_tc_style";
43 }
44 }
45 }
46 }
47 }
48 group { name: "test_tc_textblock2";
49 parts {
50 part { name: "tb2";
51 type: TEXTBLOCK;
52 description { state: "default" 0.0;
53 min: 300 300;
54 text {
55 text: "Hello World";
56 style: "tb_tc2_style";
57 }
58 }
59 }
60 }
61 }
21} 62}
diff --git a/src/tests/edje/edje_test_text.c b/src/tests/edje/edje_test_text.c
index 45ef800..bb8499c 100644
--- a/src/tests/edje/edje_test_text.c
+++ b/src/tests/edje/edje_test_text.c
@@ -102,13 +102,54 @@ EFL_START_TEST(edje_test_textblock)
102 evas = _setup_evas(); 102 evas = _setup_evas();
103 103
104 obj = edje_object_add(evas); 104 obj = edje_object_add(evas);
105 fail_unless(edje_object_file_set(obj, test_layout_get("test_textblock.edj"), "test_textblock")); 105 ck_assert(edje_object_file_set(obj, test_layout_get("test_textblock.edj"), "test_textblock"));
106 txt = edje_object_part_text_get(obj, "text"); 106 txt = edje_object_part_text_get(obj, "text");
107 fail_if(!txt || strcmp(txt, "Bye")); 107 ck_assert_ptr_ne(txt, NULL);
108 ck_assert_int_eq(strcmp(txt, "Bye"), 0);
108 edje_object_part_text_set(obj, "text", buf); 109 edje_object_part_text_set(obj, "text", buf);
109 txt = edje_object_part_text_get(obj, "text"); 110 txt = edje_object_part_text_get(obj, "text");
110 fail_if(!txt || strcmp(txt, buf)); 111 ck_assert_ptr_ne(txt, NULL);
111 112 ck_assert_int_eq(strcmp(txt, buf), 0);
113
114 Evas_Object *obj2 = edje_object_add(evas);
115 ck_assert(edje_object_file_set(obj2, test_layout_get("test_textblock.edj"), "test_tc_textblock"));
116 Evas_Object *tb = (Evas_Object*)edje_object_part_object_get(obj2, "tb");
117 ck_assert_ptr_ne(tb, NULL);
118 int w = 0, h = 0;
119 evas_object_textblock_size_formatted_get(tb, &w, &h);
120 Evas_Textblock_Style *st = evas_object_textblock_style_get(tb);
121 txt = evas_textblock_style_get(st);
122 ck_assert_str_eq(txt, "DEFAULT='color=#ff0 font_size=18.0 font=Serif'");
123 ck_assert_int_ne(w, 0);
124 ck_assert_int_ne(h, 0);
125
126 edje_object_text_class_set(obj2, "tc1", "Sans", 15);
127 edje_object_calc_force(obj2);
128 int w2 = 0, h2 = 0;
129 evas_object_textblock_size_formatted_get(tb, &w2, &h2);
130 ck_assert_int_ne(w2, 0);
131 ck_assert_int_ne(h2, 0);
132 ck_assert_int_ne(w, w2);
133 ck_assert_int_ne(h, h2);
134
135 ck_assert(edje_object_file_set(obj2, test_layout_get("test_textblock.edj"), "test_tc_textblock2"));
136 tb = (Evas_Object*)edje_object_part_object_get(obj2, "tb2");
137 ck_assert_ptr_ne(tb, NULL);
138 st = evas_object_textblock_style_get(tb);
139 txt = evas_textblock_style_get(st);
140 ck_assert_str_eq(txt, "DEFAULT='color=#0ff'");
141 evas_object_textblock_size_formatted_get(tb, &w, &h);
142 ck_assert_int_eq(w, 0);
143 ck_assert_int_eq(h, 0);
144
145 edje_object_text_class_set(obj2, "tc2", "Sans", 15);
146 edje_object_calc_force(obj2);
147 evas_object_textblock_size_formatted_get(tb, &w, &h);
148 ck_assert_int_ne(w, 0);
149 ck_assert_int_ne(h, 0);
150 st = evas_object_textblock_style_get(tb);
151 txt = evas_textblock_style_get(st);
152 ck_assert_str_eq(txt, "DEFAULT='color=#0ff font_size=15.0 font=Sans'");
112} 153}
113EFL_END_TEST 154EFL_END_TEST
114 155
@@ -161,7 +202,8 @@ START_TEST(edje_test_text_font)
161 efl_file_key_set(layout, "test"); 202 efl_file_key_set(layout, "test");
162 ck_assert(!efl_file_load(layout)); 203 ck_assert(!efl_file_load(layout));
163 204
164 efl_text_font_set(efl_part(layout, "text"), "Sans", 14); 205 efl_text_font_family_set(efl_part(layout, "text"), "Sans");
206 efl_text_font_size_set(efl_part(layout, "text"), 14);
165 207
166} 208}
167END_TEST 209END_TEST
@@ -179,7 +221,7 @@ START_TEST(edje_test_text_color)
179 efl_file_key_set(layout, "test"); 221 efl_file_key_set(layout, "test");
180 ck_assert(!efl_file_load(layout)); 222 ck_assert(!efl_file_load(layout));
181 223
182 efl_text_normal_color_set(efl_part(layout, "text"), 255, 255, 255, 255); 224 efl_text_color_set(efl_part(layout, "text"), 255, 255, 255, 255);
183 225
184} 226}
185END_TEST 227END_TEST
@@ -194,13 +236,13 @@ _basic_check(Eo *layout, Eina_Bool set)
194 // Just normal_color is enough 236 // Just normal_color is enough
195 if (set) 237 if (set)
196 { 238 {
197 efl_text_normal_color_set(efl_part(layout, "text"), 239 efl_text_color_set(efl_part(layout, "text"),
198 255, 255, 255, 255); 240 255, 255, 255, 255);
199 efl_text_backing_color_set(efl_part(layout, "text"), 241 efl_text_background_color_set(efl_part(layout, "text"),
200 255, 255, 255, 255); 242 255, 255, 255, 255);
201 efl_text_glow_color_set(efl_part(layout, "text"), 243 efl_text_glow_color_set(efl_part(layout, "text"),
202 255, 255, 255, 255); 244 255, 255, 255, 255);
203 efl_text_glow2_color_set(efl_part(layout, "text"), 245 efl_text_secondary_glow_color_set(efl_part(layout, "text"),
204 255, 255, 255, 255); 246 255, 255, 255, 255);
205 efl_text_outline_color_set(efl_part(layout, "text"), 247 efl_text_outline_color_set(efl_part(layout, "text"),
206 255, 255, 255, 255); 248 255, 255, 255, 255);
@@ -210,19 +252,19 @@ _basic_check(Eo *layout, Eina_Bool set)
210 255, 255, 255, 255); 252 255, 255, 255, 255);
211 efl_text_underline_color_set(efl_part(layout, "text"), 253 efl_text_underline_color_set(efl_part(layout, "text"),
212 255, 255, 255, 255); 254 255, 255, 255, 255);
213 efl_text_underline2_color_set(efl_part(layout, "text"), 255 efl_text_secondary_underline_color_set(efl_part(layout, "text"),
214 255, 255, 255, 255); 256 255, 255, 255, 255);
215 efl_text_underline_dashed_color_set(efl_part(layout, "text"), 257 efl_text_underline_dashed_color_set(efl_part(layout, "text"),
216 255, 255, 255, 255); 258 255, 255, 255, 255);
217 } 259 }
218 260
219 efl_text_normal_color_get(efl_part(layout, "text"), &r, &g, &b, &a); 261 efl_text_color_get(efl_part(layout, "text"), &r, &g, &b, &a);
220 ck_assert_int_eq(r, 255); 262 ck_assert_int_eq(r, 255);
221 ck_assert_int_eq(g, 255); 263 ck_assert_int_eq(g, 255);
222 ck_assert_int_eq(b, 255); 264 ck_assert_int_eq(b, 255);
223 ck_assert_int_eq(a, 255); 265 ck_assert_int_eq(a, 255);
224 266
225 efl_text_backing_color_get(efl_part(layout, "text"), &r, &g, &b, &a); 267 efl_text_background_color_get(efl_part(layout, "text"), &r, &g, &b, &a);
226 ck_assert_int_eq(r, 255); 268 ck_assert_int_eq(r, 255);
227 ck_assert_int_eq(g, 255); 269 ck_assert_int_eq(g, 255);
228 ck_assert_int_eq(b, 255); 270 ck_assert_int_eq(b, 255);
@@ -234,7 +276,7 @@ _basic_check(Eo *layout, Eina_Bool set)
234 ck_assert_int_eq(b, 255); 276 ck_assert_int_eq(b, 255);
235 ck_assert_int_eq(a, 255); 277 ck_assert_int_eq(a, 255);
236 278
237 efl_text_glow2_color_get(efl_part(layout, "text"), &r, &g, &b, &a); 279 efl_text_secondary_glow_color_get(efl_part(layout, "text"), &r, &g, &b, &a);
238 ck_assert_int_eq(r, 255); 280 ck_assert_int_eq(r, 255);
239 ck_assert_int_eq(g, 255); 281 ck_assert_int_eq(g, 255);
240 ck_assert_int_eq(b, 255); 282 ck_assert_int_eq(b, 255);
@@ -264,7 +306,7 @@ _basic_check(Eo *layout, Eina_Bool set)
264 ck_assert_int_eq(b, 255); 306 ck_assert_int_eq(b, 255);
265 ck_assert_int_eq(a, 255); 307 ck_assert_int_eq(a, 255);
266 308
267 efl_text_underline2_color_get(efl_part(layout, "text"), &r, &g, &b, &a); 309 efl_text_secondary_underline_color_get(efl_part(layout, "text"), &r, &g, &b, &a);
268 ck_assert_int_eq(r, 255); 310 ck_assert_int_eq(r, 255);
269 ck_assert_int_eq(g, 255); 311 ck_assert_int_eq(g, 255);
270 ck_assert_int_eq(b, 255); 312 ck_assert_int_eq(b, 255);
@@ -288,7 +330,8 @@ _basic_check(Eo *layout, Eina_Bool set)
288 { 330 {
289 efl_text_wrap_set(efl_part(layout, "text"), EFL_TEXT_FORMAT_WRAP_WORD); 331 efl_text_wrap_set(efl_part(layout, "text"), EFL_TEXT_FORMAT_WRAP_WORD);
290 efl_text_ellipsis_set(efl_part(layout, "text"), 1.0); 332 efl_text_ellipsis_set(efl_part(layout, "text"), 1.0);
291 efl_text_font_set(efl_part(layout, "text"), "Sans", 12); 333 efl_text_font_family_set(efl_part(layout, "text"), "Sans");
334 efl_text_font_size_set(efl_part(layout, "text"), 12);
292 } 335 }
293 336
294 wrap = efl_text_wrap_get(efl_part(layout, "text")); 337 wrap = efl_text_wrap_get(efl_part(layout, "text"));
@@ -297,7 +340,8 @@ _basic_check(Eo *layout, Eina_Bool set)
297 ellipsis = efl_text_ellipsis_get(efl_part(layout, "text")); 340 ellipsis = efl_text_ellipsis_get(efl_part(layout, "text"));
298 ck_assert(EINA_DBL_EQ(ellipsis, 1.0)); 341 ck_assert(EINA_DBL_EQ(ellipsis, 1.0));
299 342
300 efl_text_font_get(efl_part(layout, "text"), &font, &size); 343 font = efl_text_font_family_get(efl_part(layout, "text"));
344 size = efl_text_font_size_get(efl_part(layout, "text"));
301 ck_assert_str_eq(font, "Sans"); 345 ck_assert_str_eq(font, "Sans");
302 ck_assert_int_eq(size, 12); 346 ck_assert_int_eq(size, 12);
303 } 347 }
diff --git a/src/tests/edje_cxx/cxx_compile_test.cc b/src/tests/edje_cxx/cxx_compile_test.cc
index 33390ee..9f4971b 100644
--- a/src/tests/edje_cxx/cxx_compile_test.cc
+++ b/src/tests/edje_cxx/cxx_compile_test.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include "config.h" 17# include "config.h"
3#endif 18#endif
diff --git a/src/tests/eet_cxx/eet_cxx_suite.cc b/src/tests/eet_cxx/eet_cxx_suite.cc
index a2b443c..71c418b 100644
--- a/src/tests/eet_cxx/eet_cxx_suite.cc
+++ b/src/tests/eet_cxx/eet_cxx_suite.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include <config.h> 17# include <config.h>
3#endif 18#endif
diff --git a/src/tests/eet_cxx/eet_cxx_test_descriptors.cc b/src/tests/eet_cxx/eet_cxx_test_descriptors.cc
index 98ae254..51d8968 100644
--- a/src/tests/eet_cxx/eet_cxx_test_descriptors.cc
+++ b/src/tests/eet_cxx/eet_cxx_test_descriptors.cc
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1#ifdef HAVE_CONFIG_H 16#ifdef HAVE_CONFIG_H
2# include <config.h> 17# include <config.h>
3#endif 18#endif
diff --git a/src/tests/efl/efl_test_composite_model.c b/src/tests/efl/efl_test_composite_model.c
index abae4c3..8d05b6d 100644
--- a/src/tests/efl/efl_test_composite_model.c
+++ b/src/tests/efl/efl_test_composite_model.c
@@ -25,18 +25,26 @@
25#include <Efl.h> 25#include <Efl.h>
26#include <Ecore.h> 26#include <Ecore.h>
27 27
28static const int child_number = 3; 28static const int child_number = 7;
29static const int base_ints[] = { 41, 42, 43 }; 29static const int base_ints[] = { 41, 42, 43, 44, 45, 46, 47 };
30
31static void
32_cleanup(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Future *dead_future EINA_UNUSED)
33{
34 ecore_main_loop_quit();
35}
30 36
31static Eina_Value 37static Eina_Value
32_children_slice_get_then(void *data EINA_UNUSED, 38_children_slice_get_then(Eo *o EINA_UNUSED,
33 const Eina_Value v, 39 void *data EINA_UNUSED,
34 const Eina_Future *dead_future EINA_UNUSED) 40 const Eina_Value v)
35{ 41{
36 unsigned int i, len; 42 unsigned int i, len;
37 Efl_Model *child; 43 Efl_Model *child;
44 Eina_Future **all;
38 45
39 fail_if(eina_value_type_get(&v) != EINA_VALUE_TYPE_ARRAY); 46 all = calloc(1, sizeof (Eina_Future *) * (eina_value_array_count(&v) + 1));
47 if (!all) return eina_value_error_init(ENOMEM);
40 48
41 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) 49 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
42 { 50 {
@@ -55,6 +63,8 @@ _children_slice_get_then(void *data EINA_UNUSED,
55 fail_if(!eina_value_bool_get(p_true, &v_true)); 63 fail_if(!eina_value_bool_get(p_true, &v_true));
56 fail_if(!eina_value_bool_get(p_false, &v_false)); 64 fail_if(!eina_value_bool_get(p_false, &v_false));
57 65
66 all[i] = efl_model_property_set(child, "test_odd_even", v_int & 0x1 ? p_true : p_false);
67
58 fail_if(v_int != base_ints[i]); 68 fail_if(v_int != base_ints[i]);
59 fail_if(v_true != EINA_TRUE); 69 fail_if(v_true != EINA_TRUE);
60 fail_if(v_false != EINA_FALSE); 70 fail_if(v_false != EINA_FALSE);
@@ -63,12 +73,87 @@ _children_slice_get_then(void *data EINA_UNUSED,
63 eina_value_free(p_true); 73 eina_value_free(p_true);
64 eina_value_free(p_false); 74 eina_value_free(p_false);
65 } 75 }
76 all[i] = EINA_FUTURE_SENTINEL;
66 77
67 ecore_main_loop_quit(); 78 return eina_future_as_value(eina_future_all_array(all));
79}
80
81static Eina_Value
82_children_odd_even_ready(Eo *model, void *data EINA_UNUSED, const Eina_Value v EINA_UNUSED)
83{
84 return eina_future_as_value(efl_model_children_slice_get(model, 0, child_number));
85}
86
87static Eina_Value
88_children_odd_even_check(Eo *model, void *data EINA_UNUSED, const Eina_Value v)
89{
90 unsigned int i, len;
91 Efl_Model *child, *first_child = NULL;
92
93 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
94 {
95 Eina_Value *p_odd_even = NULL;
96 Eina_Value *p_int = NULL;
97 Eina_Bool v_odd_even = EINA_TRUE;
98 int v_int = -1;
99
100 if (!first_child) first_child = child;
101
102 p_int = efl_model_property_get(child, "test_p_int");
103 p_odd_even = efl_model_property_get(child, "test_odd_even");
104
105 fail_if(!eina_value_bool_get(p_odd_even, &v_odd_even));
106 fail_if(!eina_value_int_get(p_int, &v_int));
107
108 fail_if(v_int & 0x1 ? !v_odd_even : v_odd_even);
109
110 eina_value_free(p_int);
111 eina_value_free(p_odd_even);
112 }
113
114 efl_model_child_del(model, first_child);
115
116 return eina_future_as_value(efl_model_children_slice_get(model, 0, child_number - 1));
117}
118
119static Eina_Value
120_children_odd_even_check_after_removal(Eo *model EINA_UNUSED, void *data EINA_UNUSED,
121 const Eina_Value v)
122{
123 unsigned int i, len;
124 Efl_Model *child;
125
126 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
127 {
128 Eina_Value *p_odd_even = NULL;
129 Eina_Value *p_int = NULL;
130 Eina_Bool v_odd_even = EINA_TRUE;
131 int v_int = -1;
132
133 p_int = efl_model_property_get(child, "test_p_int");
134 p_odd_even = efl_model_property_get(child, "test_odd_even");
135
136 fail_if(!eina_value_bool_get(p_odd_even, &v_odd_even));
137 fail_if(!eina_value_int_get(p_int, &v_int));
138
139 fail_if(v_int & 0x1 ? !v_odd_even : v_odd_even);
140 fail_if(v_int != base_ints[i + 1]);
141
142 eina_value_free(p_int);
143 eina_value_free(p_odd_even);
144 }
68 145
69 return v; 146 return v;
70} 147}
71 148
149static Eina_Value
150_assert_on_error(Eo *o EINA_UNUSED, void *data EINA_UNUSED, Eina_Error error)
151{
152 ck_abort_msg("Assert on error triggered duing Boolean Model test with error '%s'.\n",
153 eina_error_msg_get(error));
154 return eina_value_error_init(error);
155}
156
72EFL_START_TEST(efl_test_boolean_model) 157EFL_START_TEST(efl_test_boolean_model)
73{ 158{
74 Efl_Generic_Model *base_model, *child; 159 Efl_Generic_Model *base_model, *child;
@@ -91,13 +176,26 @@ EFL_START_TEST(efl_test_boolean_model)
91 } 176 }
92 177
93 model = efl_add_ref(EFL_BOOLEAN_MODEL_CLASS, efl_main_loop_get(), 178 model = efl_add_ref(EFL_BOOLEAN_MODEL_CLASS, efl_main_loop_get(),
94 efl_ui_view_model_set(efl_added, base_model), 179 efl_ui_view_model_set(efl_added, base_model),
95 efl_boolean_model_boolean_add(efl_added, "test_p_true", EINA_TRUE), 180 efl_boolean_model_boolean_add(efl_added, "test_p_true", EINA_TRUE),
96 efl_boolean_model_boolean_add(efl_added, "test_p_false", EINA_FALSE)); 181 efl_boolean_model_boolean_add(efl_added, "test_p_false", EINA_FALSE),
182 efl_boolean_model_boolean_add(efl_added, "test_odd_even", EINA_FALSE));
97 ck_assert(!!model); 183 ck_assert(!!model);
98 184
99 future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model)); 185 future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model));
100 eina_future_then(future, _children_slice_get_then, NULL, NULL); 186 future = efl_future_then(model, future,
187 .success = _children_slice_get_then,
188 .success_type = EINA_VALUE_TYPE_ARRAY);
189 future = efl_future_then(model, future,
190 .success = _children_odd_even_ready,
191 .success_type = EINA_VALUE_TYPE_ARRAY);
192 future = efl_future_then(model, future,
193 .success = _children_odd_even_check,
194 .success_type = EINA_VALUE_TYPE_ARRAY);
195 future = efl_future_then(model, future,
196 .success = _children_odd_even_check_after_removal,
197 .success_type = EINA_VALUE_TYPE_ARRAY);
198 future = efl_future_then(model, future, .error = _assert_on_error, .free = _cleanup);
101 199
102 ecore_main_loop_begin(); 200 ecore_main_loop_begin();
103} 201}
@@ -303,12 +401,6 @@ _check_index(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v)
303 return v; 401 return v;
304} 402}
305 403
306static void
307_cleanup(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Future *dead_future EINA_UNUSED)
308{
309 ecore_main_loop_quit();
310}
311
312EFL_START_TEST(efl_test_filter_model) 404EFL_START_TEST(efl_test_filter_model)
313{ 405{
314 Efl_Generic_Model *base_model, *child; 406 Efl_Generic_Model *base_model, *child;
diff --git a/src/tests/efl/efl_test_container_model.c b/src/tests/efl/efl_test_container_model.c
index e311ea2..35dfed7 100644
--- a/src/tests/efl/efl_test_container_model.c
+++ b/src/tests/efl/efl_test_container_model.c
@@ -63,7 +63,6 @@ _children_slice_future_then(void *data EINA_UNUSED,
63 abort(); 63 abort();
64 } 64 }
65 } 65 }
66 fprintf(stderr, "len: %i\n", len);
67 66
68 fail_if(len != 7); 67 fail_if(len != 7);
69 68
diff --git a/src/tests/efl_mono/Array.cs b/src/tests/efl_mono/Array.cs
new file mode 100644
index 0000000..83f9e35
--- /dev/null
+++ b/src/tests/efl_mono/Array.cs
@@ -0,0 +1,189 @@
1using System;
2using System.Collections.Generic;
3using System.Linq;
4
5namespace TestSuite
6{
7
8class TestArray
9{
10 public static void TestAdd()
11 {
12 IList<int> array = new Eina.Array<int>();
13 Test.AssertEquals(array.Count, 0);
14 array.Add(1);
15 Test.AssertEquals(array.Count, 1);
16 array.Add(2);
17 Test.AssertEquals(array.Count, 2);
18 }
19
20 public static void TestRemoveAt()
21 {
22 IList<int> array = new Eina.Array<int>();
23 Test.AssertEquals(array.Count, 0);
24 array.Add(1);
25 Test.AssertEquals(array.Count, 1);
26 Test.AssertEquals(array[0], 1);
27 array.RemoveAt(0);
28 Test.AssertEquals(array.Count, 0);
29 array.Add(1);
30 array.Add(0);
31 array.Add(1);
32 Test.AssertEquals(array.Count, 3);
33 Test.AssertEquals(array[2], 1);
34 array.RemoveAt(2);
35 Test.AssertEquals(array.Count, 2);
36 Test.AssertEquals(array[0], 1);
37 }
38
39 public static void TestRemove()
40 {
41 IList<int> array = new Eina.Array<int>();
42 Test.Assert(!array.Remove(0));
43 Test.AssertEquals(array.Count, 0);
44 array.Add(1);
45 Test.AssertEquals(array.Count, 1);
46 Test.Assert(array.Remove(1));
47 Test.AssertEquals(array.Count, 0);
48 array.Add(1);
49 array.Add(1);
50 Test.AssertEquals(array.Count, 2);
51 Test.Assert(array.Remove(1));
52 Test.AssertEquals(array.Count, 1);
53 array.Add(0);
54 array.Add(1);
55 Test.AssertEquals(array[1], 0);
56 Test.AssertEquals(array.Count, 3);
57 Test.Assert(!array.Remove(2));
58 Test.Assert(array.Remove(1));
59 Test.AssertEquals(array[1], 1);
60 Test.AssertEquals(array.Count, 2);
61 }
62
63 public static void TestContains()
64 {
65 IList<int> array = new Eina.Array<int>();
66 Test.AssertEquals(array.Count, 0);
67 Test.Assert(!array.Contains(0));
68 array.Add(0);
69 Test.Assert(array.Contains(0));
70 Test.Assert(array.Remove(0));
71 Test.Assert(!array.Contains(0));
72 array.Add(1);
73 array.Add(0);
74 Test.Assert(array.Contains(0));
75 }
76
77 public static void TestClear()
78 {
79 IList<int> array = new Eina.Array<int>();
80 Test.AssertEquals(array.Count, 0);
81 array.Clear();
82 Test.AssertEquals(array.Count, 0);
83 array.Add(0);
84 Test.AssertEquals(array.Count, 1);
85 array.Clear();
86 Test.AssertEquals(array.Count, 0);
87 array.Add(0);
88 array.Add(0);
89 Test.AssertEquals(array.Count, 2);
90 array.Clear();
91 Test.AssertEquals(array.Count, 0);
92 array.Add(0);
93 array.Add(0);
94 Test.AssertEquals(array.Count, 2);
95 Test.Assert(array.Remove(0));
96 Test.AssertEquals(array.Count, 1);
97 array.Clear();
98 Test.AssertEquals(array.Count, 0);
99 }
100
101 public static void TestInsert()
102 {
103 IList<int> array = new Eina.Array<int>();
104 array.Add(99);
105 Test.AssertEquals(array.Count, 1);
106 array.Insert(0, 6);
107 Test.AssertEquals(array.Count, 2);
108 Test.AssertEquals(array[0], 6);
109 array.Insert(1, 5);
110 Test.AssertEquals(array.Count, 3);
111 Test.AssertEquals(array[1], 5);
112 array.Insert(1, 10);
113 Test.AssertEquals(array.Count, 4);
114 Test.AssertEquals(array[1], 10);
115 array.RemoveAt(1);
116 Test.AssertEquals(array.Count, 3);
117 Test.AssertEquals(array[1], 5);
118 array.Insert(1, 42);
119 Test.AssertEquals(array.Count, 4);
120 Test.AssertEquals(array[1], 42);
121 }
122
123 public static void TestIndexOf()
124 {
125 IList<int> array = new Eina.Array<int>();
126 Test.AssertEquals(array.Count, 0);
127 array.Add(1);
128 Test.AssertEquals(array.Count, 1);
129 Test.AssertEquals(0, array.IndexOf(1));
130 array.Insert(0, 0);
131 Test.AssertEquals(array.Count, 2);
132 Test.AssertEquals(0, array.IndexOf(0));
133 Test.AssertEquals(1, array.IndexOf(1));
134 array.Insert(0, 1);
135 Test.AssertEquals(array.Count, 3);
136 Test.AssertEquals(0, array.IndexOf(1));
137 Test.AssertEquals(1, array.IndexOf(0));
138 array.Insert(0, 1);
139 Test.AssertEquals(array.Count, 4);
140 Test.AssertEquals(0, array.IndexOf(1));
141 Test.AssertEquals(2, array.IndexOf(0));
142 }
143
144 public static void TestCopyTo()
145 {
146 IList<int> array = new Eina.Array<int>();
147 Test.AssertEquals(array.Count, 0);
148 int[] random = {4, 40, 10, 42, 99};
149 array.Add(43);
150 array.Insert(0, 1);
151 array.Insert(1, 50);
152 Test.AssertEquals(array.Count, 3);
153 Array.ForEach(random, (n) => array.Add(n));
154 Test.AssertEquals(array.Count, 8);
155 int[] expected = {1, 50, 43, 4, 40, 10, 42, 99};
156 var result = new int[expected.Length];
157 array.CopyTo(result, 0);
158 for (int i = 0; i < expected.Length; ++i)
159 {
160 Test.AssertEquals(expected[i], result[i]);
161 }
162 }
163
164 public static void TestIdxOutBounds()
165 {
166 var array = new Eina.Array<int>();
167 array.Add(4);
168 Test.AssertRaises<ArgumentOutOfRangeException>(()=>array.At(1));
169 Test.AssertRaises<ArgumentOutOfRangeException>(()=>array.At(-1));
170 Test.AssertNotRaises<ArgumentOutOfRangeException>
171 (()=>array.At(array.IndexOf(4)));
172 }
173
174 public static void TestIsReadOnly()
175 {
176 var array = new Eina.Array<int>();
177 int[] tmp = {1, 3, 2, 6 ,5};
178 array.Append(tmp);
179 Test.AssertEquals(array.Count, 5);
180 array.SetOwnership(false);
181 Test.AssertRaises<NotSupportedException>(() => array.Add(4));
182 Test.AssertRaises<NotSupportedException>(() => array.Push(6));
183 Test.AssertRaises<NotSupportedException>(() => array.Append(tmp));
184 Test.AssertEquals(array.Count, 5);
185 Test.AssertRaises<NotSupportedException>(() => array.DataSet(2, 4));
186 Test.Assert(array.ToArray().SequenceEqual(tmp));
187 }
188}
189}
diff --git a/src/tests/efl_mono/BasicDirection.cs b/src/tests/efl_mono/BasicDirection.cs
index 2c5995c..5c20ccb 100644
--- a/src/tests/efl_mono/BasicDirection.cs
+++ b/src/tests/efl_mono/BasicDirection.cs
@@ -1,3 +1,18 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1using System; 16using System;
2using System.Runtime.InteropServices; 17using System.Runtime.InteropServices;
3using System.Linq; 18using System.Linq;
@@ -16,6 +31,7 @@ class TestIntDirections
16 t.IntOut(original, out received); 31 t.IntOut(original, out received);
17 32
18 Test.AssertEquals(-original, received); 33 Test.AssertEquals(-original, received);
34 t.Dispose();
19 } 35 }
20 36
21 /* 37 /*
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index 0c6212a..461dee6 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -1,9 +1,25 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
1using System; 16using System;
2using System.Collections.Generic; 17using System.Collections.Generic;
3using System.Linq; 18using System.Linq;
4using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
5using System.Runtime.CompilerServices; 20using System.Runtime.CompilerServices;
6 21
22using Eina;
7using EinaTestData; 23using EinaTestData;
8using static EinaTestData.BaseData; 24using static EinaTestData.BaseData;
9 25
@@ -22,7 +38,8 @@ class TestEinaBinbuf
22 { 38 {
23 var binbuf = new Eina.Binbuf(); 39 var binbuf = new Eina.Binbuf();
24 Test.Assert(binbuf.Handle != IntPtr.Zero); 40 Test.Assert(binbuf.Handle != IntPtr.Zero);
25 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[0])); 41 Test.Assert(binbuf.GetBytes().SequenceEqual(Array.Empty<byte>()));
42 binbuf.Dispose();
26 } 43 }
27 44
28 public static void eina_binbuf_bytes() 45 public static void eina_binbuf_bytes()
@@ -32,6 +49,7 @@ class TestEinaBinbuf
32 byte[] cmp = binbuf.GetBytes(); 49 byte[] cmp = binbuf.GetBytes();
33 Test.Assert(cmp != test_string); 50 Test.Assert(cmp != test_string);
34 Test.Assert(cmp.SequenceEqual(test_string)); 51 Test.Assert(cmp.SequenceEqual(test_string));
52 binbuf.Dispose();
35 } 53 }
36 54
37 public static void eina_binbuf_bytes_length() 55 public static void eina_binbuf_bytes_length()
@@ -43,6 +61,7 @@ class TestEinaBinbuf
43 Test.Assert(cmp != test_string); 61 Test.Assert(cmp != test_string);
44 Test.Assert(cmp != expected); 62 Test.Assert(cmp != expected);
45 Test.Assert(cmp.SequenceEqual(expected)); 63 Test.Assert(cmp.SequenceEqual(expected));
64 binbuf.Dispose();
46 } 65 }
47 66
48 public static void eina_binbuf_copy_ctor() 67 public static void eina_binbuf_copy_ctor()
@@ -55,6 +74,8 @@ class TestEinaBinbuf
55 byte[] cmp2 = binbuf2.GetBytes(); 74 byte[] cmp2 = binbuf2.GetBytes();
56 Test.Assert(cmp != cmp2); 75 Test.Assert(cmp != cmp2);
57 Test.Assert(cmp.SequenceEqual(cmp2)); 76 Test.Assert(cmp.SequenceEqual(cmp2));
77 binbuf2.Dispose();
78 binbuf.Dispose();
58 } 79 }
59 80
60 public static void free_get_null_handle() 81 public static void free_get_null_handle()
@@ -63,6 +84,7 @@ class TestEinaBinbuf
63 Test.Assert(binbuf.Handle != IntPtr.Zero); 84 Test.Assert(binbuf.Handle != IntPtr.Zero);
64 binbuf.Free(); 85 binbuf.Free();
65 Test.Assert(binbuf.Handle == IntPtr.Zero); 86 Test.Assert(binbuf.Handle == IntPtr.Zero);
87 binbuf.Dispose();
66 } 88 }
67 89
68 public static void reset_get_empty_string() 90 public static void reset_get_empty_string()
@@ -74,7 +96,8 @@ class TestEinaBinbuf
74 Test.Assert(cmp.SequenceEqual(test_string)); 96 Test.Assert(cmp.SequenceEqual(test_string));
75 binbuf.Reset(); 97 binbuf.Reset();
76 Test.Assert(binbuf.Handle != IntPtr.Zero); 98 Test.Assert(binbuf.Handle != IntPtr.Zero);
77 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[0])); 99 Test.Assert(binbuf.GetBytes().SequenceEqual(Array.Empty<byte>()));
100 binbuf.Dispose();
78 } 101 }
79 102
80 public static void append_bytes() 103 public static void append_bytes()
@@ -84,6 +107,7 @@ class TestEinaBinbuf
84 byte[] cmp = binbuf.GetBytes(); 107 byte[] cmp = binbuf.GetBytes();
85 Test.Assert(cmp != test_string); 108 Test.Assert(cmp != test_string);
86 Test.Assert(cmp.SequenceEqual(test_string)); 109 Test.Assert(cmp.SequenceEqual(test_string));
110 binbuf.Dispose();
87 } 111 }
88 112
89 public static void append_bytes_length() 113 public static void append_bytes_length()
@@ -94,12 +118,13 @@ class TestEinaBinbuf
94 byte[] expected = System.Text.Encoding.UTF8.GetBytes("0123456"); 118 byte[] expected = System.Text.Encoding.UTF8.GetBytes("0123456");
95 Test.Assert(cmp != expected); 119 Test.Assert(cmp != expected);
96 Test.Assert(cmp.SequenceEqual(expected)); 120 Test.Assert(cmp.SequenceEqual(expected));
121 binbuf.Dispose();
97 } 122 }
98 123
99 public static void append_binbuf() 124 public static void append_binbuf()
100 { 125 {
101 var binbuf = new Eina.Binbuf(); 126 var binbuf = new Eina.Binbuf();
102 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[0])); 127 Test.Assert(binbuf.GetBytes().SequenceEqual(Array.Empty<byte>()));
103 var binbuf2 = new Eina.Binbuf(test_string); 128 var binbuf2 = new Eina.Binbuf(test_string);
104 binbuf.Append(binbuf2); 129 binbuf.Append(binbuf2);
105 byte[] cmp = binbuf.GetBytes(); 130 byte[] cmp = binbuf.GetBytes();
@@ -107,6 +132,8 @@ class TestEinaBinbuf
107 Test.Assert(cmp != cmp2); 132 Test.Assert(cmp != cmp2);
108 Test.Assert(cmp2.SequenceEqual(cmp)); 133 Test.Assert(cmp2.SequenceEqual(cmp));
109 Test.Assert(cmp2.SequenceEqual(test_string)); 134 Test.Assert(cmp2.SequenceEqual(test_string));
135 binbuf2.Dispose();
136 binbuf.Dispose();
110 } 137 }
111 138
112 public static void append_char() 139 public static void append_char()
@@ -118,6 +145,7 @@ class TestEinaBinbuf
118 byte[] cmp = binbuf.GetBytes(); 145 byte[] cmp = binbuf.GetBytes();
119 Test.Assert(cmp.Length == 3); 146 Test.Assert(cmp.Length == 3);
120 Test.Assert(cmp[0] == 0 && cmp[1] == 12 && cmp[2] == 42); 147 Test.Assert(cmp[0] == 0 && cmp[1] == 12 && cmp[2] == 42);
148 binbuf.Dispose();
121 } 149 }
122 150
123 public static void remove() 151 public static void remove()
@@ -128,6 +156,7 @@ class TestEinaBinbuf
128 Test.Assert(binbuf.Handle != IntPtr.Zero); 156 Test.Assert(binbuf.Handle != IntPtr.Zero);
129 byte[] expected = System.Text.Encoding.UTF8.GetBytes("019ABCDEF"); 157 byte[] expected = System.Text.Encoding.UTF8.GetBytes("019ABCDEF");
130 Test.Assert(binbuf.GetBytes().SequenceEqual(expected)); 158 Test.Assert(binbuf.GetBytes().SequenceEqual(expected));
159 binbuf.Dispose();
131 } 160 }
132 161
133 public static void get_string_native() 162 public static void get_string_native()
@@ -135,6 +164,7 @@ class TestEinaBinbuf
135 var binbuf = new Eina.Binbuf(test_string); 164 var binbuf = new Eina.Binbuf(test_string);
136 Test.Assert(binbuf.GetBytes().SequenceEqual(test_string)); 165 Test.Assert(binbuf.GetBytes().SequenceEqual(test_string));
137 Test.Assert(binbuf.GetStringNative() != IntPtr.Zero); 166 Test.Assert(binbuf.GetStringNative() != IntPtr.Zero);
167 binbuf.Dispose();
138 } 168 }
139 169
140 public static void binbuf_free_string() 170 public static void binbuf_free_string()
@@ -143,7 +173,8 @@ class TestEinaBinbuf
143 Test.Assert(binbuf.GetBytes().SequenceEqual(test_string)); 173 Test.Assert(binbuf.GetBytes().SequenceEqual(test_string));
144 binbuf.FreeString(); 174 binbuf.FreeString();
145 Test.Assert(binbuf.Handle != IntPtr.Zero); 175 Test.Assert(binbuf.Handle != IntPtr.Zero);
146 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[0])); 176 Test.Assert(binbuf.GetBytes().SequenceEqual(Array.Empty<byte>()));
177 binbuf.Dispose();
147 } 178 }
148 179
149 public static void binbuf_length() 180 public static void binbuf_length()
@@ -151,6 +182,7 @@ class TestEinaBinbuf
151 var binbuf = new Eina.Binbuf(test_string, 6); 182 var binbuf = new Eina.Binbuf(test_string, 6);
152 Test.Assert(binbuf.Length == 6); 183 Test.Assert(binbuf.Length == 6);
153 Test.Assert(binbuf.GetBytes().Length == 6); 184 Test.Assert(binbuf.GetBytes().Length == 6);
185 binbuf.Dispose();
154 } 186 }
155 187
156 public static void test_eina_binbuf_in() 188 public static void test_eina_binbuf_in()
@@ -159,9 +191,11 @@ class TestEinaBinbuf
159 var binbuf = new Eina.Binbuf(base_seq, (uint)base_seq.Length); 191 var binbuf = new Eina.Binbuf(base_seq, (uint)base_seq.Length);
160 Test.Assert(t.EinaBinbufIn(binbuf)); 192 Test.Assert(t.EinaBinbufIn(binbuf));
161 Test.Assert(binbuf.Own); 193 Test.Assert(binbuf.Own);
162 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[]{43,42,0x0,0x2A,0x42,33})); 194 Test.Assert(binbuf.GetBytes().SequenceEqual(
195 new byte[]{43, 42, 0x0, 0x2A, 0x42, 33}));
163 binbuf.Dispose(); 196 binbuf.Dispose();
164 Test.Assert(binbuf.Handle == IntPtr.Zero); 197 Test.Assert(binbuf.Handle == IntPtr.Zero);
198 t.Dispose();
165 } 199 }
166 200
167 public static void test_eina_binbuf_in_own() 201 public static void test_eina_binbuf_in_own()
@@ -170,10 +204,12 @@ class TestEinaBinbuf
170 var binbuf = new Eina.Binbuf(base_seq, (uint)base_seq.Length); 204 var binbuf = new Eina.Binbuf(base_seq, (uint)base_seq.Length);
171 Test.Assert(t.EinaBinbufInOwn(binbuf)); 205 Test.Assert(t.EinaBinbufInOwn(binbuf));
172 Test.Assert(!binbuf.Own); 206 Test.Assert(!binbuf.Own);
173 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[]{43,42,0x0,0x2A,0x42,33})); 207 Test.Assert(binbuf.GetBytes().SequenceEqual(
208 new byte[]{43, 42, 0x0, 0x2A, 0x42, 33}));
174 binbuf.Dispose(); 209 binbuf.Dispose();
175 Test.Assert(binbuf.Handle == IntPtr.Zero); 210 Test.Assert(binbuf.Handle == IntPtr.Zero);
176 Test.Assert(t.CheckBinbufInOwn()); 211 Test.Assert(t.CheckBinbufInOwn());
212 t.Dispose();
177 } 213 }
178 214
179 public static void test_eina_binbuf_out() 215 public static void test_eina_binbuf_out()
@@ -188,6 +224,7 @@ class TestEinaBinbuf
188 binbuf.Dispose(); 224 binbuf.Dispose();
189 Test.Assert(binbuf.Handle == IntPtr.Zero); 225 Test.Assert(binbuf.Handle == IntPtr.Zero);
190 Test.Assert(t.CheckBinbufOut()); 226 Test.Assert(t.CheckBinbufOut());
227 t.Dispose();
191 } 228 }
192 229
193 public static void test_eina_binbuf_out_own() 230 public static void test_eina_binbuf_out_own()
@@ -201,6 +238,7 @@ class TestEinaBinbuf
201 Test.Assert(binbuf.Append(base_seq)); 238 Test.Assert(binbuf.Append(base_seq));
202 binbuf.Dispose(); 239 binbuf.Dispose();
203 Test.Assert(binbuf.Handle == IntPtr.Zero); 240 Test.Assert(binbuf.Handle == IntPtr.Zero);
241 t.Dispose();
204 } 242 }
205 243
206 public static void test_eina_binbuf_return() 244 public static void test_eina_binbuf_return()
@@ -214,6 +252,7 @@ class TestEinaBinbuf
214 binbuf.Dispose(); 252 binbuf.Dispose();
215 Test.Assert(binbuf.Handle == IntPtr.Zero); 253 Test.Assert(binbuf.Handle == IntPtr.Zero);
216 Test.Assert(t.CheckBinbufReturn()); 254 Test.Assert(t.CheckBinbufReturn());
255 t.Dispose();
217 } 256 }
218 257
219 public static void test_eina_binbuf_return_own() 258 public static void test_eina_binbuf_return_own()
@@ -226,6 +265,7 @@ class TestEinaBinbuf
226 Test.Assert(binbuf.Append(base_seq)); 265 Test.Assert(binbuf.Append(base_seq));
227 binbuf.Dispose(); 266 binbuf.Dispose();
228 Test.Assert(binbuf.Handle == IntPtr.Zero); 267 Test.Assert(binbuf.Handle == IntPtr.Zero);
268 t.Dispose();
229 } 269 }
230 270
231 // // 271 // //
@@ -238,9 +278,11 @@ class TestEinaBinbuf
238 Test.Assert(t.CallEinaBinbufIn(binbuf)); 278 Test.Assert(t.CallEinaBinbufIn(binbuf));
239 Test.Assert(t.binbuf_in_flag); 279 Test.Assert(t.binbuf_in_flag);
240 Test.Assert(binbuf.Own); 280 Test.Assert(binbuf.Own);
241 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[]{43,42,0x0,0x2A,0x42,33})); 281 Test.Assert(binbuf.GetBytes().SequenceEqual(
282 new byte[]{43, 42, 0x0, 0x2A, 0x42, 33}));
242 binbuf.Dispose(); 283 binbuf.Dispose();
243 Test.Assert(binbuf.Handle == IntPtr.Zero); 284 Test.Assert(binbuf.Handle == IntPtr.Zero);
285 t.Dispose();
244 } 286 }
245 287
246 public static void test_inherit_eina_binbuf_in_own() 288 public static void test_inherit_eina_binbuf_in_own()
@@ -250,10 +292,12 @@ class TestEinaBinbuf
250 binbuf.Own = false; 292 binbuf.Own = false;
251 Test.Assert(t.CallEinaBinbufInOwn(binbuf)); 293 Test.Assert(t.CallEinaBinbufInOwn(binbuf));
252 Test.Assert(t.binbuf_in_own_flag); 294 Test.Assert(t.binbuf_in_own_flag);
253 Test.Assert(binbuf.GetBytes().SequenceEqual(new byte[]{43,42,0x0,0x2A,0x42,33})); 295 Test.Assert(binbuf.GetBytes().SequenceEqual(
296 new byte[]{43, 42, 0x0, 0x2A, 0x42, 33}));
254 binbuf.Dispose(); 297 binbuf.Dispose();
255 Test.Assert(binbuf.Handle == IntPtr.Zero); 298 Test.Assert(binbuf.Handle == IntPtr.Zero);
256 Test.Assert(t.binbuf_in_own_still_usable()); 299 Test.Assert(t.binbuf_in_own_still_usable());
300 t.Dispose();
257 } 301 }
258 302
259 public static void test_inherit_eina_binbuf_out() 303 public static void test_inherit_eina_binbuf_out()
@@ -267,6 +311,7 @@ class TestEinaBinbuf
267 binbuf.Dispose(); 311 binbuf.Dispose();
268 Test.Assert(binbuf.Handle == IntPtr.Zero); 312 Test.Assert(binbuf.Handle == IntPtr.Zero);
269 Test.Assert(t.binbuf_out_still_usable()); 313 Test.Assert(t.binbuf_out_still_usable());
314 t.Dispose();
270 } 315 }
271 316
272 public static void test_inherit_eina_binbuf_out_own() 317 public static void test_inherit_eina_binbuf_out_own()
@@ -280,6 +325,7 @@ class TestEinaBinbuf
280 binbuf.Dispose(); 325 binbuf.Dispose();
281 Test.Assert(binbuf.Handle == IntPtr.Zero); 326 Test.Assert(binbuf.Handle == IntPtr.Zero);
282 Test.Assert(t.binbuf_out_own_no_longer_own()); 327 Test.Assert(t.binbuf_out_own_no_longer_own());
328 t.Dispose();
283 } 329 }
284 330
285 public static void test_inherit_eina_binbuf_return() 331 public static void test_inherit_eina_binbuf_return()
@@ -293,6 +339,7 @@ class TestEinaBinbuf
293 binbuf.Dispose(); 339 binbuf.Dispose();
294 Test.Assert(binbuf.Handle == IntPtr.Zero); 340 Test.Assert(binbuf.Handle == IntPtr.Zero);
295 Test.Assert(t.binbuf_return_still_usable()); 341 Test.Assert(t.binbuf_return_still_usable());
342 t.Dispose();
296 } 343 }
297 344
298 public static void test_inherit_eina_binbuf_return_own() 345 public static void test_inherit_eina_binbuf_return_own()
@@ -306,6 +353,7 @@ class TestEinaBinbuf
306 binbuf.Dispose(); 353 binbuf.Dispose();
307 Test.Assert(binbuf.Handle == IntPtr.Zero); 354 Test.Assert(binbuf.Handle == IntPtr.Zero);
308 Test.Assert(t.binbuf_return_own_no_longer_own()); 355 Test.Assert(t.binbuf_return_own_no_longer_own());
356 t.Dispose();
309 } 357 }
310} 358}
311 359
@@ -327,6 +375,7 @@ class TestEinaSlice
327 375
328 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 376 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
329 Test.Assert(base_seq.Length == (int)(slc.Len)); 377 Test.Assert(base_seq.Length == (int)(slc.Len));
378 binbuf.Dispose();
330 } 379 }
331#endif 380#endif
332 381
@@ -342,6 +391,7 @@ class TestEinaSlice
342 var binbuf = new Eina.Binbuf(); 391 var binbuf = new Eina.Binbuf();
343 binbuf.Append(new Eina.Slice(pinnedPtr, (UIntPtr)3)); 392 binbuf.Append(new Eina.Slice(pinnedPtr, (UIntPtr)3));
344 Test.Assert(binbuf.GetBytes().SequenceEqual(base_seq)); 393 Test.Assert(binbuf.GetBytes().SequenceEqual(base_seq));
394 binbuf.Dispose();
345 } 395 }
346#endif 396#endif
347 397
@@ -350,6 +400,7 @@ class TestEinaSlice
350 var t = new Dummy.TestObject(); 400 var t = new Dummy.TestObject();
351 var slc = new Eina.Slice(pinnedPtr, (UIntPtr)3); 401 var slc = new Eina.Slice(pinnedPtr, (UIntPtr)3);
352 Test.Assert(t.EinaSliceIn(slc)); 402 Test.Assert(t.EinaSliceIn(slc));
403 t.Dispose();
353 } 404 }
354 405
355 public static void test_eina_rw_slice_in() 406 public static void test_eina_rw_slice_in()
@@ -363,9 +414,10 @@ class TestEinaSlice
363 var t = new Dummy.TestObject(); 414 var t = new Dummy.TestObject();
364 Test.Assert(t.EinaRwSliceIn(slc)); 415 Test.Assert(t.EinaRwSliceIn(slc));
365 416
366 Test.Assert(slc.GetBytes().SequenceEqual(new byte[3]{0x1,0x2B,0x43})); 417 Test.Assert(slc.GetBytes().SequenceEqual(new byte[3]{0x1, 0x2B, 0x43}));
367 418
368 pinnedRWData.Free(); 419 pinnedRWData.Free();
420 t.Dispose();
369 } 421 }
370 422
371 public static void test_eina_slice_out() 423 public static void test_eina_slice_out()
@@ -376,6 +428,7 @@ class TestEinaSlice
376 Test.Assert(slc.Mem != IntPtr.Zero); 428 Test.Assert(slc.Mem != IntPtr.Zero);
377 Test.Assert(slc.Length == base_seq.Length); 429 Test.Assert(slc.Length == base_seq.Length);
378 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 430 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
431 t.Dispose();
379 } 432 }
380 433
381 public static void test_eina_rw_slice_out() 434 public static void test_eina_rw_slice_out()
@@ -386,6 +439,7 @@ class TestEinaSlice
386 Test.Assert(slc.Mem != IntPtr.Zero); 439 Test.Assert(slc.Mem != IntPtr.Zero);
387 Test.Assert(slc.Length == base_seq.Length); 440 Test.Assert(slc.Length == base_seq.Length);
388 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 441 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
442 t.Dispose();
389 } 443 }
390 444
391 public static void test_eina_rw_slice_inout() 445 public static void test_eina_rw_slice_inout()
@@ -400,6 +454,7 @@ class TestEinaSlice
400 Test.Assert(slc.Mem != IntPtr.Zero); 454 Test.Assert(slc.Mem != IntPtr.Zero);
401 Test.Assert(slc.Length == rw_seq.Length); 455 Test.Assert(slc.Length == rw_seq.Length);
402 Test.Assert(slc.GetBytes().SequenceEqual(expected_seq)); 456 Test.Assert(slc.GetBytes().SequenceEqual(expected_seq));
457 t.Dispose();
403 } 458 }
404 459
405 /* 460 /*
@@ -418,6 +473,7 @@ class TestEinaSlice
418 var slc = new Eina.Slice(pinnedPtr, (UIntPtr)3); 473 var slc = new Eina.Slice(pinnedPtr, (UIntPtr)3);
419 Test.Assert(t.EinaSliceIn(slc)); 474 Test.Assert(t.EinaSliceIn(slc));
420 Test.Assert(t.slice_in_flag); 475 Test.Assert(t.slice_in_flag);
476 t.Dispose();
421 } 477 }
422 478
423 public static void test_inherit_eina_rw_slice_in() 479 public static void test_inherit_eina_rw_slice_in()
@@ -435,6 +491,7 @@ class TestEinaSlice
435 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 491 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
436 492
437 pinnedRWData.Free(); 493 pinnedRWData.Free();
494 t.Dispose();
438 } 495 }
439 496
440 public static void test_inherit_eina_slice_out() 497 public static void test_inherit_eina_slice_out()
@@ -446,6 +503,7 @@ class TestEinaSlice
446 Test.Assert(slc.Mem != IntPtr.Zero); 503 Test.Assert(slc.Mem != IntPtr.Zero);
447 Test.Assert(slc.Length == base_seq.Length); 504 Test.Assert(slc.Length == base_seq.Length);
448 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 505 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
506 t.Dispose();
449 } 507 }
450 508
451 public static void test_inherit_eina_rw_slice_out() 509 public static void test_inherit_eina_rw_slice_out()
@@ -457,6 +515,7 @@ class TestEinaSlice
457 Test.Assert(slc.Mem != IntPtr.Zero); 515 Test.Assert(slc.Mem != IntPtr.Zero);
458 Test.Assert(slc.Length == base_seq.Length); 516 Test.Assert(slc.Length == base_seq.Length);
459 Test.Assert(slc.GetBytes().SequenceEqual(base_seq)); 517 Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
518 t.Dispose();
460 } 519 }
461} 520}
462 521
@@ -476,6 +535,7 @@ class TestEinaArray
476 { 535 {
477 var a = new Eina.Array<int>(); 536 var a = new Eina.Array<int>();
478 Test.Assert(a.Handle != IntPtr.Zero); 537 Test.Assert(a.Handle != IntPtr.Zero);
538 a.Dispose();
479 } 539 }
480 540
481 public static void create_array_from_null() 541 public static void create_array_from_null()
@@ -490,6 +550,7 @@ class TestEinaArray
490 Test.Assert(a.Handle != IntPtr.Zero); 550 Test.Assert(a.Handle != IntPtr.Zero);
491 Test.Assert(a.Push(88)); 551 Test.Assert(a.Push(88));
492 Test.Assert(a[0] == 88); 552 Test.Assert(a[0] == 88);
553 a.Dispose();
493 } 554 }
494 555
495 public static void push_string() 556 public static void push_string()
@@ -498,6 +559,7 @@ class TestEinaArray
498 Test.Assert(a.Handle != IntPtr.Zero); 559 Test.Assert(a.Handle != IntPtr.Zero);
499 Test.Assert(a.Push("test string §éΨبÿツ")); 560 Test.Assert(a.Push("test string §éΨبÿツ"));
500 Test.AssertEquals("test string §éΨبÿツ", a[0]); 561 Test.AssertEquals("test string §éΨبÿツ", a[0]);
562 a.Dispose();
501 } 563 }
502 564
503 public static void push_stringshare() 565 public static void push_stringshare()
@@ -506,6 +568,7 @@ class TestEinaArray
506 Test.Assert(a.Handle != IntPtr.Zero); 568 Test.Assert(a.Handle != IntPtr.Zero);
507 Test.Assert(a.Push("test string §éΨبÿツ")); 569 Test.Assert(a.Push("test string §éΨبÿツ"));
508 Test.AssertEquals("test string §éΨبÿツ", a[0].Str); 570 Test.AssertEquals("test string §éΨبÿツ", a[0].Str);
571 a.Dispose();
509 } 572 }
510 573
511 public static void push_obj() 574 public static void push_obj()
@@ -517,6 +580,8 @@ class TestEinaArray
517 Test.Assert(a.Push(o)); 580 Test.Assert(a.Push(o));
518 Test.Assert(a[0].NativeHandle == o.NativeHandle); 581 Test.Assert(a[0].NativeHandle == o.NativeHandle);
519 Test.Assert(a[0].GetNumber() == 88); 582 Test.Assert(a[0].GetNumber() == 88);
583 o.Dispose();
584 a.Dispose();
520 } 585 }
521 586
522 public static void pop_int() 587 public static void pop_int()
@@ -526,6 +591,7 @@ class TestEinaArray
526 Test.Assert(a.Push(88)); 591 Test.Assert(a.Push(88));
527 Test.Assert(a.Pop() == 88); 592 Test.Assert(a.Pop() == 88);
528 Test.Assert(a.Count() == 0); 593 Test.Assert(a.Count() == 0);
594 a.Dispose();
529 } 595 }
530 596
531 public static void pop_string() 597 public static void pop_string()
@@ -535,6 +601,7 @@ class TestEinaArray
535 Test.Assert(a.Push("test string")); 601 Test.Assert(a.Push("test string"));
536 Test.Assert(a.Pop() == "test string"); 602 Test.Assert(a.Pop() == "test string");
537 Test.Assert(a.Count() == 0); 603 Test.Assert(a.Count() == 0);
604 a.Dispose();
538 } 605 }
539 606
540 public static void pop_stringshare() 607 public static void pop_stringshare()
@@ -544,6 +611,7 @@ class TestEinaArray
544 Test.Assert(a.Push("test string")); 611 Test.Assert(a.Push("test string"));
545 Test.Assert(a.Pop() == "test string"); 612 Test.Assert(a.Pop() == "test string");
546 Test.Assert(a.Count() == 0); 613 Test.Assert(a.Count() == 0);
614 a.Dispose();
547 } 615 }
548 616
549 public static void pop_obj() 617 public static void pop_obj()
@@ -557,6 +625,8 @@ class TestEinaArray
557 Test.Assert(p.NativeHandle == o.NativeHandle); 625 Test.Assert(p.NativeHandle == o.NativeHandle);
558 Test.Assert(p.GetNumber() == 88); 626 Test.Assert(p.GetNumber() == 88);
559 Test.Assert(a.Count() == 0); 627 Test.Assert(a.Count() == 0);
628 o.Dispose();
629 a.Dispose();
560 } 630 }
561 631
562 public static void data_set_int() 632 public static void data_set_int()
@@ -569,6 +639,7 @@ class TestEinaArray
569 Test.Assert(a[0] == 44); 639 Test.Assert(a[0] == 44);
570 a[0] = 22; 640 a[0] = 22;
571 Test.Assert(a[0] == 22); 641 Test.Assert(a[0] == 22);
642 a.Dispose();