OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 }; | 49 }; |
50 | 50 |
51 // Basic tests for the low-level SkRecord code. | 51 // Basic tests for the low-level SkRecord code. |
52 DEF_TEST(Record, r) { | 52 DEF_TEST(Record, r) { |
53 SkRecord record; | 53 SkRecord record; |
54 | 54 |
55 // Add a simple DrawRect command. | 55 // Add a simple DrawRect command. |
56 SkRect rect = SkRect::MakeWH(10, 10); | 56 SkRect rect = SkRect::MakeWH(10, 10); |
57 SkPaint paint; | 57 SkPaint paint; |
58 SkNEW_PLACEMENT_ARGS(record.append<SkRecords::DrawRect>(), SkRecords::DrawRe
ct, (rect, paint)); | 58 SkNEW_PLACEMENT_ARGS(record.append<SkRecords::DrawRect>(), SkRecords::DrawRe
ct, (paint, rect)); |
59 | 59 |
60 // Its area should be 100. | 60 // Its area should be 100. |
61 AreaSummer summer; | 61 AreaSummer summer; |
62 summer.apply(record); | 62 summer.apply(record); |
63 REPORTER_ASSERT(r, summer.area() == 100); | 63 REPORTER_ASSERT(r, summer.area() == 100); |
64 | 64 |
65 // Scale 2x. | 65 // Scale 2x. |
66 Stretch stretch; | 66 Stretch stretch; |
67 stretch.apply(&record); | 67 stretch.apply(&record); |
68 | 68 |
69 // Now its area should be 100 + 400. | 69 // Now its area should be 100 + 400. |
70 summer.apply(record); | 70 summer.apply(record); |
71 REPORTER_ASSERT(r, summer.area() == 500); | 71 REPORTER_ASSERT(r, summer.area() == 500); |
72 } | 72 } |
OLD | NEW |