mirror of
https://github.com/whoahq/whoa.git
synced 2026-10-31 03:47:05 +03:00
chore(test): add GxuFontCreateFont tests
This commit is contained in:
1 parent
3889ee7b58
commit
41641778d9
4 files changed
+40
-5
No files matched your search
+14
-1
@@ -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;
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
Reference in new issue
Block a user