2019-08-19 18:43:23 +08:00
|
|
|
|
#include "base/window.h"
|
2019-02-26 11:36:12 +08:00
|
|
|
|
#include "widgets/system_bar.h"
|
2019-02-26 11:26:15 +08:00
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
|
|
TEST(SystemBar, cast) {
|
|
|
|
|
widget_t* w = system_bar_create(NULL, 10, 20, 30, 40);
|
|
|
|
|
|
2021-09-17 16:25:52 +08:00
|
|
|
|
ASSERT_EQ(widget_is_system_bar(w), TRUE);
|
|
|
|
|
|
2019-02-26 11:26:15 +08:00
|
|
|
|
ASSERT_EQ(w, system_bar_cast(w));
|
|
|
|
|
ASSERT_EQ(w, window_base_cast(w));
|
|
|
|
|
|
2019-03-19 09:37:17 +08:00
|
|
|
|
window_close_force(w);
|
2019-02-26 11:26:15 +08:00
|
|
|
|
}
|
2022-04-28 18:17:38 +08:00
|
|
|
|
|
|
|
|
|
TEST(SystemBar, copy) {
|
|
|
|
|
widget_t* w = system_bar_create(NULL, 10, 20, 30, 40);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(widget_set_prop_bool(w, WIDGET_PROP_STRONGLY_FOCUS, TRUE), RET_OK);
|
|
|
|
|
ASSERT_EQ(widget_set_prop_int(w, WIDGET_PROP_DESIGN_W, 400), RET_OK);
|
|
|
|
|
ASSERT_EQ(widget_set_prop_int(w, WIDGET_PROP_DESIGN_H, 300), RET_OK);
|
|
|
|
|
ASSERT_EQ(widget_set_prop_str(w, WIDGET_PROP_THEME, "hello"), RET_OK);
|
|
|
|
|
ASSERT_EQ(widget_set_prop_str(w, WIDGET_PROP_ANIM_HINT, "popup"), RET_OK);
|
|
|
|
|
widget_t* w1 = widget_clone(w, NULL);
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(widget_get_prop_bool(w1, WIDGET_PROP_STRONGLY_FOCUS, FALSE), TRUE);
|
|
|
|
|
ASSERT_EQ(widget_get_prop_int(w1, WIDGET_PROP_DESIGN_W, 0), 400);
|
|
|
|
|
ASSERT_EQ(widget_get_prop_int(w1, WIDGET_PROP_DESIGN_H, 0), 300);
|
|
|
|
|
ASSERT_STREQ(widget_get_prop_str(w1, WIDGET_PROP_THEME, NULL), "hello");
|
|
|
|
|
ASSERT_STREQ(widget_get_prop_str(w1, WIDGET_PROP_ANIM_HINT, NULL), "popup");
|
|
|
|
|
|
|
|
|
|
widget_destroy(w);
|
|
|
|
|
widget_destroy(w1);
|
|
|
|
|
}
|