OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |