OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 | 9 |
10 #include "SkRecord.h" | 10 #include "SkRecord.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Build up a save-clip-restore block. The pattern will match only it's com
plete. | 29 // Build up a save-clip-restore block. The pattern will match only it's com
plete. |
30 recorder.save(); | 30 recorder.save(); |
31 REPORTER_ASSERT(r, !pattern.match(&record, 0)); | 31 REPORTER_ASSERT(r, !pattern.match(&record, 0)); |
32 | 32 |
33 recorder.clipRect(SkRect::MakeWH(300, 200)); | 33 recorder.clipRect(SkRect::MakeWH(300, 200)); |
34 REPORTER_ASSERT(r, !pattern.match(&record, 0)); | 34 REPORTER_ASSERT(r, !pattern.match(&record, 0)); |
35 | 35 |
36 recorder.restore(); | 36 recorder.restore(); |
37 REPORTER_ASSERT(r, pattern.match(&record, 0)); | 37 REPORTER_ASSERT(r, pattern.match(&record, 0)); |
38 REPORTER_ASSERT(r, pattern.first<Save>() != NULL); | 38 REPORTER_ASSERT(r, pattern.first<Save>() != nullptr); |
39 REPORTER_ASSERT(r, pattern.second<ClipRect>() != NULL); | 39 REPORTER_ASSERT(r, pattern.second<ClipRect>() != nullptr); |
40 REPORTER_ASSERT(r, pattern.third<Restore>() != NULL); | 40 REPORTER_ASSERT(r, pattern.third<Restore>() != nullptr); |
41 } | 41 } |
42 | 42 |
43 DEF_TEST(RecordPattern_StartingIndex, r) { | 43 DEF_TEST(RecordPattern_StartingIndex, r) { |
44 SaveClipRectRestore pattern; | 44 SaveClipRectRestore pattern; |
45 | 45 |
46 SkRecord record; | 46 SkRecord record; |
47 SkRecorder recorder(&record, 1920, 1200); | 47 SkRecorder recorder(&record, 1920, 1200); |
48 | 48 |
49 // There will be two save-clipRect-restore blocks [0,3) and [3,6). | 49 // There will be two save-clipRect-restore blocks [0,3) and [3,6). |
50 for (int i = 0; i < 2; i++) { | 50 for (int i = 0; i < 2; i++) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 REPORTER_ASSERT(r, end == record.count()); | 139 REPORTER_ASSERT(r, end == record.count()); |
140 | 140 |
141 REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end)); | 141 REPORTER_ASSERT(r, !pattern.search(&record, &begin, &end)); |
142 } | 142 } |
143 | 143 |
144 DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) { | 144 DEF_TEST(RecordPattern_SaveLayerIsNotADraw, r) { |
145 Pattern1<IsDraw> pattern; | 145 Pattern1<IsDraw> pattern; |
146 | 146 |
147 SkRecord record; | 147 SkRecord record; |
148 SkRecorder recorder(&record, 1920, 1200); | 148 SkRecorder recorder(&record, 1920, 1200); |
149 recorder.saveLayer(NULL, NULL); | 149 recorder.saveLayer(nullptr, nullptr); |
150 | 150 |
151 REPORTER_ASSERT(r, !pattern.match(&record, 0)); | 151 REPORTER_ASSERT(r, !pattern.match(&record, 0)); |
152 } | 152 } |
OLD | NEW |