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

Unified Diff: tests/PictureTest.cpp

Issue 494683003: Implement SkPicture::hasText() for SkRecord backend. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: always fill fHasText 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRecords.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index e9b38d20a9363428708ad1027fc7576b26a4378a..6a93a9dd1bd1ab0415b74119aad0f3b1f3c16cdc 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -988,61 +988,62 @@ static void test_gpu_picture_optimization(skiatest::Reporter* reporter,
#endif
-static void test_has_text(skiatest::Reporter* reporter) {
+static void test_has_text(skiatest::Reporter* reporter, bool useNewPath) {
SkPictureRecorder recorder;
- SkPaint paint;
- paint.setColor(SK_ColorBLUE);
- SkPoint point = SkPoint::Make(10, 10);
+#define BEGIN_RECORDING useNewPath ? recorder.EXPERIMENTAL_beginRecording(100, 100) \
+ : recorder. beginRecording(100, 100)
- SkCanvas* canvas = recorder.beginRecording(100, 100);
+ SkCanvas* canvas = BEGIN_RECORDING;
{
- canvas->drawRect(SkRect::MakeWH(20, 20), paint);
+ canvas->drawRect(SkRect::MakeWH(20, 20), SkPaint());
}
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
REPORTER_ASSERT(reporter, !picture->hasText());
- canvas = recorder.beginRecording(100, 100);
+ SkPoint point = SkPoint::Make(10, 10);
+ canvas = BEGIN_RECORDING;
{
- canvas->drawText("Q", 1, point.fX, point.fY, paint);
+ canvas->drawText("Q", 1, point.fX, point.fY, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = recorder.beginRecording(100, 100);
+ canvas = BEGIN_RECORDING;
{
- canvas->drawPosText("Q", 1, &point, paint);
+ canvas->drawPosText("Q", 1, &point, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = recorder.beginRecording(100, 100);
+ canvas = BEGIN_RECORDING;
{
- canvas->drawPosTextH("Q", 1, &point.fX, point.fY, paint);
+ canvas->drawPosTextH("Q", 1, &point.fX, point.fY, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = recorder.beginRecording(100, 100);
+ canvas = BEGIN_RECORDING;
{
SkPath path;
path.moveTo(0, 0);
path.lineTo(50, 50);
- canvas->drawTextOnPathHV("Q", 1, path, point.fX, point.fY, paint);
+ canvas->drawTextOnPathHV("Q", 1, path, point.fX, point.fY, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
- canvas = recorder.beginRecording(100, 100);
+ canvas = BEGIN_RECORDING;
{
SkPath path;
path.moveTo(0, 0);
path.lineTo(50, 50);
- canvas->drawTextOnPath("Q", 1, path, NULL, paint);
+ canvas->drawTextOnPath("Q", 1, path, NULL, SkPaint());
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->hasText());
+#undef BEGIN_RECORDING
}
static void set_canvas_to_save_count_4(SkCanvas* canvas) {
@@ -1688,7 +1689,8 @@ DEF_TEST(Picture, reporter) {
test_gpu_veto(reporter, false);
test_gpu_veto(reporter, true);
#endif
- test_has_text(reporter);
+ test_has_text(reporter, false);
+ test_has_text(reporter, true);
test_analysis(reporter, false);
test_analysis(reporter, true);
test_gatherpixelrefs(reporter);
« no previous file with comments | « src/core/SkRecords.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698