OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 SkCanvas* canvas = recorder.beginRecording(1, 1); | 1144 SkCanvas* canvas = recorder.beginRecording(1, 1); |
1145 canvas->drawARGB(255, 255, 255, 255); | 1145 canvas->drawARGB(255, 255, 255, 255); |
1146 SkAutoTUnref<SkPicture> hasData(recorder.endRecording()); | 1146 SkAutoTUnref<SkPicture> hasData(recorder.endRecording()); |
1147 // picture should have a non-zero id after recording | 1147 // picture should have a non-zero id after recording |
1148 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); | 1148 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); |
1149 | 1149 |
1150 // both pictures should have different ids | 1150 // both pictures should have different ids |
1151 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID()); | 1151 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID()); |
1152 } | 1152 } |
1153 | 1153 |
| 1154 static void test_typeface(skiatest::Reporter* reporter) { |
| 1155 SkPictureRecorder recorder; |
| 1156 SkCanvas* canvas = recorder.beginRecording(10, 10); |
| 1157 SkPaint paint; |
| 1158 paint.setTypeface(SkTypeface::CreateFromName("Arial", SkTypeface::kItalic)); |
| 1159 canvas->drawText("Q", 1, 0, 10, paint); |
| 1160 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 1161 REPORTER_ASSERT(reporter, picture->hasText()); |
| 1162 SkDynamicMemoryWStream stream; |
| 1163 picture->serialize(&stream); |
| 1164 } |
| 1165 |
1154 DEF_TEST(Picture, reporter) { | 1166 DEF_TEST(Picture, reporter) { |
| 1167 test_typeface(reporter); |
1155 #ifdef SK_DEBUG | 1168 #ifdef SK_DEBUG |
1156 test_deleting_empty_picture(); | 1169 test_deleting_empty_picture(); |
1157 test_serializing_empty_picture(); | 1170 test_serializing_empty_picture(); |
1158 #else | 1171 #else |
1159 test_bad_bitmap(); | 1172 test_bad_bitmap(); |
1160 #endif | 1173 #endif |
1161 test_unbalanced_save_restores(reporter); | 1174 test_unbalanced_save_restores(reporter); |
1162 test_peephole(); | 1175 test_peephole(); |
1163 #if SK_SUPPORT_GPU | 1176 #if SK_SUPPORT_GPU |
1164 test_gpu_veto(reporter); | 1177 test_gpu_veto(reporter); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1383 |
1371 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); | 1384 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); |
1372 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); | 1385 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); |
1373 | 1386 |
1374 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); | 1387 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); |
1375 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); | 1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); |
1376 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); | 1389 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); |
1377 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); | 1390 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); |
1378 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); | 1391 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); |
1379 } | 1392 } |
OLD | NEW |