Browse Source

Color: test for debug operators.

pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
d5d4215a45
  1. 17
      src/Test/ColorTest.cpp
  2. 2
      src/Test/ColorTest.h

17
src/Test/ColorTest.cpp

@ -21,11 +21,14 @@ using namespace std;
CORRADE_TEST_MAIN(Magnum::Test::ColorTest) CORRADE_TEST_MAIN(Magnum::Test::ColorTest)
using namespace Corrade::Utility;
namespace Magnum { namespace Test { namespace Magnum { namespace Test {
typedef Magnum::Color3<unsigned char> Color3; typedef Magnum::Color3<unsigned char> Color3;
typedef Magnum::Color4<unsigned char> Color4; typedef Magnum::Color4<unsigned char> Color4;
typedef Magnum::Color3<float> Color3f; typedef Magnum::Color3<float> Color3f;
typedef Magnum::Color4<float> Color4f;
ColorTest::ColorTest() { ColorTest::ColorTest() {
addTests(&ColorTest::fromDenormalized, addTests(&ColorTest::fromDenormalized,
@ -41,7 +44,9 @@ ColorTest::ColorTest() {
&ColorTest::hsv, &ColorTest::hsv,
&ColorTest::hsvOverflow, &ColorTest::hsvOverflow,
&ColorTest::hsvAlpha); &ColorTest::hsvAlpha,
&ColorTest::debug);
} }
void ColorTest::fromDenormalized() { 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)); 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");
}
}} }}

2
src/Test/ColorTest.h

@ -37,6 +37,8 @@ class ColorTest: public Corrade::TestSuite::Tester<ColorTest> {
void hsv(); void hsv();
void hsvOverflow(); void hsvOverflow();
void hsvAlpha(); void hsvAlpha();
void debug();
}; };
}} }}

Loading…
Cancel
Save