From efa19ffbe7722f8f6c7e4c832e870cf9539720ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 1 Apr 2018 00:05:41 +0200 Subject: [PATCH] MagnumFont: remove accidentally forgotten debug output and test it. --- src/MagnumPlugins/MagnumFont/MagnumFont.cpp | 2 +- .../MagnumFont/Test/MagnumFontGLTest.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp index d4640c473..b0fac553e 100644 --- a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp @@ -118,7 +118,7 @@ auto MagnumFont::doOpenFile(const std::string& filename, Float) -> Metrics { /* Open the configuration file */ Utility::Configuration conf(filename, Utility::Configuration::Flag::ReadOnly|Utility::Configuration::Flag::SkipComments); if(!conf.isValid() || conf.isEmpty()) { - Error() << "Text::MagnumFont::openFile(): cannot open file" << filename << conf.isValid(); + Error() << "Text::MagnumFont::openFile(): cannot open file" << filename; return {}; } diff --git a/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp b/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp index cc01f2eca..c1af1ed7a 100644 --- a/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp +++ b/src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp @@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include "Magnum/OpenGLTester.h" @@ -36,17 +37,28 @@ namespace Magnum { namespace Text { namespace Test { struct MagnumFontGLTest: OpenGLTester { explicit MagnumFontGLTest(); + void nonexistent(); void properties(); void layout(); void createGlyphCache(); }; MagnumFontGLTest::MagnumFontGLTest() { - addTests({&MagnumFontGLTest::properties, + addTests({&MagnumFontGLTest::nonexistent, + &MagnumFontGLTest::properties, &MagnumFontGLTest::layout, &MagnumFontGLTest::createGlyphCache}); } +void MagnumFontGLTest::nonexistent() { + MagnumFont font; + + std::ostringstream out; + Error redirectError{&out}; + CORRADE_VERIFY(!font.openFile("nonexistent.conf", 0.0f)); + CORRADE_COMPARE(out.str(), "Text::MagnumFont::openFile(): cannot open file nonexistent.conf\n"); +} + void MagnumFontGLTest::properties() { MagnumFont font; CORRADE_VERIFY(font.openFile(Utility::Directory::join(MAGNUMFONT_TEST_DIR, "font.conf"), 0.0f));