2018-06-27 13:46:42 +08:00
|
|
|
|
#include <string>
|
2018-05-31 11:01:46 +08:00
|
|
|
|
#include "base/timer.h"
|
|
|
|
|
#include "gtest/gtest.h"
|
2018-12-15 17:22:05 +08:00
|
|
|
|
#include "widgets/progress_bar.h"
|
2018-05-31 11:01:46 +08:00
|
|
|
|
#include "widget_animators/widget_animator_value.h"
|
|
|
|
|
|
|
|
|
|
TEST(AnimatorValue, once) {
|
|
|
|
|
widget_t* progress_bar = progress_bar_create(NULL, 0, 0, 100, 30);
|
2018-05-31 15:47:42 +08:00
|
|
|
|
widget_animator_t* wa = widget_animator_value_create(progress_bar, 1000, 0, EASING_LINEAR);
|
2018-05-31 11:01:46 +08:00
|
|
|
|
widget_animator_value_set_params(wa, 0, 100);
|
|
|
|
|
|
|
|
|
|
widget_animator_start(wa);
|
2018-11-05 17:32:23 +08:00
|
|
|
|
widget_animator_time_elapse(wa, 0);
|
2018-05-31 11:01:46 +08:00
|
|
|
|
|
|
|
|
|
ASSERT_EQ(widget_get_value(progress_bar), 0);
|
|
|
|
|
|
2018-11-05 17:32:23 +08:00
|
|
|
|
widget_animator_time_elapse(wa, 500);
|
2018-05-31 11:01:46 +08:00
|
|
|
|
ASSERT_EQ(widget_get_value(progress_bar), 50);
|
|
|
|
|
|
2018-11-05 17:32:23 +08:00
|
|
|
|
widget_animator_time_elapse(wa, 500);
|
2018-05-31 11:01:46 +08:00
|
|
|
|
ASSERT_EQ(widget_get_value(progress_bar), 100);
|
|
|
|
|
|
2018-05-31 15:47:42 +08:00
|
|
|
|
widget_destroy(progress_bar);
|
2018-05-31 11:01:46 +08:00
|
|
|
|
}
|