mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 21:16:13 +01:00
Add font ascent, descent, glyph by ID and new font info
This commit is contained in:
8 files changed
+167
-9
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#include <CSFML/Graphics/Font.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
TEST_CASE("[Graphics] sfFont")
|
||||
{
|
||||
SECTION("sfFont_createFromFile")
|
||||
{
|
||||
CHECK(sfFont_createFromFile("does/not/exist.ttf") == nullptr);
|
||||
|
||||
sfFont* font = sfFont_createFromFile("Graphics/tuffy.ttf");
|
||||
REQUIRE(font != nullptr);
|
||||
|
||||
const sfFontInfo info = sfFont_getInfo(font);
|
||||
CHECK(info.id != 0);
|
||||
CHECK(std::string(info.family) == "Tuffy");
|
||||
CHECK(!info.hasVerticalMetrics);
|
||||
|
||||
CHECK(sfFont_getAscent(font, 10) > 0);
|
||||
CHECK(sfFont_getDescent(font, 10) < 0);
|
||||
CHECK(sfFont_getAscent(font, 20) > sfFont_getAscent(font, 10));
|
||||
|
||||
sfFont_destroy(font);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user