Index: tests/TextBlobTest.cpp |
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp |
index 2a74e5a2dbbd8b24076215f367b5df9faef6a98b..027fd2ac76c7aa514dda22c1043ba7d8413b92c1 100644 |
--- a/tests/TextBlobTest.cpp |
+++ b/tests/TextBlobTest.cpp |
@@ -11,7 +11,6 @@ |
#include "Test.h" |
- |
class TextBlobTester { |
public: |
// This unit test feeds an SkTextBlobBuilder various runs then checks to see if |
@@ -155,13 +154,19 @@ public: |
// don't trigger asserts (http://crbug.com/542643). |
SkPaint p; |
p.setTextSize(0); |
- p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
+ p.setTextEncoding(SkPaint::kUTF8_TextEncoding); |
const char* txt = "BOOO"; |
- const size_t len = strlen(txt); |
- const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(p, (int)len); |
- p.textToGlyphs(txt, len, buffer.glyphs); |
- memset(buffer.pos, 0, sizeof(SkScalar) * len * 2); |
+ const size_t txtLen = strlen(txt); |
+ const int glyphCount = p.textToGlyphs(txt, txtLen, nullptr); |
+ |
+ p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
+ const SkTextBlobBuilder::RunBuffer& buffer = builder.allocRunPos(p, glyphCount); |
+ |
+ p.setTextEncoding(SkPaint::kUTF8_TextEncoding); |
+ p.textToGlyphs(txt, txtLen, buffer.glyphs); |
+ |
+ memset(buffer.pos, 0, sizeof(SkScalar) * glyphCount * 2); |
SkAutoTUnref<const SkTextBlob> blob(builder.build()); |
REPORTER_ASSERT(reporter, blob->bounds().isEmpty()); |
} |