mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 11:08:34 +08:00
23 lines
676 B
C++
23 lines
676 B
C++
#include "base/events.h"
|
|
#include "tkc/int_str.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <string>
|
|
|
|
using std::string;
|
|
|
|
static int_str_t items[] = {
|
|
{EVT_CLICK, "CLICK"}, {EVT_POINTER_DOWN, "POINTER_DOWN"}, {EVT_NONE, NULL}};
|
|
|
|
TEST(IntStr, name) {
|
|
ASSERT_EQ(int_str_name(items, "CLICK", -1), EVT_CLICK);
|
|
ASSERT_EQ(int_str_name(items, "POINTER_DOWN", -1), EVT_POINTER_DOWN);
|
|
ASSERT_EQ(int_str_name(items, "NOT EXIST", -1), -1);
|
|
}
|
|
|
|
TEST(IntStr, value) {
|
|
ASSERT_EQ(string(int_str_value(items, EVT_CLICK)), string("CLICK"));
|
|
ASSERT_EQ(string(int_str_value(items, EVT_POINTER_DOWN)), string("POINTER_DOWN"));
|
|
ASSERT_EQ(int_str_value(items, -1), (const char*)NULL);
|
|
}
|