Skip to content
Snippets Groups Projects
Commit 0f75b5d2 authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

fix for previous fix that failed to fix previous fix (all in the name of anal type checking)

parent a23842e3
No related branches found
No related tags found
No related merge requests found
......@@ -46,135 +46,137 @@ namespace {
}
}
#define FIXED_BOOST_WARN_CLOSE(F1,F2,F3) BOOST_WARN_CLOSE(static_cast<float>(F1), static_cast<float>(F2), static_cast<float>(F3))
BOOST_AUTO_TEST_SUITE(gfx)
BOOST_AUTO_TEST_CASE(default_color)
{
Color c;
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetAlpha(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetAlpha(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
}
BOOST_AUTO_TEST_CASE(set_rgb)
{
Color c;
c = RGB(1.0f,0.0f,0.0f); // red
BOOST_WARN_CLOSE(c.GetAlpha(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),0.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetAlpha(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),0.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = RGB(1.0f,1.0f,0.0f); // yellow
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),1.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),1.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = RGB(0.0f,1.0f,0.0f); // green
BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),2.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),2.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = RGB(0.0f,1.0f,1.0f); // cyan
BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),3.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),3.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = RGB(0.0f,0.0f,1.0f); // blue
BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),4.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),4.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = RGB(1.0f,0.0f,1.0f); // purple
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),5.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),5.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
}
BOOST_AUTO_TEST_CASE(set_hsv)
{
Color c;
c = HSV(0.0f/6.0,1.0f,1.0f); // red
BOOST_WARN_CLOSE(c.GetAlpha(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),0.0f/6.0,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetAlpha(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),0.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(0.0f/6.0,0.5,1.0f); // light red
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),0.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),0.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(1.0f/6.0,1.0f,1.0f); // yellow
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),1.0f/6.0,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),1.0f/6.0,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(2.0/6.0,1.0f,1.0f); // green
BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),2.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),2.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(2.0/6.0,0.5,1.0f); // light green
BOOST_WARN_CLOSE(c.GetRed(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),2.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),2.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(3.0/6.0,1.0f,1.0f); // cyan
BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),3.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),3.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(4.0/6.0,1.0f,1.0f); // blue
BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),4.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),4.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(4.0/6.0,0.5,1.0f); // light blue
BOOST_WARN_CLOSE(c.GetRed(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),4.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),0.5f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),4.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),0.5f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
c = HSV(5.0/6.0,1.0f,1.0f); // purple
BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetHue(),5.0f/6.0f,tolerance);
BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetRed(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetGreen(),0.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetBlue(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetHue(),5.0f/6.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetSat(),1.0f,tolerance);
FIXED_BOOST_WARN_CLOSE(c.GetVal(),1.0f,tolerance);
}
BOOST_AUTO_TEST_CASE(set_char)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment