awtk/tests/font_manager_test.cc

31 lines
1.2 KiB
C++
Raw Normal View History

2018-06-27 13:46:42 +08:00

2018-02-21 19:36:38 +08:00
#include "base/array.h"
#include "base/canvas.h"
#include "base/font_manager.h"
2018-02-21 19:36:38 +08:00
#include "font_dummy.h"
#include "lcd_log.h"
#include "gtest/gtest.h"
#include <stdlib.h>
2018-02-21 19:36:38 +08:00
TEST(FontManager, basic) {
font_manager_t font_manager;
font_dummy_init();
font_manager_init(&font_manager);
font_manager_add(&font_manager, font_dummy_0("demo0", 10));
font_manager_add(&font_manager, font_dummy_1("demo1", 11));
font_manager_add(&font_manager, font_dummy_2("demo2", 12));
ASSERT_EQ(font_manager_find(&font_manager, "demo0", 10), font_dummy_0("demo0", 10));
ASSERT_EQ(font_manager_find(&font_manager, "demo1", 11), font_dummy_1("demo1", 11));
ASSERT_EQ(font_manager_find(&font_manager, "demo2", 12), font_dummy_2("demo2", 12));
ASSERT_EQ(font_manager_find(&font_manager, NULL, 10), font_dummy_0("demo0", 10));
ASSERT_EQ(font_manager_find(&font_manager, NULL, 11), font_dummy_1("demo1", 11));
ASSERT_EQ(font_manager_find(&font_manager, NULL, 12), font_dummy_2("demo2", 12));
ASSERT_EQ(font_manager_find(&font_manager, NULL, 20) != NULL, true);
ASSERT_EQ(font_manager_find(&font_manager, "demo0", 20) != NULL, true);
2018-03-11 14:21:19 +08:00
font_manager_deinit(&font_manager);
2018-02-21 19:36:38 +08:00
}