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

Side by Side Diff: tests/RecordPatternTest.cpp

Issue 794263002: Cull pushCull and popCull from Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix debugger 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 unified diff | Download patch
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "Test.h" 1 #include "Test.h"
2 2
3 #include "SkRecord.h" 3 #include "SkRecord.h"
4 #include "SkRecordPattern.h" 4 #include "SkRecordPattern.h"
5 #include "SkRecorder.h" 5 #include "SkRecorder.h"
6 #include "SkRecords.h" 6 #include "SkRecords.h"
7 7
8 using namespace SkRecords; 8 using namespace SkRecords;
9 typedef Pattern3<Is<Save>, 9 typedef Pattern3<Is<Save>,
10 Is<ClipRect>, 10 Is<ClipRect>,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 recorder.save(); 115 recorder.save();
116 recorder.clipRect(SkRect::MakeWH(300, 200)); 116 recorder.clipRect(SkRect::MakeWH(300, 200));
117 recorder.drawRect(SkRect::MakeWH(100, 3000), SkPaint()); 117 recorder.drawRect(SkRect::MakeWH(100, 3000), SkPaint());
118 recorder.restore(); 118 recorder.restore();
119 REPORTER_ASSERT(r, !pattern.match(&record, start)); 119 REPORTER_ASSERT(r, !pattern.match(&record, start));
120 end = start; 120 end = start;
121 REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end)); 121 REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end));
122 122
123 start = record.count(); 123 start = record.count();
124 recorder.save(); 124 recorder.save();
125 recorder.pushCull(SkRect::MakeWH(300, 200));
126 recorder.clipRect(SkRect::MakeWH(300, 200)); 125 recorder.clipRect(SkRect::MakeWH(300, 200));
127 recorder.clipRect(SkRect::MakeWH(100, 400)); 126 recorder.clipRect(SkRect::MakeWH(100, 400));
128 recorder.popCull();
129 recorder.restore(); 127 recorder.restore();
130 REPORTER_ASSERT(r, pattern.match(&record, start) == record.count()); 128 REPORTER_ASSERT(r, pattern.match(&record, start) == record.count());
131 end = start; 129 end = start;
132 REPORTER_ASSERT(r, pattern.search(&record, &begin, &end)); 130 REPORTER_ASSERT(r, pattern.search(&record, &begin, &end));
133 REPORTER_ASSERT(r, begin == start); 131 REPORTER_ASSERT(r, begin == start);
134 REPORTER_ASSERT(r, end == record.count()); 132 REPORTER_ASSERT(r, end == record.count());
135 133
136 REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end)); 134 REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end));
137 } 135 }
138 136
139 DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) { 137 DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) {
140 Pattern1<IsDraw> pattern; 138 Pattern1<IsDraw> pattern;
141 139
142 SkRecord record; 140 SkRecord record;
143 SkRecorder recorder(&record, 1920, 1200); 141 SkRecorder recorder(&record, 1920, 1200);
144 recorder.saveLayer(NULL, NULL); 142 recorder.saveLayer(NULL, NULL);
145 143
146 REPORTER_ASSERT(r, !pattern.match(&record, 0)); 144 REPORTER_ASSERT(r, !pattern.match(&record, 0));
147 } 145 }
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698