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

Side by Side Diff: skia/ext/analysis_canvas_unittest.cc

Issue 492943002: AnalysisCanvas is missing an override for virtual void onClipRegion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « skia/ext/analysis_canvas.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "skia/ext/analysis_canvas.h" 6 #include "skia/ext/analysis_canvas.h"
7 #include "skia/ext/refptr.h" 7 #include "skia/ext/refptr.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/skia/include/core/SkPicture.h" 9 #include "third_party/skia/include/core/SkPicture.h"
10 #include "third_party/skia/include/core/SkPictureRecorder.h" 10 #include "third_party/skia/include/core/SkPictureRecorder.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 // Ensure that canvas is not solid. 316 // Ensure that canvas is not solid.
317 SkColor output_color; 317 SkColor output_color;
318 EXPECT_FALSE(canvas.GetColorIfSolid(&output_color)); 318 EXPECT_FALSE(canvas.GetColorIfSolid(&output_color));
319 319
320 // Verify that we aborted drawing. 320 // Verify that we aborted drawing.
321 EXPECT_TRUE(canvas.abortDrawing()); 321 EXPECT_TRUE(canvas.abortDrawing());
322 322
323 } 323 }
324 324
325 TEST(AnalysisCanvasTest, ClipComplexRegion) {
326 skia::AnalysisCanvas canvas(255, 255);
327
328 SkPath path;
329 path.moveTo(0, 0);
330 path.lineTo(128, 50);
331 path.lineTo(255, 0);
332 path.lineTo(255, 255);
333 path.lineTo(0, 255);
334 SkIRect pathBounds = path.getBounds().round();
335 SkRegion region;
336 region.setPath(path, SkRegion(pathBounds));
337
338 SkColor outputColor;
339 SolidColorFill(canvas);
340 canvas.clipRegion(region);
341 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
342
343 canvas.save();
344 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
345
346 canvas.clipRegion(region);
347 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
348
349 canvas.restore();
350 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
351
352 SolidColorFill(canvas);
353 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor));
354 }
355
325 } // namespace skia 356 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/analysis_canvas.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698