Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / compositor / test / test_utils.cc
blob50f48fd382852601d824f2e0298bec71b6b73c65
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/compositor/test/test_utils.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/geometry/rect.h"
9 #include "ui/gfx/transform.h"
11 namespace ui {
13 //TODO(avallee): Make this into a predicate and add some matrix pretty printing.
14 void CheckApproximatelyEqual(const gfx::Transform& lhs,
15 const gfx::Transform& rhs) {
16 unsigned int errors = 0;
17 for (int i = 0; i < 4; ++i) {
18 for (int j = 0; j < 4; ++j) {
19 EXPECT_FLOAT_EQ(lhs.matrix().get(i, j), rhs.matrix().get(i, j))
20 << "(i, j) = (" << i << ", " << j << "), error count: " << ++errors;
24 if (errors) {
25 ADD_FAILURE() << "Expected matrix:\n"
26 << lhs.ToString() << "\n"
27 << "Actual matrix:\n"
28 << rhs.ToString();
32 void CheckApproximatelyEqual(const gfx::Rect& lhs, const gfx::Rect& rhs) {
33 EXPECT_FLOAT_EQ(lhs.x(), rhs.x());
34 EXPECT_FLOAT_EQ(lhs.y(), rhs.y());
35 EXPECT_FLOAT_EQ(lhs.width(), rhs.width());
36 EXPECT_FLOAT_EQ(lhs.height(), rhs.height());
39 } // namespace ui