chore(test): add GxuFontCreateFont tests

This commit is contained in:
fallenoak committed 2025-12-15 20:10:26 -06:00
1 parent 3889ee7b58
commit 41641778d9
4 files changed
+40 -5

No files matched your search

+14 -1
View File
@@ -1,2 +1,15 @@
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
#include "gx/font/FreeType.hpp"
int main(int argc, char* argv[]) {
// Global initialization
FreeTypeInitialize();
int result = Catch::Session().run( argc, argv );
// Global cleanup
// TODO
return result;
}
+22
View File
@@ -2,6 +2,28 @@
#include <cstdint>
#include "catch.hpp"
TEST_CASE("GxuFontCreateFont", "[gx]") {
SECTION("creates a font") {
const char* name = "font\\FRIZQT__.TTF";
CGxFont* face;
auto result = GxuFontCreateFont(name, 0.5f, face, 0x0);
REQUIRE(result != 0);
REQUIRE(face != nullptr);
GxuFontDestroyFont(face);
}
SECTION("fails to create a font that doesn't exist") {
const char* name = "font\\DOESNOTEXIST.TTF";
CGxFont* face;
auto result = GxuFontCreateFont(name, 0.5f, face, 0x0);
REQUIRE(result == 0);
REQUIRE(face == nullptr);
}
}
TEST_CASE("GxuDetermineQuotedCode", "[gx]") {
SECTION("does not recognize non-quoted code") {
const char* str = "test1";