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

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

Issue 13863015: Add flag for drawing layers to screen with Ganesh (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « skia/ext/analysis_canvas.cc ('k') | ui/gfx/skia_util.h » ('j') | 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 "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/skia/include/core/SkShader.h" 8 #include "third_party/skia/include/core/SkShader.h"
9 9
10 namespace { 10 namespace {
11 11
12 void solidColorFill(skia::AnalysisCanvas& canvas) { 12 void solidColorFill(skia::AnalysisCanvas& canvas) {
13 canvas.clear(SkColorSetARGB(255, 255, 255, 255)); 13 canvas.clear(SkColorSetARGB(255, 255, 255, 255));
14 } 14 }
15 15
16 void transparentFill(skia::AnalysisCanvas& canvas) { 16 void transparentFill(skia::AnalysisCanvas& canvas) {
17 canvas.clear(SkColorSetARGB(0, 0, 0, 0)); 17 canvas.clear(SkColorSetARGB(0, 0, 0, 0));
18 } 18 }
19 19
20 } // namespace 20 } // namespace
21 namespace skia { 21 namespace skia {
22 22
23 TEST(AnalysisCanvasTest, EmptyCanvas) { 23 TEST(AnalysisCanvasTest, EmptyCanvas) {
24 SkBitmap emptyBitmap; 24 SkBitmap emptyBitmap;
25 emptyBitmap.setConfig(SkBitmap::kNo_Config, 255, 255); 25 emptyBitmap.setConfig(SkBitmap::kNo_Config, 255, 255);
26 skia::AnalysisDevice device(emptyBitmap); 26 skia::AnalysisDevice device(emptyBitmap);
27 skia::AnalysisCanvas canvas(&device); 27 skia::AnalysisCanvas canvas(&device);
28 28
29 SkColor color; 29 SkColor color;
30 EXPECT_FALSE(canvas.getColorIfSolid(&color)); 30 EXPECT_TRUE(canvas.getColorIfSolid(&color));
31 EXPECT_EQ(color, SkColorSetARGB(0, 0, 0, 0));
31 } 32 }
32 33
33 TEST(AnalysisCanvasTest, ClearCanvas) { 34 TEST(AnalysisCanvasTest, ClearCanvas) {
34 SkBitmap emptyBitmap; 35 SkBitmap emptyBitmap;
35 emptyBitmap.setConfig(SkBitmap::kNo_Config, 255, 255); 36 emptyBitmap.setConfig(SkBitmap::kNo_Config, 255, 255);
36 skia::AnalysisDevice device(emptyBitmap); 37 skia::AnalysisDevice device(emptyBitmap);
37 skia::AnalysisCanvas canvas(&device); 38 skia::AnalysisCanvas canvas(&device);
38 39
39 // Transparent color 40 // Transparent color
40 SkColor color = SkColorSetARGB(0, 12, 34, 56); 41 SkColor color = SkColorSetARGB(0, 12, 34, 56);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 canvas.drawText(text, byteLength, point.fX, point.fY, paint); 397 canvas.drawText(text, byteLength, point.fX, point.fY, paint);
397 // Analysis device does not do any clipping. 398 // Analysis device does not do any clipping.
398 // So even when text is outside the clip region, 399 // So even when text is outside the clip region,
399 // it is marked as having the text. 400 // it is marked as having the text.
400 // TODO(alokp): We may be able to do some trivial rejection. 401 // TODO(alokp): We may be able to do some trivial rejection.
401 EXPECT_TRUE(canvas.hasText()); 402 EXPECT_TRUE(canvas.hasText());
402 } 403 }
403 } 404 }
404 405
405 } // namespace skia 406 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/analysis_canvas.cc ('k') | ui/gfx/skia_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698