| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const auto& quads = canvas.quads(); | 43 const auto& quads = canvas.quads(); |
| 44 | 44 |
| 45 if (quads.size() != 1) { | 45 if (quads.size() != 1) { |
| 46 *listener << "which draws " << quads.size() << " quads"; | 46 *listener << "which draws " << quads.size() << " quads"; |
| 47 return false; | 47 return false; |
| 48 } | 48 } |
| 49 | 49 |
| 50 const FloatQuad& quad = quads[0].first; | 50 const FloatQuad& quad = quads[0].first; |
| 51 if (!quad.isRectilinear()) { | 51 if (!quad.isRectilinear()) { |
| 52 if (listener->IsInterested()) { | 52 if (listener->IsInterested()) { |
| 53 *listener << "which draws "; | 53 *listener << "which draws " << quad |
| 54 PrintTo(quad, listener->stream()); | 54 << " with color " << quads[0].second.serialized().ascii().da
ta(); |
| 55 *listener << " with color " << quads[0].second.serialized().asci
i().data(); | |
| 56 } | 55 } |
| 57 return false; | 56 return false; |
| 58 } | 57 } |
| 59 | 58 |
| 60 const FloatRect& rect = quad.boundingBox(); | 59 const FloatRect& rect = quad.boundingBox(); |
| 61 if (rect != m_rect || quads[0].second != m_color) { | 60 if (rect != m_rect || quads[0].second != m_color) { |
| 62 if (listener->IsInterested()) { | 61 if (listener->IsInterested()) { |
| 63 *listener << "which draws "; | 62 *listener << "which draws " << rect |
| 64 PrintTo(rect, listener->stream()); | 63 << " with color " << quads[0].second.serialized().ascii().da
ta(); |
| 65 *listener << " with color " << quads[0].second.serialized().asci
i().data(); | |
| 66 } | 64 } |
| 67 return false; | 65 return false; |
| 68 } | 66 } |
| 69 | 67 |
| 70 return true; | 68 return true; |
| 71 } | 69 } |
| 72 | 70 |
| 73 void DescribeTo(::std::ostream* os) const override | 71 void DescribeTo(::std::ostream* os) const override |
| 74 { | 72 { |
| 75 *os << "draws "; | 73 *os << "draws " << m_rect |
| 76 PrintTo(m_rect, os); | 74 << " with color " << m_color.serialized().ascii().data(); |
| 77 *os << " with color " << m_color.serialized().ascii().data(); | |
| 78 } | 75 } |
| 79 | 76 |
| 80 private: | 77 private: |
| 81 const FloatRect m_rect; | 78 const FloatRect m_rect; |
| 82 const Color m_color; | 79 const Color m_color; |
| 83 }; | 80 }; |
| 84 | 81 |
| 85 } // namespace | 82 } // namespace |
| 86 | 83 |
| 87 ::testing::Matcher<const SkPicture&> drawsRectangle(const FloatRect& rect, Color
color) | 84 ::testing::Matcher<const SkPicture&> drawsRectangle(const FloatRect& rect, Color
color) |
| 88 { | 85 { |
| 89 return ::testing::MakeMatcher(new DrawsRectangleMatcher(rect, color)); | 86 return ::testing::MakeMatcher(new DrawsRectangleMatcher(rect, color)); |
| 90 } | 87 } |
| 91 | 88 |
| 92 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |