| 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 #include "RecordTestUtils.h" | 9 #include "RecordTestUtils.h" |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const SkPoint pos[] = { {40, 50}, {60, 70} }; | 159 const SkPoint pos[] = { {40, 50}, {60, 70} }; |
| 160 recorder.drawPosText(text, bytes, pos, SkPaint()); | 160 recorder.drawPosText(text, bytes, pos, SkPaint()); |
| 161 | 161 |
| 162 TestBBH bbh; | 162 TestBBH bbh; |
| 163 SkRecordFillBounds(record, &bbh); | 163 SkRecordFillBounds(record, &bbh); |
| 164 REPORTER_ASSERT(r, bbh.fEntries.count() == 2); | 164 REPORTER_ASSERT(r, bbh.fEntries.count() == 2); |
| 165 | 165 |
| 166 // We can make these next assertions confidently because SkRecordFillBounds | 166 // We can make these next assertions confidently because SkRecordFillBounds |
| 167 // builds its bounds by overestimating font metrics in a platform-independen
t way. | 167 // builds its bounds by overestimating font metrics in a platform-independen
t way. |
| 168 // If that changes, these tests will need to be more flexible. | 168 // If that changes, these tests will need to be more flexible. |
| 169 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(-
86, 6, 116, 54))); | 169 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[0].bounds, SkRect::MakeLTRB(-
110, 0, 140, 60))); |
| 170 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(-
56, 26, 156, 94))); | 170 REPORTER_ASSERT(r, sloppy_rect_eq(bbh.fEntries[1].bounds, SkRect::MakeLTRB(-
80, 20, 180, 100))); |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Base test to ensure start/stop range is respected | 173 // Base test to ensure start/stop range is respected |
| 174 DEF_TEST(RecordDraw_PartialStartStop, r) { | 174 DEF_TEST(RecordDraw_PartialStartStop, r) { |
| 175 static const int kWidth = 10, kHeight = 10; | 175 static const int kWidth = 10, kHeight = 10; |
| 176 | 176 |
| 177 SkRect r1 = { 0, 0, kWidth, kHeight }; | 177 SkRect r1 = { 0, 0, kWidth, kHeight }; |
| 178 SkRect r2 = { 0, 0, kWidth, kHeight/2 }; | 178 SkRect r2 = { 0, 0, kWidth, kHeight/2 }; |
| 179 SkRect r3 = { 0, 0, kWidth/2, kHeight }; | 179 SkRect r3 = { 0, 0, kWidth/2, kHeight }; |
| 180 SkPaint p; | 180 SkPaint p; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 { | 302 { |
| 303 SkRecord record; | 303 SkRecord record; |
| 304 SkRecorder recorder(&record, 10, 10); | 304 SkRecorder recorder(&record, 10, 10); |
| 305 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); | 305 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); |
| 306 SkRecordDraw(record, &canvas, 0, 0); | 306 SkRecordDraw(record, &canvas, 0, 0); |
| 307 } | 307 } |
| 308 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 308 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
| 309 | 309 |
| 310 } | 310 } |
| OLD | NEW |