22 const float fMin =
std::numeric_limits<
float>::min();
23 const float fMax =
std::numeric_limits<
float>::max();
24 const float fInf =
std::numeric_limits<
float>::infinity();
25 const float fNan =
std::numeric_limits<
float>::quiet_NaN();
28 for (
float c1 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
29 for (
float c2 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
30 for (BlendMode c3 : {BlendMode::kMultiply, BlendMode::kScreen})
31 EXPECT_FALSE(GraphicsData({c1, c2, c3}) < GraphicsData({c1, c2, c3}));
36 std::vector<
float> data = {fMax, fInf, fNan, fMin};
38 EXPECT_EQ(data[0], fMin);
39 EXPECT_EQ(data[1], fMax);
40 EXPECT_EQ(data[2], fInf);
41 EXPECT_EQ(isnan(data[3]), isnan(fNan));
43 std::map<GraphicsData,
int> graphics_map;
47 for (BlendMode c3 : {BlendMode::kScreen, BlendMode::kMultiply}) {
48 for (
float c2 : {fNan, fInf, fMax, 2.0f, 1.0f, fMin}) {
49 for (
float c1 : {fNan, fInf, fMax, 2.0f, 1.0f, fMin}) {
50 graphics_map[{c1, c2, c3}] = x++;
55 EXPECT_EQ(72u, graphics_map.size());
58 const int expected[72] = {
59 71, 35, 65, 29, 59, 23, 53, 17, 47, 11, 41, 5,
60 70, 34, 64, 28, 58, 22, 52, 16, 46, 10, 40, 4,
61 69, 33, 63, 27, 57, 21, 51, 15, 45, 9, 39, 3,
62 68, 32, 62, 26, 56, 20, 50, 14, 44, 8, 38, 2,
63 67, 31, 61, 25, 55, 19, 49, 13, 43, 7, 37, 1,
64 66, 30, 60, 24, 54, 18, 48, 12, 42, 6, 36, 0
69 for (
const auto& item : graphics_map) {
70 EXPECT_EQ(expected[x], item.second) <<
" for position " << x;
76 for (BlendMode c3 : {BlendMode::kMultiply, BlendMode::kScreen}) {
77 for (
float c2 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan}) {
78 for (
float c1 : {fMin, 1.0f, 2.0f, fMax, fInf, fNan})
79 graphics_map.erase({c1, c2, c3});
82 EXPECT_EQ(0u, graphics_map.size());