From db1d18729c75d524899b54be82b1730e249cb259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 8 Mar 2019 23:04:37 +0100 Subject: [PATCH] Text: test basic AbstractFont construction. --- src/Magnum/Text/Test/AbstractFontTest.cpp | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Text/Test/AbstractFontTest.cpp b/src/Magnum/Text/Test/AbstractFontTest.cpp index 72b634f5d..a71bfa80d 100644 --- a/src/Magnum/Text/Test/AbstractFontTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontTest.cpp @@ -41,6 +41,8 @@ namespace Magnum { namespace Text { namespace Test { namespace { struct AbstractFontTest: TestSuite::Tester { explicit AbstractFontTest(); + void construct(); + void openData(); void openFileAsData(); void openFileAsDataNotFound(); @@ -91,7 +93,9 @@ struct AbstractFontTest: TestSuite::Tester { }; AbstractFontTest::AbstractFontTest() { - addTests({&AbstractFontTest::openData, + addTests({&AbstractFontTest::construct, + + &AbstractFontTest::openData, &AbstractFontTest::openFileAsData, &AbstractFontTest::openFileAsDataNotFound, @@ -140,6 +144,26 @@ AbstractFontTest::AbstractFontTest() { &AbstractFontTest::debugFeatures}); } +void AbstractFontTest::construct() { + struct: AbstractFont { + Features doFeatures() const override { return {}; } + bool doIsOpened() const override { return false; } + void doClose() override {} + + UnsignedInt doGlyphId(char32_t) override { return {}; } + Vector2 doGlyphAdvance(UnsignedInt) override { return {}; } + Containers::Pointer doLayout(const AbstractGlyphCache&, Float, const std::string&) override { + return nullptr; + } + } font; + + CORRADE_COMPARE(font.features(), AbstractFont::Features{}); + CORRADE_VERIFY(!font.isOpened()); + + font.close(); + CORRADE_VERIFY(!font.isOpened()); +} + void AbstractFontTest::openData() { struct: AbstractFont { Features doFeatures() const override { return Feature::OpenData; }