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

Unified Diff: tests/PaintTest.cpp

Issue 12387092: Initialize bounds even if the text length is zero. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 10 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/SkPaint.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PaintTest.cpp
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index ed790764ab15b06b99dfad254e5b2ed9df41d3a1..a30c21a593f75d96d9dbce34fa81aca33ccca7ec 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -97,12 +97,32 @@ static void regression_cubic(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, maxR.contains(strokeR));
}
+// found and fixed for android: not initializing rect for string's of length 0
+static void regression_measureText(skiatest::Reporter* reporter) {
+
+ SkPaint paint;
+ paint.setTextSize(SkFloatToScalar(12.0f));
+
+ SkRect r;
+
+ // test that the rect was initialized
reed1 2013/03/04 19:11:47 Might get lucky if 'r' is already empty. Should we
djsollen 2013/03/04 19:47:04 Done.
+ paint.measureText("", 0, &r, SkFloatToScalar(1.0f));
+ REPORTER_ASSERT(reporter, r.isEmpty());
+
+ r.isetWH(10, 10);
+
+ // test that our rect was reset
+ paint.measureText("", 0, &r, SkFloatToScalar(1.0f));
+ REPORTER_ASSERT(reporter, r.isEmpty());
+}
+
static void TestPaint(skiatest::Reporter* reporter) {
// TODO add general paint tests
test_copy(reporter);
// regression tests
regression_cubic(reporter);
+ regression_measureText(reporter);
}
#include "TestClassDef.h"
« no previous file with comments | « src/core/SkPaint.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698