From 4b3a5152a3cdb25d1f19fd3a04b3248f4462e05e Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Tue, 17 Jul 2018 16:10:30 -0400 Subject: MakeAsDrawText for SkTextBlob Change-Id: I04ebca6b318e0654cc1e598aa323cfb9a21e5a5e Reviewed-on: https://skia-review.googlesource.com/141960 Reviewed-by: Mike Reed Reviewed-by: Cary Clark Reviewed-by: Florin Malita Commit-Queue: Herb Derby --- tests/TextBlobTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp index c94955838c..7780ef7a7f 100644 --- a/tests/TextBlobTest.cpp +++ b/tests/TextBlobTest.cpp @@ -456,3 +456,19 @@ DEF_TEST(TextBlob_serialize, reporter) { REPORTER_ASSERT(reporter, sk_tool_utils::equal_pixels(img0.get(), img1.get())); } } + +DEF_TEST(TextBlob_MakeAsDrawText, reporter) { + SkPaint paint; + paint.setTextEncoding(SkPaint::kUTF8_TextEncoding); + const char text[] = "Hello"; + auto blob = SkTextBlob::MakeAsDrawText(text, strlen(text), paint); + + int runs = 0; + for(SkTextBlobRunIterator it(blob.get()); !it.done(); it.next()) { + REPORTER_ASSERT(reporter, it.glyphCount() == strlen(text)); + REPORTER_ASSERT(reporter, it.positioning() == SkTextBlob::kFull_Positioning); + runs += 1; + } + REPORTER_ASSERT(reporter, runs == 1); + +} -- cgit v1.2.3