mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
chore(test): add GxuFontCreateFont tests
This commit is contained in:
parent
3889ee7b58
commit
e1fcee1652
4
.github/workflows/pr.yml
vendored
4
.github/workflows/pr.yml
vendored
@ -64,5 +64,5 @@ jobs:
|
|||||||
working-directory: build
|
working-directory: build
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ./dist/bin/${{ matrix.config.test_path }}
|
run: ../../build/dist/bin/${{ matrix.config.test_path }}
|
||||||
working-directory: build
|
working-directory: test/fixture
|
||||||
|
|||||||
4
.github/workflows/push.yml
vendored
4
.github/workflows/push.yml
vendored
@ -67,5 +67,5 @@ jobs:
|
|||||||
working-directory: build
|
working-directory: build
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: ./dist/bin/${{ matrix.config.test_path }}
|
run: ../../build/dist/bin/${{ matrix.config.test_path }}
|
||||||
working-directory: build
|
working-directory: test/fixture
|
||||||
|
|||||||
@ -1,2 +1,15 @@
|
|||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_RUNNER
|
||||||
#include "catch.hpp"
|
#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 <cstdint>
|
||||||
#include "catch.hpp"
|
#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]") {
|
TEST_CASE("GxuDetermineQuotedCode", "[gx]") {
|
||||||
SECTION("does not recognize non-quoted code") {
|
SECTION("does not recognize non-quoted code") {
|
||||||
const char* str = "test1";
|
const char* str = "test1";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user