From 41ce6d0cd02c4adec9295eaf1bd13d76a5c845d8 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Thu, 9 Sep 2021 07:46:42 -0400 Subject: [PATCH] Tests: Conform font tests to new font format --- Tests/LibGfx/TestFontHandling.cpp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/Tests/LibGfx/TestFontHandling.cpp b/Tests/LibGfx/TestFontHandling.cpp index d856886e4e1..a49f6648baa 100644 --- a/Tests/LibGfx/TestFontHandling.cpp +++ b/Tests/LibGfx/TestFontHandling.cpp @@ -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);