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

Unified Diff: tests/RecordDrawTest.cpp

Issue 798593003: Revert of Defer saves() until they're needed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « tests/PictureBBHTest.cpp ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RecordDrawTest.cpp
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index e830af4b430e6582658ffcd6f0db2fdd7042bb05..2d9e90d48b4a4d5927bef87aa4a276c6fea13c96 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -30,33 +30,6 @@
int fCalls;
};
-DEF_TEST(RecordDraw_LazySaves, r) {
- // Record two commands.
- SkRecord record;
- SkRecorder recorder(&record, W, H);
-
- REPORTER_ASSERT(r, 0 == record.count());
- recorder.save();
- REPORTER_ASSERT(r, 0 == record.count()); // the save was not recorded (yet)
- recorder.drawColor(SK_ColorRED);
- REPORTER_ASSERT(r, 1 == record.count());
- recorder.scale(2, 2);
- REPORTER_ASSERT(r, 3 == record.count()); // now we see the save
- recorder.restore();
- REPORTER_ASSERT(r, 4 == record.count());
-
- assert_type<SkRecords::DrawPaint>(r, record, 0);
- assert_type<SkRecords::Save> (r, record, 1);
- assert_type<SkRecords::SetMatrix>(r, record, 2);
- assert_type<SkRecords::Restore> (r, record, 3);
-
- recorder.save();
- recorder.save();
- recorder.restore();
- recorder.restore();
- REPORTER_ASSERT(r, 4 == record.count());
-}
-
DEF_TEST(RecordDraw_Abort, r) {
// Record two commands.
SkRecord record;
@@ -70,23 +43,26 @@
JustOneDraw callback;
SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL/*bbh*/, &callback);
- REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord));
- REPORTER_ASSERT(r, 0 == count_instances_of_type<SkRecords::ClipRect>(rerecord));
+ REPORTER_ASSERT(r, 3 == rerecord.count());
+ assert_type<SkRecords::Save> (r, rerecord, 0);
+ assert_type<SkRecords::DrawRect>(r, rerecord, 1);
+ assert_type<SkRecords::Restore> (r, rerecord, 2);
}
DEF_TEST(RecordDraw_Unbalanced, r) {
SkRecord record;
SkRecorder recorder(&record, W, H);
recorder.save(); // We won't balance this, but SkRecordDraw will for us.
- recorder.scale(2, 2);
SkRecord rerecord;
SkRecorder canvas(&rerecord, W, H);
SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL/*bbh*/, NULL/*callback*/);
- int save_count = count_instances_of_type<SkRecords::Save>(rerecord);
- int restore_count = count_instances_of_type<SkRecords::Save>(rerecord);
- REPORTER_ASSERT(r, save_count == restore_count);
+ REPORTER_ASSERT(r, 4 == rerecord.count());
+ assert_type<SkRecords::Save> (r, rerecord, 0);
+ assert_type<SkRecords::Save> (r, rerecord, 1);
+ assert_type<SkRecords::Restore> (r, rerecord, 2);
+ assert_type<SkRecords::Restore> (r, rerecord, 3);
}
DEF_TEST(RecordDraw_SetMatrixClobber, r) {
@@ -217,9 +193,12 @@
SkRecorder canvas(&rerecord, kWidth, kHeight);
SkRecordPartialDraw(record, &canvas, NULL, 0, 1, 2, SkMatrix::I()); // replay just drawRect of r2
- REPORTER_ASSERT(r, 1 == count_instances_of_type<SkRecords::DrawRect>(rerecord));
- int index = find_first_instances_of_type<SkRecords::DrawRect>(rerecord);
- const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, rerecord, index);
+ REPORTER_ASSERT(r, 3 == rerecord.count());
+ assert_type<SkRecords::Save> (r, rerecord, 0);
+ assert_type<SkRecords::DrawRect> (r, rerecord, 1);
+ assert_type<SkRecords::Restore> (r, rerecord, 2);
+
+ const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, rerecord, 1);
REPORTER_ASSERT(r, drawRect->rect == r2);
}
« no previous file with comments | « tests/PictureBBHTest.cpp ('k') | tests/RecordOptsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698