Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: ui/gfx/color_utils_unittest.cc

Issue 2182633012: Add Matrix4x3 and tristimulus class to color utiliies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/color_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_utils_unittest.cc
diff --git a/ui/gfx/color_utils_unittest.cc b/ui/gfx/color_utils_unittest.cc
index 2993fe45a5d122e19f60b796c9bb7dfd5eec5691..584790a3fb7d01a631e30d35a518ea9ce009cd22 100644
--- a/ui/gfx/color_utils_unittest.cc
+++ b/ui/gfx/color_utils_unittest.cc
@@ -165,4 +165,31 @@ TEST(ColorUtils, AlphaBlend) {
EXPECT_EQ(0U, SkColorGetA(AlphaBlend(fore, back, 255)));
}
+TEST(ColorUtils, Matrix4x3) {
+ Matrix4x3 tmp;
+ EXPECT_EQ(tmp.lookup(3, 3), 1.0f);
+ tmp.rows[0][2] = 4.0f;
+ tmp.rows[2][1] = 8.0f;
+ Matrix4x3 copy = tmp.Invert().Invert();
+ EXPECT_EQ(tmp.rows[0][2], 4.0f);
+ EXPECT_EQ(tmp.rows[2][1], 8.0f);
+ for (int row = 0; row < 3; row++) {
+ for (int col = 0; col < 4; col++) {
+ copy.rows[row][col] = 0.0f;
+ }
+ }
+ copy = copy * tmp;
+ for (int row = 0; row < 3; row++) {
+ for (int col = 0; col < 4; col++) {
+ EXPECT_EQ(copy.lookup(row, col), 0.0f);
+ }
+ }
+
+ TriStim tmp2(1.0f, 2.0f, 3.0f);
+ tmp2 = copy * tmp2;
+ EXPECT_EQ(tmp2.values[0], 0.0f);
+ EXPECT_EQ(tmp2.values[1], 0.0f);
+ EXPECT_EQ(tmp2.values[2], 0.0f);
+}
+
} // namespace color_utils
« no previous file with comments | « ui/gfx/color_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698