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

Side by Side Diff: tests/RecordPatternTest.cpp

Issue 275623002: Split Star into Star (stores nothing) and List (stores matches). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: yagni 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 unified diff | Download patch
« no previous file with comments | « src/record/SkRecordPattern.h ('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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 DEF_TEST(RecordPattern_Star, r) { 73 DEF_TEST(RecordPattern_Star, r) {
74 Pattern3<Is<Save>, Star<Is<ClipRect> >, Is<Restore> > pattern; 74 Pattern3<Is<Save>, Star<Is<ClipRect> >, Is<Restore> > pattern;
75 75
76 SkRecord record; 76 SkRecord record;
77 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200); 77 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
78 78
79 recorder.save(); 79 recorder.save();
80 recorder.restore(); 80 recorder.restore();
81 REPORTER_ASSERT(r, pattern.match(&record, 0)); 81 REPORTER_ASSERT(r, pattern.match(&record, 0));
82 REPORTER_ASSERT(r, pattern.second<SkTDArray<ClipRect*> >()->count() == 0);
83 82
84 recorder.save(); 83 recorder.save();
85 recorder.clipRect(SkRect::MakeWH(300, 200)); 84 recorder.clipRect(SkRect::MakeWH(300, 200));
86 recorder.restore(); 85 recorder.restore();
87 REPORTER_ASSERT(r, pattern.match(&record, 2)); 86 REPORTER_ASSERT(r, pattern.match(&record, 2));
88 REPORTER_ASSERT(r, pattern.second<SkTDArray<ClipRect*> >()->count() == 1);
89 87
90 recorder.save(); 88 recorder.save();
91 recorder.clipRect(SkRect::MakeWH(300, 200)); 89 recorder.clipRect(SkRect::MakeWH(300, 200));
92 recorder.clipRect(SkRect::MakeWH(100, 100)); 90 recorder.clipRect(SkRect::MakeWH(100, 100));
93 recorder.restore(); 91 recorder.restore();
94 REPORTER_ASSERT(r, pattern.match(&record, 5)); 92 REPORTER_ASSERT(r, pattern.match(&record, 5));
95 REPORTER_ASSERT(r, pattern.second<SkTDArray<ClipRect*> >()->count() == 2);
96 } 93 }
97 94
98 DEF_TEST(RecordPattern_IsDraw, r) { 95 DEF_TEST(RecordPattern_IsDraw, r) {
99 Pattern3<Is<Save>, IsDraw, Is<Restore> > pattern; 96 Pattern3<Is<Save>, IsDraw, Is<Restore> > pattern;
100 97
101 SkRecord record; 98 SkRecord record;
102 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200); 99 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
103 100
104 recorder.save(); 101 recorder.save();
105 recorder.clipRect(SkRect::MakeWH(300, 200)); 102 recorder.clipRect(SkRect::MakeWH(300, 200));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 190
194 DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) { 191 DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) {
195 Pattern1<IsDraw> pattern; 192 Pattern1<IsDraw> pattern;
196 193
197 SkRecord record; 194 SkRecord record;
198 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200); 195 SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, 1920, 1200);
199 recorder.saveLayer(NULL, NULL); 196 recorder.saveLayer(NULL, NULL);
200 197
201 REPORTER_ASSERT(r, !pattern.match(&record, 0)); 198 REPORTER_ASSERT(r, !pattern.match(&record, 0));
202 } 199 }
OLDNEW
« no previous file with comments | « src/record/SkRecordPattern.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698