@@ -36,21 +36,27 @@ using ::testing::DefaultValue;
3636using ::testing::Return;
3737using namespace SCIRun ::Core::Datatypes;
3838
39- // / @todo DAN
40- // / Re-enable tests below to take into account floating point colors.
41-
4239TEST (ColorTests, CanParseString)
4340{
44- // ColorRGB c(1.0,2.0,3.0);
45- // const std::string expected = "Color(1,2,3)";
46- // EXPECT_EQ(expected, c.toString());
47- // ColorRGB c2(expected);
48- // EXPECT_EQ(c, c2);
41+ ColorRGB c (1.0 ,2.0 ,3.0 );
42+ const std::string expected = " Color(1,2,3)" ;
43+ EXPECT_EQ (expected, c.toString ());
44+ ColorRGB c2 (expected);
45+ EXPECT_EQ (c, c2);
46+ }
47+
48+ TEST (ColorTests, CanParseStringFloating)
49+ {
50+ ColorRGB c (1.3 ,2.9 ,3.00014 );
51+ const std::string expected = " Color(1.3,2.9,3.00014)" ;
52+ EXPECT_EQ (expected, c.toString ());
53+ ColorRGB c2 (expected);
54+ EXPECT_EQ (c, c2);
4955}
5056
5157TEST (ColorTests, EmptyStringYieldsWhite)
5258{
53- // ColorRGB c(255 .0,255 .0,255 .0);
54- // ColorRGB c2("");
55- // EXPECT_EQ(c, c2);
59+ ColorRGB c (1 .0 ,1 .0 ,1 .0 );
60+ ColorRGB c2 (" " );
61+ EXPECT_EQ (c, c2);
5662}
0 commit comments