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