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

Unified Diff: ui/gfx/test/gfx_util.cc

Issue 2563743004: [3/5] Add translated rasterization support for RasterBuffer & below (Closed)
Patch Set: rebase & fix last nits Created 3 years, 9 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/test/gfx_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/test/gfx_util.cc
diff --git a/ui/gfx/test/gfx_util.cc b/ui/gfx/test/gfx_util.cc
index d8bf5f2af942e8b3eb54db125d47f78e8a39639e..e70b9609120ece666762ee4be4e68681e6d37f9d 100644
--- a/ui/gfx/test/gfx_util.cc
+++ b/ui/gfx/test/gfx_util.cc
@@ -8,6 +8,7 @@
#include <sstream>
#include <string>
+#include "ui/gfx/geometry/axis_transform2d.h"
#include "ui/gfx/geometry/box_f.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point3_f.h"
@@ -45,6 +46,21 @@ bool FloatAlmostEqual(float a, float b) {
} // namespace
+::testing::AssertionResult AssertAxisTransform2dFloatEqual(
+ const char* lhs_expr,
+ const char* rhs_expr,
+ const AxisTransform2d& lhs,
+ const AxisTransform2d& rhs) {
+ if (FloatAlmostEqual(lhs.scale(), rhs.scale()) &&
+ FloatAlmostEqual(lhs.translation().x(), rhs.translation().x()) &&
+ FloatAlmostEqual(lhs.translation().y(), rhs.translation().y())) {
+ return ::testing::AssertionSuccess();
+ }
+ return ::testing::AssertionFailure()
+ << "Value of: " << rhs_expr << "\n Actual: " << rhs.ToString()
+ << "\nExpected: " << lhs_expr << "\nWhich is: " << lhs.ToString();
+}
+
::testing::AssertionResult AssertBoxFloatEqual(const char* lhs_expr,
const char* rhs_expr,
const BoxF& lhs,
@@ -63,6 +79,19 @@ bool FloatAlmostEqual(float a, float b) {
<< "\nWhich is: " << lhs.ToString();
}
+::testing::AssertionResult AssertPointFloatEqual(const char* lhs_expr,
+ const char* rhs_expr,
+ const PointF& lhs,
+ const PointF& rhs) {
+ if (FloatAlmostEqual(lhs.x(), rhs.x()) &&
+ FloatAlmostEqual(lhs.y(), rhs.y())) {
+ return ::testing::AssertionSuccess();
+ }
+ return ::testing::AssertionFailure()
+ << "Value of: " << rhs_expr << "\n Actual: " << rhs.ToString()
+ << "\nExpected: " << lhs_expr << "\nWhich is: " << lhs.ToString();
+}
+
::testing::AssertionResult AssertRectFloatEqual(const char* lhs_expr,
const char* rhs_expr,
const RectF& lhs,
@@ -91,6 +120,10 @@ bool FloatAlmostEqual(float a, float b) {
<< "\nWhich is: " << ColorAsString(lhs);
}
+void PrintTo(const AxisTransform2d& transform, ::std::ostream* os) {
+ *os << transform.ToString();
+}
+
void PrintTo(const BoxF& box, ::std::ostream* os) {
*os << box.ToString();
}
« no previous file with comments | « ui/gfx/test/gfx_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698