aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/DrawTextTest.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-05-21 16:10:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-21 21:53:54 +0000
commit1e7c65806f3fbde13b5d8064dc5734d98c32a284 (patch)
treee758fae7c14f09ba185b8aaa8f8306dad5cd4905 /tests/DrawTextTest.cpp
parent4bfb50b904e0e92d10145398eb3a6f8dd7868867 (diff)
drawPosText no longer obeys paint alignment
Change-Id: Iac498b54dea4aa1b203d2b9c58e15bb5f2147f82 Reviewed-on: https://skia-review.googlesource.com/129462 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'tests/DrawTextTest.cpp')
-rw-r--r--tests/DrawTextTest.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp
index 8dd5917326..ac13140507 100644
--- a/tests/DrawTextTest.cpp
+++ b/tests/DrawTextTest.cpp
@@ -88,29 +88,25 @@ DEF_TEST(DrawText, reporter) {
SkPoint point = SkPoint::Make(25.0f + offsetX,
25.0f + offsetY);
- for (int align = 0; align < SkPaint::kAlignCount; ++align) {
- paint.setTextAlign(static_cast<SkPaint::Align>(align));
+ for (unsigned int flags = 0; flags < (1 << 3); ++flags) {
+ static const unsigned int antiAliasFlag = 1;
+ static const unsigned int subpixelFlag = 1 << 1;
+ static const unsigned int lcdFlag = 1 << 2;
- for (unsigned int flags = 0; flags < (1 << 3); ++flags) {
- static const unsigned int antiAliasFlag = 1;
- static const unsigned int subpixelFlag = 1 << 1;
- static const unsigned int lcdFlag = 1 << 2;
+ paint.setAntiAlias(SkToBool(flags & antiAliasFlag));
+ paint.setSubpixelText(SkToBool(flags & subpixelFlag));
+ paint.setLCDRenderText(SkToBool(flags & lcdFlag));
- paint.setAntiAlias(SkToBool(flags & antiAliasFlag));
- paint.setSubpixelText(SkToBool(flags & subpixelFlag));
- paint.setLCDRenderText(SkToBool(flags & lcdFlag));
+ // Test: drawText and drawPosText draw the same.
+ drawBG(&drawTextCanvas);
+ drawTextCanvas.drawText(c, 1, point.fX, point.fY, paint);
- // Test: drawText and drawPosText draw the same.
- drawBG(&drawTextCanvas);
- drawTextCanvas.drawText(c, 1, point.fX, point.fY, paint);
+ drawBG(&drawPosTextCanvas);
+ drawPosTextCanvas.drawPosText(c, 1, &point, paint);
- drawBG(&drawPosTextCanvas);
- drawPosTextCanvas.drawPosText(c, 1, &point, paint);
-
- REPORTER_ASSERT(reporter,
- compare(drawTextBitmap, drawTextRect,
- drawPosTextBitmap, drawPosTextRect));
- }
+ REPORTER_ASSERT(reporter,
+ compare(drawTextBitmap, drawTextRect,
+ drawPosTextBitmap, drawPosTextRect));
}
}
}