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

Unified Diff: tests/RecordOptsTest.cpp

Issue 273643007: Convert all SkRecordPattern matchers into SkRecord mutators. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dumper too Created 6 years, 7 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/record/SkRecordPattern.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecordOptsTest.cpp
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index 33142c8a3d587f50a5419db045431520bf347bd4..c427c25119a08f93ac16f4f0c1346295c66a2d00 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -19,26 +19,25 @@ static const int W = 1920, H = 1080;
// If the command we're reading is a U, set ptr to it, otherwise set it to NULL.
template <typename U>
struct ReadAs {
- explicit ReadAs(const U** ptr) : ptr(ptr), type(SkRecords::Type(~0)) {}
+ ReadAs() : ptr(NULL), type(SkRecords::Type(~0)) {}
- const U** ptr;
+ const U* ptr;
SkRecords::Type type;
- void operator()(const U& r) { *ptr = &r; type = U::kType; }
+ void operator()(const U& r) { ptr = &r; type = U::kType; }
template <typename T>
- void operator()(const T&) { *ptr = NULL; type = U::kType; }
+ void operator()(const T&) { type = U::kType; }
};
// Assert that the ith command in record is of type T, and return it.
template <typename T>
static const T* assert_type(skiatest::Reporter* r, const SkRecord& record, unsigned index) {
- const T* ptr = NULL;
- ReadAs<T> reader(&ptr);
- record.visit(index, reader);
+ ReadAs<T> reader;
+ record.visit<void>(index, reader);
REPORTER_ASSERT(r, T::kType == reader.type);
- REPORTER_ASSERT(r, ptr != NULL);
- return ptr;
+ REPORTER_ASSERT(r, NULL != reader.ptr);
+ return reader.ptr;
}
DEF_TEST(RecordOpts_Culling, r) {
« no previous file with comments | « src/record/SkRecordPattern.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698