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

Unified Diff: tests/DrawTextTest.cpp

Issue 2073873002: Simplify mask/clip intersection, making sure to explicitly check for an empty mask. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: revert old change Created 4 years, 6 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/SkDraw.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DrawTextTest.cpp
diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp
index f2da450fe86b14a47a2fa0d3ac777e0d0819611b..bf9bd39f8d1e7a4d4c5f78ba086ed42964d9e962 100644
--- a/tests/DrawTextTest.cpp
+++ b/tests/DrawTextTest.cpp
@@ -11,8 +11,10 @@
#include "SkPaint.h"
#include "SkPoint.h"
#include "SkRect.h"
+#include "SkSurface.h"
#include "SkTypes.h"
#include "Test.h"
+#include <math.h>
static const SkColor bgColor = SK_ColorWHITE;
@@ -111,3 +113,21 @@ DEF_TEST(DrawText, reporter) {
}
}
}
+
+// Test drawing text at some unusual coordinates.
+// We measure success by not crashing or asserting.
+DEF_TEST(DrawText_weirdCoordinates, r) {
+ auto surface = SkSurface::MakeRasterN32Premul(10,10);
+ auto canvas = surface->getCanvas();
+
+ SkScalar oddballs[] = { 0.0f, (float)INFINITY, (float)NAN, 34359738368.0f };
+
+ for (auto x : oddballs) {
+ canvas->drawText("a", 1, +x, 0.0f, SkPaint());
+ canvas->drawText("a", 1, -x, 0.0f, SkPaint());
+ }
+ for (auto y : oddballs) {
+ canvas->drawText("a", 1, 0.0f, +y, SkPaint());
+ canvas->drawText("a", 1, 0.0f, -y, SkPaint());
+ }
+}
« no previous file with comments | « src/core/SkDraw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698