Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: ui/gfx/paint_vector_icon_unittest.cc

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/paint_vector_icon_unittest.cc
diff --git a/ui/gfx/paint_vector_icon_unittest.cc b/ui/gfx/paint_vector_icon_unittest.cc
index 6786bf12d0187affcaf2952c4352264efdd1f08e..1adbb3fe3c8f14603d8020eeb83756871b73debd 100644
--- a/ui/gfx/paint_vector_icon_unittest.cc
+++ b/ui/gfx/paint_vector_icon_unittest.cc
@@ -7,6 +7,8 @@
#include <gtest/gtest.h>
#include <vector>
+#include "cc/paint/paint_record.h"
+#include "cc/paint/paint_recorder.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/gfx/canvas.h"
@@ -36,8 +38,8 @@ class MockCanvas : public SkCanvas {
// Tests that a relative move to command (R_MOVE_TO) after a close command
// (CLOSE) uses the correct starting point. See crbug.com/697497
TEST(VectorIconTest, RelativeMoveToAfterClose) {
- MockCanvas mock(100, 100);
- Canvas canvas(&mock, 1.0f);
+ cc::PaintRecorder recorder;
+ Canvas canvas(recorder.beginRecording(100, 100), 1.0f);
const PathElement elements[] = {
MOVE_TO, 4, 5,
@@ -51,6 +53,11 @@ TEST(VectorIconTest, RelativeMoveToAfterClose) {
const VectorIcon icon = {elements, nullptr};
PaintVectorIcon(&canvas, icon, 100, SK_ColorMAGENTA);
+ sk_sp<cc::PaintRecord> record = recorder.finishRecordingAsPicture();
+
+ MockCanvas mock(100, 100);
+ record->playback(&mock);
+
ASSERT_EQ(1U, mock.paths().size());
SkPoint last_point;
EXPECT_TRUE(mock.paths()[0].getLastPt(&last_point));
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698