2018-02-21 19:36:38 +08:00
|
|
|
#include "base/button.h"
|
|
|
|
#include "base/canvas.h"
|
|
|
|
#include "base/widget.h"
|
|
|
|
#include "font_dummy.h"
|
|
|
|
#include "lcd_log.h"
|
2018-02-22 08:36:54 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <stdlib.h>
|
2018-02-21 19:36:38 +08:00
|
|
|
|
|
|
|
TEST(Button, basic) {
|
|
|
|
value_t v1;
|
|
|
|
value_t v2;
|
|
|
|
widget_t* b = button_create(NULL, 10, 20, 30, 40);
|
|
|
|
|
2018-03-04 08:32:52 +08:00
|
|
|
ASSERT_EQ(widget_set_text(b, L"OK"), RET_OK);
|
2018-04-05 18:45:19 +08:00
|
|
|
ASSERT_EQ(wcscmp(b->text.str, L"OK"), 0);
|
2018-03-04 08:32:52 +08:00
|
|
|
ASSERT_EQ(widget_set_text(b, L"Cancel"), RET_OK);
|
2018-04-05 18:45:19 +08:00
|
|
|
ASSERT_EQ(wcscmp(b->text.str, L"Cancel"), 0);
|
2018-02-21 19:36:38 +08:00
|
|
|
|
|
|
|
value_set_wstr(&v1, L"button");
|
2018-04-20 21:49:47 +08:00
|
|
|
ASSERT_EQ(widget_set_prop(b, WIDGET_PROP_TEXT, &v1), RET_OK);
|
|
|
|
ASSERT_EQ(widget_get_prop(b, WIDGET_PROP_TEXT, &v2), RET_OK);
|
2018-02-21 19:36:38 +08:00
|
|
|
ASSERT_EQ(wcscmp(v1.value.wstr, v2.value.wstr), 0);
|
|
|
|
|
|
|
|
widget_destroy(b);
|
|
|
|
}
|