mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 05:35:52 +03:00
Tests: Conform font tests to new font format
This commit is contained in:
parent
dc65535b7c
commit
41ce6d0cd0
Notes:
sideshowbarker
2024-07-18 03:41:34 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/41ce6d0cd02 Pull-request: https://github.com/SerenityOS/serenity/pull/9911 Issue: https://github.com/SerenityOS/serenity/issues/7416 Reviewed-by: https://github.com/nico
@ -40,7 +40,7 @@ TEST_CASE(test_clone)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
auto new_font = font->clone();
|
||||
EXPECT(!new_font->name().is_null());
|
||||
@ -53,7 +53,7 @@ TEST_CASE(test_set_name)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
const char* name = "my newly created font";
|
||||
font->set_name(name);
|
||||
@ -66,7 +66,7 @@ TEST_CASE(test_set_family)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
const char* family = "my newly created font family";
|
||||
font->set_family(family);
|
||||
@ -79,7 +79,7 @@ TEST_CASE(test_set_glyph_width)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
size_t ch = 123;
|
||||
font->set_glyph_width(ch, glyph_width);
|
||||
@ -91,7 +91,7 @@ TEST_CASE(test_set_glyph_spacing)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
u8 glyph_spacing = 8;
|
||||
font->set_glyph_spacing(glyph_spacing);
|
||||
@ -99,23 +99,11 @@ TEST_CASE(test_set_glyph_spacing)
|
||||
EXPECT(font->glyph_spacing() == glyph_spacing);
|
||||
}
|
||||
|
||||
TEST_CASE(test_set_type)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
|
||||
auto type = Gfx::FontTypes::Default;
|
||||
font->set_type(type);
|
||||
|
||||
EXPECT(font->type() == type);
|
||||
}
|
||||
|
||||
TEST_CASE(test_width)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
EXPECT(font->width("A") == glyph_width);
|
||||
}
|
||||
@ -124,8 +112,7 @@ TEST_CASE(test_glyph_or_emoji_width)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
font->set_type(Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
EXPECT(font->glyph_or_emoji_width(0));
|
||||
}
|
||||
@ -140,7 +127,7 @@ TEST_CASE(test_write_to_file)
|
||||
{
|
||||
u8 glyph_height = 1;
|
||||
u8 glyph_width = 1;
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, Gfx::FontTypes::Default);
|
||||
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
|
||||
|
||||
char path[] = "/tmp/new.font.XXXXXX";
|
||||
EXPECT(mkstemp(path) != -1);
|
||||
|
Loading…
Reference in New Issue
Block a user