From d5d4215a458e45479128a2c6a713c841bedba744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 20 Aug 2012 17:51:38 +0200 Subject: [PATCH] Color: test for debug operators. --- src/Test/ColorTest.cpp | 17 ++++++++++++++++- src/Test/ColorTest.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Test/ColorTest.cpp b/src/Test/ColorTest.cpp index a500ffee4..3c3334ccd 100644 --- a/src/Test/ColorTest.cpp +++ b/src/Test/ColorTest.cpp @@ -21,11 +21,14 @@ using namespace std; CORRADE_TEST_MAIN(Magnum::Test::ColorTest) +using namespace Corrade::Utility; + namespace Magnum { namespace Test { typedef Magnum::Color3 Color3; typedef Magnum::Color4 Color4; typedef Magnum::Color3 Color3f; +typedef Magnum::Color4 Color4f; ColorTest::ColorTest() { addTests(&ColorTest::fromDenormalized, @@ -41,7 +44,9 @@ ColorTest::ColorTest() { &ColorTest::hsv, &ColorTest::hsvOverflow, - &ColorTest::hsvAlpha); + &ColorTest::hsvAlpha, + + &ColorTest::debug); } void ColorTest::fromDenormalized() { @@ -118,4 +123,14 @@ void ColorTest::hsvAlpha() { CORRADE_COMPARE(Color4::fromHSV(230.0f, 0.749f, 0.427f, 23), Color4(27, 41, 109, 23)); } +void ColorTest::debug() { + ostringstream o; + Debug(&o) << Color3f(0.5f, 0.75f, 1.0f); + CORRADE_COMPARE(o.str(), "Vector(0.5, 0.75, 1)\n"); + + o.str(""); + Debug(&o) << Color4f(0.5f, 0.75f, 0.0f, 1.0f); + CORRADE_COMPARE(o.str(), "Vector(0.5, 0.75, 0, 1)\n"); +} + }} diff --git a/src/Test/ColorTest.h b/src/Test/ColorTest.h index 068e36da6..a1ee2a727 100644 --- a/src/Test/ColorTest.h +++ b/src/Test/ColorTest.h @@ -37,6 +37,8 @@ class ColorTest: public Corrade::TestSuite::Tester { void hsv(); void hsvOverflow(); void hsvAlpha(); + + void debug(); }; }}