OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerTestCommon.h" | 7 #include "CCLayerTestCommon.h" |
8 #include "CCDrawQuad.h" | 8 #include "CCDrawQuad.h" |
9 | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include <gtest/gtest.h> | |
11 | 10 |
12 namespace CCLayerTestCommon { | 11 namespace CCLayerTestCommon { |
13 | 12 |
14 // Align with expected and actual output | 13 // Align with expected and actual output |
15 const char* quadString = " Quad: "; | 14 const char* quadString = " Quad: "; |
16 | 15 |
17 void verifyQuadsExactlyCoverRect(const cc::CCQuadList& quads, | 16 void verifyQuadsExactlyCoverRect(const cc::CCQuadList& quads, |
18 const cc::IntRect& rect) { | 17 const cc::IntRect& rect) { |
19 cc::Region remaining(rect); | 18 cc::Region remaining(rect); |
20 | 19 |
21 for (size_t i = 0; i < quads.size(); ++i) { | 20 for (size_t i = 0; i < quads.size(); ++i) { |
22 cc::CCDrawQuad* quad = quads[i]; | 21 cc::CCDrawQuad* quad = quads[i]; |
23 cc::IntRect quadRect = quad->quadRect(); | 22 cc::IntRect quadRect = quad->quadRect(); |
24 | 23 |
25 EXPECT_TRUE(rect.contains(quadRect)) << quadString << i; | 24 EXPECT_TRUE(rect.contains(quadRect)) << quadString << i; |
26 EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i; | 25 EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i; |
27 remaining.subtract(cc::Region(quadRect)); | 26 remaining.subtract(cc::Region(quadRect)); |
28 } | 27 } |
29 | 28 |
30 EXPECT_TRUE(remaining.isEmpty()); | 29 EXPECT_TRUE(remaining.isEmpty()); |
31 } | 30 } |
32 | 31 |
33 } // namespace CCLayerTestCommon | 32 } // namespace CCLayerTestCommon |
OLD | NEW |