mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
:Merge branch '1.2'
This commit is contained in:
commit
9be7454064
@ -258,8 +258,28 @@ ret_t widget_animator_set_destroy_when_done(widget_animator_t* animator, bool_t
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t widget_animator_do_destroy(widget_animator_t* animator) {
|
||||
TKMEM_FREE(animator->name);
|
||||
emitter_deinit(&(animator->emitter));
|
||||
|
||||
if (animator->destroy != NULL) {
|
||||
return animator->destroy(animator);
|
||||
} else {
|
||||
memset(animator, 0x00, sizeof(widget_animator_t));
|
||||
TKMEM_FREE(animator);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t widget_animator_do_destroy_async(const idle_info_t* info) {
|
||||
widget_animator_do_destroy((widget_animator_t*)(info->ctx));
|
||||
|
||||
return RET_REMOVE;
|
||||
}
|
||||
|
||||
ret_t widget_animator_destroy(widget_animator_t* animator) {
|
||||
return_value_if_fail(animator != NULL, RET_BAD_PARAMS);
|
||||
return_value_if_fail(animator != NULL && animator->update != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (animator->widget_destroy_id != TK_INVALID_ID) {
|
||||
widget_off(animator->widget, animator->widget_destroy_id);
|
||||
@ -270,14 +290,8 @@ ret_t widget_animator_destroy(widget_animator_t* animator) {
|
||||
widget_animator_manager_remove(animator->widget_animator_manager, animator);
|
||||
}
|
||||
|
||||
TKMEM_FREE(animator->name);
|
||||
emitter_deinit(&(animator->emitter));
|
||||
if (animator->destroy != NULL) {
|
||||
return animator->destroy(animator);
|
||||
} else {
|
||||
memset(animator, 0x00, sizeof(widget_animator_t));
|
||||
TKMEM_FREE(animator);
|
||||
}
|
||||
animator->update = NULL;
|
||||
idle_add(widget_animator_do_destroy_async, animator);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ TEST(WidgetAnimatorFactory, opacity) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, opacity_default) {
|
||||
@ -49,6 +50,7 @@ TEST(WidgetAnimatorFactory, opacity_default) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, rotation) {
|
||||
@ -67,6 +69,7 @@ TEST(WidgetAnimatorFactory, rotation) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, rotation_default) {
|
||||
@ -89,6 +92,7 @@ TEST(WidgetAnimatorFactory, rotation_default) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, value) {
|
||||
@ -107,6 +111,7 @@ TEST(WidgetAnimatorFactory, value) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, value_default) {
|
||||
@ -126,6 +131,7 @@ TEST(WidgetAnimatorFactory, value_default) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, move) {
|
||||
@ -146,6 +152,7 @@ TEST(WidgetAnimatorFactory, move) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, move_default) {
|
||||
@ -168,6 +175,7 @@ TEST(WidgetAnimatorFactory, move_default) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, scale) {
|
||||
@ -189,6 +197,7 @@ TEST(WidgetAnimatorFactory, scale) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, scale_default) {
|
||||
@ -212,6 +221,7 @@ TEST(WidgetAnimatorFactory, scale_default) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, yoyo_forever) {
|
||||
@ -226,6 +236,7 @@ TEST(WidgetAnimatorFactory, yoyo_forever) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, repeat_forever) {
|
||||
@ -240,6 +251,7 @@ TEST(WidgetAnimatorFactory, repeat_forever) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, auto_start) {
|
||||
@ -261,6 +273,7 @@ TEST(WidgetAnimatorFactory, auto_start) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, auto_destroy) {
|
||||
@ -282,6 +295,7 @@ TEST(WidgetAnimatorFactory, auto_destroy) {
|
||||
widget_animator_destroy(wa);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, name) {
|
||||
@ -297,6 +311,7 @@ TEST(WidgetAnimatorFactory, name) {
|
||||
ASSERT_EQ(string(wa->name), string("scale_1_200"));
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, time_scale) {
|
||||
@ -312,6 +327,7 @@ TEST(WidgetAnimatorFactory, time_scale) {
|
||||
ASSERT_EQ(wa->time_scale, 1.5);
|
||||
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
TEST(WidgetAnimatorFactory, any_prop) {
|
||||
@ -331,4 +347,5 @@ TEST(WidgetAnimatorFactory, any_prop) {
|
||||
|
||||
widget_animator_destroy(wa);
|
||||
widget_destroy(b);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ TEST(AnimatorManager, basic) {
|
||||
ASSERT_EQ(widget_animator_manager_count(am), 1);
|
||||
widget_destroy(WIDGET(image));
|
||||
ASSERT_EQ(widget_animator_manager_count(am), 0);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
||||
static ret_t on_anim_done(void* ctx, event_t* e) {
|
||||
@ -64,4 +65,5 @@ TEST(AnimatorManager, elapse) {
|
||||
widget_animator_manager_time_elapse(am, 1000);
|
||||
|
||||
ASSERT_EQ(widget_animator_manager_count(am), 0);
|
||||
idle_dispatch();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user