| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef PictureMatchers_h | 5 #ifndef PictureMatchers_h |
| 6 #define PictureMatchers_h | 6 #define PictureMatchers_h |
| 7 | 7 |
| 8 #include "platform/geometry/FloatRect.h" |
| 8 #include "platform/graphics/Color.h" | 9 #include "platform/graphics/Color.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 10 | 11 |
| 11 class SkPicture; | 12 class SkPicture; |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class FloatRect; | 16 class FloatRect; |
| 16 | 17 |
| 17 // Matches if the picture draws exactly one rectangle, which (after accounting | 18 // Matches if the picture draws exactly one rectangle, which (after accounting |
| 18 // for the total transformation matrix) matches the rect provided, and whose | 19 // for the total transformation matrix and applying any clips inside that |
| 19 // paint has the color requested. | 20 // transform) matches the rect provided, and whose paint has the color |
| 21 // requested. |
| 22 // Note that clips which appear outside of a transform are not currently |
| 23 // supported. |
| 20 ::testing::Matcher<const SkPicture&> drawsRectangle(const FloatRect&, Color); | 24 ::testing::Matcher<const SkPicture&> drawsRectangle(const FloatRect&, Color); |
| 21 | 25 |
| 26 struct RectWithColor { |
| 27 RectWithColor(const FloatRect& rectArg, const Color& colorArg) |
| 28 : rect(rectArg), color(colorArg) {} |
| 29 FloatRect rect; |
| 30 Color color; |
| 31 }; |
| 32 |
| 33 // Same as above, but matches a number of rectangles equal to the size of the |
| 34 // given vector. |
| 35 ::testing::Matcher<const SkPicture&> drawsRectangles( |
| 36 const Vector<RectWithColor>&); |
| 37 |
| 22 } // namespace blink | 38 } // namespace blink |
| 23 | 39 |
| 24 #endif // PictureMatchers_h | 40 #endif // PictureMatchers_h |
| OLD | NEW |