2023-03-07 18:36:05 +08:00
|
|
|
#include "tkc/easing.h"
|
|
|
|
#include "gtest/gtest.h"
|
2023-03-14 18:01:45 +08:00
|
|
|
#include "widgets/button.h"
|
|
|
|
#include "widget_animators/widget_animator_prop.h"
|
2023-03-07 18:36:05 +08:00
|
|
|
|
|
|
|
static float_t easing_linear(float_t k) {
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
2023-03-14 18:01:45 +08:00
|
|
|
TEST(easing, basic) {
|
2023-03-07 18:36:05 +08:00
|
|
|
ASSERT_EQ(easing_register("test1", easing_linear), EASING_FUNC_NR + 1);
|
|
|
|
ASSERT_EQ(easing_register("test2", easing_linear), EASING_FUNC_NR + 2);
|
2023-03-14 18:01:45 +08:00
|
|
|
|
|
|
|
uint32_t easing_type = easing_register("test3", easing_linear);
|
|
|
|
widget_t* button = button_create(NULL, 0, 0, 100, 30);
|
2023-04-14 18:10:22 +08:00
|
|
|
widget_animator_t* wa =
|
|
|
|
widget_animator_prop_create(button, 1000, 0, (easing_type_t)easing_type, "x");
|
2023-03-14 18:01:45 +08:00
|
|
|
|
|
|
|
ASSERT_EQ(widget_animator_prop_set_params(wa, 0, 300), RET_OK);
|
|
|
|
|
|
|
|
widget_animator_destroy(wa);
|
|
|
|
widget_destroy(button);
|
2023-03-07 18:36:05 +08:00
|
|
|
}
|