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

Unified Diff: tests/PaintTest.cpp

Issue 239393002: remove legacy filter-flags, and store FilterLevel directly (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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
« src/core/SkPaint.cpp ('K') | « 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 c41e23ac54630e5844710f6427a7a8c1671bb208..70084e7d498f2953d0bfe37c7b6710304806c6ce 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -228,6 +228,43 @@ DEF_TEST(Paint_regression_cubic, reporter) {
REPORTER_ASSERT(reporter, maxR.contains(strokeR));
}
+static void test_filter_flags(skiatest::Reporter* reporter) {
+ const SkPaint::FilterLevel levels[] = {
+ SkPaint::kNone_FilterLevel,
+ SkPaint::kLow_FilterLevel,
+ SkPaint::kMedium_FilterLevel,
+ SkPaint::kHigh_FilterLevel,
+ };
+
+ const SkPaint::Hinting hinting[] = {
+ SkPaint::kNo_Hinting,
+ SkPaint::kSlight_Hinting,
+ SkPaint::kNormal_Hinting,
+ SkPaint::kFull_Hinting,
+ };
+
+ for (size_t i = 0; i < SK_ARRAY_COUNT(levels); ++i) {
+ for (size_t j = 0; j < SK_ARRAY_COUNT(hinting); ++j) {
+ SkPaint paint;
+ paint.setFilterLevel(levels[i]);
+ paint.setHinting(hinting[j]);
+ REPORTER_ASSERT(reporter, paint.getFilterLevel() == levels[i]);
+ REPORTER_ASSERT(reporter, paint.getHinting() == hinting[j]);
+
+ SkWriteBuffer writer;
+ paint.flatten(writer);
+
+ const uint32_t* written = writer.getWriter32()->contiguousArray();
+ SkReadBuffer reader(written, writer.bytesWritten());
+
+ SkPaint paint2;
+ paint2.unflatten(reader);
+ REPORTER_ASSERT(reporter, paint2.getFilterLevel() == levels[i]);
+ REPORTER_ASSERT(reporter, paint2.getHinting() == hinting[j]);
+ }
+ }
+}
+
// found and fixed for android: not initializing rect for string's of length 0
DEF_TEST(Paint_regression_measureText, reporter) {
@@ -277,4 +314,6 @@ DEF_TEST(Paint_FlatteningTraits, r) {
ASSERT(other.getXfermode()->asMode(&otherMode));
ASSERT(paint.getXfermode()->asMode(&paintMode));
ASSERT(otherMode == paintMode);
+
+ test_filter_flags(r);
}
« src/core/SkPaint.cpp ('K') | « src/core/SkPaint.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698