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

Unified Diff: tests/RecordOptsTest.cpp

Issue 560163002: Fix a bug in Save-Restore no-op optimization. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: d Created 6 years, 3 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/SkRecordPattern.h ('k') | no next file » | 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 dca948219702fc3210eaeeb7ef56e6b93303c9d1..e17b5e6bfa2a3fd4597b59fff19382912025f902 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -99,6 +99,23 @@ DEF_TEST(RecordOpts_NoopSaveRestores, r) {
}
}
+DEF_TEST(RecordOpts_SaveSaveLayerRestoreRestore, r) {
+ SkRecord record;
+ SkRecorder recorder(&record, W, H);
+
+ // A previous bug NoOp'd away the first 3 commands.
+ recorder.save();
+ recorder.saveLayer(NULL, NULL);
+ recorder.restore();
+ recorder.restore();
+
+ SkRecordNoopSaveRestores(&record);
+ assert_type<SkRecords::Save> (r, record, 0);
+ assert_type<SkRecords::SaveLayer>(r, record, 1);
+ assert_type<SkRecords::Restore> (r, record, 2);
+ assert_type<SkRecords::Restore> (r, record, 3);
+}
+
static void assert_savelayer_restore(skiatest::Reporter* r,
SkRecord* record,
unsigned i,
« no previous file with comments | « src/core/SkRecordPattern.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698