Browse Source

MagnumFont: remove accidentally forgotten debug output and test it.

pull/205/merge
Vladimír Vondruš 8 years ago
parent
commit
efa19ffbe7
  1. 2
      src/MagnumPlugins/MagnumFont/MagnumFont.cpp
  2. 14
      src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp

2
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 {};
}

14
src/MagnumPlugins/MagnumFont/Test/MagnumFontGLTest.cpp

@ -23,6 +23,7 @@
DEALINGS IN THE SOFTWARE.
*/
#include <sstream>
#include <Corrade/Utility/Directory.h>
#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));

Loading…
Cancel
Save