| 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 #include "platform/testing/PictureMatchers.h" | 5 #include "platform/testing/PictureMatchers.h" |
| 6 | 6 |
| 7 #include "platform/geometry/FloatQuad.h" | 7 #include "platform/geometry/FloatQuad.h" |
| 8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkPicture.h" | 10 #include "third_party/skia/include/core/SkPicture.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 picture.playback(&canvas); | 115 picture.playback(&canvas); |
| 116 const auto& quads = canvas.quadsWithColor(); | 116 const auto& quads = canvas.quadsWithColor(); |
| 117 if (quads.size() != m_rectsWithColor.size()) { | 117 if (quads.size() != m_rectsWithColor.size()) { |
| 118 *listener << "which draws " << quads.size() << " quads"; | 118 *listener << "which draws " << quads.size() << " quads"; |
| 119 return false; | 119 return false; |
| 120 } | 120 } |
| 121 | 121 |
| 122 for (unsigned index = 0; index < quads.size(); index++) { | 122 for (unsigned index = 0; index < quads.size(); index++) { |
| 123 const auto& quadWithColor = quads[index]; | 123 const auto& quadWithColor = quads[index]; |
| 124 const auto& rectWithColor = m_rectsWithColor[index]; | 124 const auto& rectWithColor = m_rectsWithColor[index]; |
| 125 if (!quadWithColor.quad.isRectilinear()) { | |
| 126 if (listener->IsInterested()) { | |
| 127 *listener << "at index " << index << " which draws "; | |
| 128 PrintTo(quadWithColor.quad, listener->stream()); | |
| 129 *listener << " with color " | |
| 130 << quadWithColor.color.serialized().ascii().data() << "\n"; | |
| 131 } | |
| 132 return false; | |
| 133 } | |
| 134 | 125 |
| 135 const FloatRect& rect = quadWithColor.quad.boundingBox(); | 126 const FloatRect& rect = quadWithColor.quad.boundingBox(); |
| 136 if (rect != rectWithColor.rect || | 127 if (enclosingIntRect(rect) != enclosingIntRect(rectWithColor.rect) || |
| 137 quadWithColor.color != rectWithColor.color) { | 128 quadWithColor.color != rectWithColor.color) { |
| 138 if (listener->IsInterested()) { | 129 if (listener->IsInterested()) { |
| 139 *listener << "at index " << index << " which draws "; | 130 *listener << "at index " << index << " which draws "; |
| 140 PrintTo(rect, listener->stream()); | 131 PrintTo(rect, listener->stream()); |
| 141 *listener << " with color " | 132 *listener << " with color " |
| 142 << quadWithColor.color.serialized().ascii().data() << "\n"; | 133 << quadWithColor.color.serialized().ascii().data() << "\n"; |
| 143 } | 134 } |
| 144 return false; | 135 return false; |
| 145 } | 136 } |
| 146 } | 137 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 171 rectsWithColor.push_back(RectWithColor(rect, color)); | 162 rectsWithColor.push_back(RectWithColor(rect, color)); |
| 172 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor)); | 163 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor)); |
| 173 } | 164 } |
| 174 | 165 |
| 175 ::testing::Matcher<const SkPicture&> drawsRectangles( | 166 ::testing::Matcher<const SkPicture&> drawsRectangles( |
| 176 const Vector<RectWithColor>& rectsWithColor) { | 167 const Vector<RectWithColor>& rectsWithColor) { |
| 177 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor)); | 168 return ::testing::MakeMatcher(new DrawsRectanglesMatcher(rectsWithColor)); |
| 178 } | 169 } |
| 179 | 170 |
| 180 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |