aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-17 16:10:30 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-17 22:16:41 +0000
commit4b3a5152a3cdb25d1f19fd3a04b3248f4462e05e (patch)
tree38fb823b6cc5e249aa468ff0ce697f5c7dfa45e4 /tests
parent0f5cfab7cb7673d0ed5d6300ac94bc8374fc4e6e (diff)
MakeAsDrawText for SkTextBlob
Change-Id: I04ebca6b318e0654cc1e598aa323cfb9a21e5a5e Reviewed-on: https://skia-review.googlesource.com/141960 Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/TextBlobTest.cpp16
1 files changed, 16 insertions, 0 deletions
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);
+
+}