Add missing unit test for color::operator= and color::operator== (ref #4137)

This commit is contained in:
Artem Pavlenko 2020-04-23 18:18:47 +01:00
parent 52ae365c66
commit 9bfe888cef

View file

@ -269,6 +269,7 @@ TEST_CASE("CSS color") {
CHECK( !boost::spirit::x3::phrase_parse(s.cbegin(), s.cend(), color_grammar, space, c) );
}
}
SECTION("operator<< / to_string()")
{
mapnik::color c("salmon");
@ -280,6 +281,19 @@ TEST_CASE("CSS color") {
ss << c ;
CHECK(ss.str() == "rgba(250,128,114,0.498)");
}
SECTION("operator= operator==")
{
mapnik::color c1("cornflowerblue", true);
mapnik::color c2 = c1; // make copy
CHECK(c1.red() == c2.red());
CHECK(c1.green() == c2.green());
CHECK(c1.blue() == c2.blue());
CHECK(c1.get_premultiplied() == c2.get_premultiplied());
CHECK(c1 == c2);
c1.demultiply();
CHECK(c1 != c2);
CHECK(c1.get_premultiplied() != c2.get_premultiplied());
}
SECTION("premultiply/demultiply")
{
mapnik::color c("cornflowerblue");