/src/mozilla-central/gfx/tests/gtest/PolygonTestUtils.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef GFX_TEST_POLYGONUTILS_H |
8 | | #define GFX_TEST_POLYGONUTILS_H |
9 | | |
10 | | #include "gtest/gtest.h" |
11 | | |
12 | | #include "nsTArray.h" |
13 | | #include "Point.h" |
14 | | #include "Polygon.h" |
15 | | #include "Triangle.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace gfx { |
19 | | |
20 | | bool FuzzyEquals(const Point4D& lhs, const Point4D& rhs); |
21 | | bool FuzzyEquals(const Point3D& lhs, const Point3D& rhs); |
22 | | bool FuzzyEquals(const Point& lhs, const Point& rhs); |
23 | | |
24 | | bool operator==(const Triangle& lhs, const Triangle& rhs); |
25 | | bool operator==(const Polygon& lhs, const Polygon& rhs); |
26 | | |
27 | | // Compares two arrays with the equality operator. |
28 | | template<typename T> |
29 | | void AssertArrayEQ(const nsTArray<T>& rhs, const nsTArray<T>& lhs) |
30 | 0 | { |
31 | 0 | ASSERT_EQ(lhs.Length(), rhs.Length()); |
32 | 0 |
|
33 | 0 | for (size_t i = 0; i < lhs.Length(); ++i) { |
34 | 0 | EXPECT_TRUE(lhs[i] == rhs[i]); |
35 | 0 | } |
36 | 0 | } |
37 | | |
38 | | } // namespace gfx |
39 | | } // namespace mozilla |
40 | | |
41 | | #endif /* GFX_TEST_POLYGONUTILS_H */ |