2018-08-24 11:20:34 +08:00
|
|
|
|
#include "keyboard/keyboard.h"
|
2018-06-20 16:04:13 +08:00
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
|
|
TEST(KeyBoard, basic) {
|
|
|
|
|
value_t v1;
|
|
|
|
|
value_t v2;
|
|
|
|
|
widget_t* b = keyboard_create(NULL, 10, 20, 30, 40);
|
|
|
|
|
|
|
|
|
|
value_set_str(&v1, "bottom_to_top");
|
|
|
|
|
ASSERT_EQ(widget_set_prop(b, WIDGET_PROP_OPEN_ANIM_HINT, &v1), RET_OK);
|
|
|
|
|
ASSERT_EQ(widget_get_prop(b, WIDGET_PROP_OPEN_ANIM_HINT, &v2), RET_OK);
|
|
|
|
|
ASSERT_EQ(strcmp(v1.value.str, v2.value.str), 0);
|
|
|
|
|
|
|
|
|
|
value_set_str(&v1, "fade");
|
|
|
|
|
ASSERT_EQ(widget_set_prop(b, WIDGET_PROP_CLOSE_ANIM_HINT, &v1), RET_OK);
|
|
|
|
|
ASSERT_EQ(widget_get_prop(b, WIDGET_PROP_CLOSE_ANIM_HINT, &v2), RET_OK);
|
|
|
|
|
ASSERT_EQ(strcmp(v1.value.str, v2.value.str), 0);
|
|
|
|
|
|
|
|
|
|
widget_destroy(b);
|
|
|
|
|
}
|
2019-02-26 14:07:59 +08:00
|
|
|
|
|
|
|
|
|
TEST(KeyBoard, cast) {
|
|
|
|
|
widget_t* b = keyboard_create(NULL, 10, 20, 30, 40);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(b, keyboard_cast(b));
|
|
|
|
|
ASSERT_EQ(b, window_base_cast(b));
|
|
|
|
|
|
|
|
|
|
widget_destroy(b);
|
|
|
|
|
}
|
2019-03-14 10:49:15 +08:00
|
|
|
|
|
|
|
|
|
TEST(KeyBoard, is_keyboard) {
|
|
|
|
|
widget_t* b = keyboard_create(NULL, 10, 20, 30, 40);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(widget_is_keyboard(b), TRUE);
|
|
|
|
|
|
|
|
|
|
widget_destroy(b);
|
|
|
|
|
}
|