END_TEST START_TEST(eo_api_not_implemented_call) { eo_init(); eina_log_print_cb_set(eo_test_print_cb, &ctx); Eo *obj = eo_add(SIMPLE_CLASS, NULL); fail_if(!obj); TEST_EO_ERROR("_eo_api_op_id_get", "in %s:%d: unable to resolve %s api func '%s' %p in class '%s'."); eo_do(obj, simple_no_implementation()); fail_unless(ctx.did); eo_unref(obj); eina_log_print_cb_set(eina_log_print_cb_stderr, NULL); eo_shutdown(); }
int main(int argc, char *argv[]) { Evas_Coord winw, winh; { winw = 400; winh = 400; } elm_init(argc, argv); eo_init(); Eo *win = eo_add(ELW_WIN_CLASS, NULL); eo_do(win, evas_obj_size_set(winw, winh), evas_obj_visibility_set(EINA_TRUE)); Eo *bt = eo_add(ELW_BUTTON_CLASS, win); eo_do(bt, evas_obj_position_set(25, 25), evas_obj_size_set(50, 50), evas_obj_color_set(255, 0, 0, 255), elw_button_text_set("Click"), evas_obj_visibility_set(EINA_TRUE)); eo_do(bt, eo_event_callback_add(EV_CLICKED, _btn_clicked_cb, "btn")); int r, g, b, a; eo_do(bt, evas_obj_color_get(&r, &g, &b, &a)); printf("RGBa(%d, %d, %d, %d)\n", r, g, b, a); Eo *bx = eo_add(ELW_BOXEDBUTTON_CLASS, win); eo_do(bx, evas_obj_position_set(100, 100), evas_obj_size_set(70, 70), evas_obj_color_set(0, 0, 255, 255), elw_button_text_set("Click2"), evas_obj_visibility_set(EINA_TRUE)); eo_do(bx, eo_event_callback_add(EV_CLICKED, _btn_clicked_cb, "bxedbtn")); elm_run(); eo_unref(bx); eo_unref(bt); eo_unref(win); eo_shutdown(); elm_shutdown(); return 0; }
int main(int argc, char **argv) { Suite *s; SRunner *sr; int i, failed_count; eo_init(); setenv("CK_FORK", "no", 0); for (i = 1; i < argc; i++) if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) { fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n", argv[0]); _list_tests(); return 0; } else if ((strcmp(argv[i], "-l") == 0) || (strcmp(argv[i], "--list") == 0)) { _list_tests(); return 0; } putenv("EFL_RUN_IN_TREE=1"); s = eo_suite_build(argc - 1, (const char **)argv + 1); sr = srunner_create(s); srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml"); srunner_run_all(sr, CK_ENV); failed_count = srunner_ntests_failed(sr); srunner_free(sr); eo_shutdown(); return (failed_count == 0) ? 0 : 255; }
int main(int argc, char *argv[]) { (void) argc; (void) argv; eo_init(); Eo *obj = eo_add(SIMPLE_CLASS, NULL); eo_do(obj, simple_a_set(4)); int a = 0, a2 = 0, a3 = 0; eo_do(obj, a = simple_a_get(), a3 = interface_a_power_3_get(), a2 = mixin_a_square_get()); printf("Got %d %d %d\n", a, a2, a3); eo_unref(obj); eo_shutdown(); return 0; }
int main(int argc, char *argv[]) { (void) argc; (void) argv; eo_init(); Eo *obj = eo_add(SIMPLE_CLASS, NULL); Simple_Public_Data *pd = eo_data_get(obj, SIMPLE_CLASS); /* The order of these two is undetermined. */ eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2)); eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1)); /* This will be called afterwards. */ eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_DEFAULT, _a_changed_cb, (void *) 3)); /* This will never be called because the previous callback returns NULL. */ eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_AFTER, _a_changed_cb, (void *) 4)); eo_do(obj, simple_a_set(1)); fail_if(cb_count != 3); eo_do(obj, eo_event_callback_del(EV_A_CHANGED, _a_changed_cb, (void *) 3)); fail_if(pd->cb_count != 3); eo_do(obj, eo_event_callback_del(EV_A_CHANGED, _a_changed_cb, (void *) 12)); fail_if(pd->cb_count != 3); eo_do(obj, eo_event_callback_del(EV_A_CHANGED, _a_changed_cb, (void *) 4)); fail_if(pd->cb_count != 2); void *ret; eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, _a_changed_cb, &ret)); fail_if(pd->cb_count != 1); eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, NULL, &ret)); fail_if(ret); fail_if(pd->cb_count != 1); eo_do(obj, eo_event_callback_del(EV_A_CHANGED, NULL, 0)); fail_if(pd->cb_count != 1); eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, _a_changed_cb, &ret)); fail_if(pd->cb_count != 0); eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, _a_changed_cb, &ret)); fail_if(ret); fail_if(pd->cb_count != 0); /* Freeze/thaw. */ int fcount = 0; cb_count = 0; eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1)); fail_if(pd->cb_count != 1); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 0); eo_do(obj, eo_event_freeze()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 1); eo_do(obj, eo_event_freeze()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 2); eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2)); fail_if(pd->cb_count != 1); eo_do(obj, simple_a_set(2)); fail_if(cb_count != 0); eo_do(obj, eo_event_thaw()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 1); eo_do(obj, eo_event_thaw()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 0); eo_do(obj, simple_a_set(3)); fail_if(cb_count != 2); cb_count = 0; eo_do(obj, eo_event_thaw()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 0); eo_do(obj, eo_event_freeze()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 1); eo_do(obj, simple_a_set(2)); fail_if(cb_count != 0); eo_do(obj, eo_event_thaw()); eo_do(obj, eo_event_freeze_get(&fcount)); fail_if(fcount != 0); eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, _a_changed_cb, &ret)); fail_if(!ret); eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, _a_changed_cb, &ret)); fail_if(!ret); eo_do(obj, eo_event_callback_del_lazy(EV_A_CHANGED, _a_changed_cb, &ret)); fail_if(ret); /* Global Freeze/thaw. */ fcount = 0; cb_count = 0; pd->cb_count = 0; eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 1)); fail_if(pd->cb_count != 1); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 0); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 1); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 2); eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _a_changed_cb, (void *) 2)); fail_if(pd->cb_count != 1); eo_do(obj, simple_a_set(2)); fail_if(cb_count != 0); eo_class_do(EO_BASE_CLASS, eo_event_global_thaw()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 1); eo_class_do(EO_BASE_CLASS, eo_event_global_thaw()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 0); eo_do(obj, simple_a_set(3)); fail_if(cb_count != 2); cb_count = 0; eo_class_do(EO_BASE_CLASS, eo_event_global_thaw()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 0); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 1); eo_do(obj, simple_a_set(2)); fail_if(cb_count != 0); eo_class_do(EO_BASE_CLASS, eo_event_global_thaw()); eo_class_do(EO_BASE_CLASS, eo_event_global_freeze_get(&fcount)); fail_if(fcount != 0); eo_unref(obj); eo_shutdown(); return 0; }
END_TEST START_TEST(eo_inherit_errors) { eo_init(); const Eo_Class *klass; const Eo_Class *klass_mixin; const Eo_Class *klass_simple; static const Eo_Class_Description class_desc_simple = { "Simple", EO_CLASS_TYPE_REGULAR, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; static const Eo_Class_Description class_desc_mixin = { "Mixin", EO_CLASS_TYPE_MIXIN, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; static Eo_Class_Description class_desc = { "General", EO_CLASS_TYPE_MIXIN, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; klass_mixin = eo_class_new(&class_desc_mixin, NULL, NULL); fail_if(!klass_mixin); klass_simple = eo_class_new(&class_desc_simple, NULL, NULL); fail_if(!klass_simple); klass = eo_class_new(&class_desc, klass_simple, NULL); fail_if(klass); class_desc.type = EO_CLASS_TYPE_REGULAR; klass = eo_class_new(&class_desc, klass_mixin, NULL); fail_if(klass); (void) klass; eo_shutdown(); }
END_TEST START_TEST(eo_inconsistent_mro) { eo_init(); const Eo_Class *klass; const Eo_Class *klass_mixin; const Eo_Class *klass_mixin2; const Eo_Class *klass_mixin3; static const Eo_Class_Description class_desc_simple = { "Simple", EO_CLASS_TYPE_REGULAR, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; static const Eo_Class_Description class_desc_mixin = { "Mixin", EO_CLASS_TYPE_MIXIN, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; static const Eo_Class_Description class_desc_mixin2 = { "Mixin2", EO_CLASS_TYPE_MIXIN, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; static const Eo_Class_Description class_desc_mixin3 = { "Mixin3", EO_CLASS_TYPE_MIXIN, EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), NULL, 0, NULL, NULL, NULL, NULL }; klass_mixin = eo_class_new(&class_desc_mixin, NULL, NULL); fail_if(!klass_mixin); klass_mixin2 = eo_class_new(&class_desc_mixin2, klass_mixin, NULL); fail_if(!klass_mixin2); klass_mixin3 = eo_class_new(&class_desc_mixin3, klass_mixin, NULL); fail_if(!klass_mixin3); klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin, klass_mixin2, NULL); fail_if(klass); klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin2, klass_mixin, NULL); fail_if(!klass); klass = eo_class_new(&class_desc_simple, EO_BASE_CLASS, klass_mixin2, klass_mixin3, NULL); fail_if(!klass); eo_shutdown(); }