OLD | NEW |
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/SkShader.h" | 9 #include "third_party/skia/include/core/SkShader.h" |
10 #include "third_party/skia/include/effects/SkOffsetImageFilter.h" | 10 #include "third_party/skia/include/effects/SkOffsetImageFilter.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // Draw oval test. | 95 // Draw oval test. |
96 SolidColorFill(canvas); | 96 SolidColorFill(canvas); |
97 canvas.drawOval(SkRect::MakeWH(255, 255), paint); | 97 canvas.drawOval(SkRect::MakeWH(255, 255), paint); |
98 | 98 |
99 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor)); | 99 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor)); |
100 | 100 |
101 // Draw bitmap test. | 101 // Draw bitmap test. |
102 SolidColorFill(canvas); | 102 SolidColorFill(canvas); |
103 SkBitmap secondBitmap; | 103 SkBitmap secondBitmap; |
104 secondBitmap.setConfig(SkBitmap::kARGB_8888_Config, 255, 255); | 104 secondBitmap.allocN32Pixels(255, 255); |
105 secondBitmap.allocPixels(); | |
106 canvas.drawBitmap(secondBitmap, 0, 0); | 105 canvas.drawBitmap(secondBitmap, 0, 0); |
107 | 106 |
108 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor)); | 107 EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor)); |
109 } | 108 } |
110 | 109 |
111 TEST(AnalysisCanvasTest, SimpleDrawRect) { | 110 TEST(AnalysisCanvasTest, SimpleDrawRect) { |
112 skia::AnalysisCanvas canvas(255, 255); | 111 skia::AnalysisCanvas canvas(255, 255); |
113 | 112 |
114 SkColor color = SkColorSetARGB(255, 11, 22, 33); | 113 SkColor color = SkColorSetARGB(255, 11, 22, 33); |
115 SkPaint paint; | 114 SkPaint paint; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 canvas.drawText(text, byteLength, point.fX, point.fY, paint); | 384 canvas.drawText(text, byteLength, point.fX, point.fY, paint); |
386 // Analysis device does not do any clipping. | 385 // Analysis device does not do any clipping. |
387 // So even when text is outside the clip region, | 386 // So even when text is outside the clip region, |
388 // it is marked as having the text. | 387 // it is marked as having the text. |
389 // TODO(alokp): We may be able to do some trivial rejection. | 388 // TODO(alokp): We may be able to do some trivial rejection. |
390 EXPECT_TRUE(canvas.HasText()); | 389 EXPECT_TRUE(canvas.HasText()); |
391 } | 390 } |
392 } | 391 } |
393 | 392 |
394 } // namespace skia | 393 } // namespace skia |
OLD | NEW |