awtk/tests/button_test.cc

26 lines
699 B
C++
Raw Normal View History

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