Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1312)

Side by Side Diff: tests/PictureTest.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Android fix + nit fix Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PDFPrimitivesTest.cpp ('k') | tests/TypefaceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); 1109 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID);
1110 1110
1111 // both pictures should have different ids 1111 // both pictures should have different ids
1112 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID()); 1112 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID());
1113 } 1113 }
1114 1114
1115 static void test_typeface(skiatest::Reporter* reporter) { 1115 static void test_typeface(skiatest::Reporter* reporter) {
1116 SkPictureRecorder recorder; 1116 SkPictureRecorder recorder;
1117 SkCanvas* canvas = recorder.beginRecording(10, 10); 1117 SkCanvas* canvas = recorder.beginRecording(10, 10);
1118 SkPaint paint; 1118 SkPaint paint;
1119 paint.setTypeface(SkTypeface::MakeFromName("Arial", SkTypeface::kItalic)); 1119 paint.setTypeface(SkTypeface::MakeFromName("Arial",
1120 SkFontStyle::FromOldStyle(SkTypef ace::kItalic)));
1120 canvas->drawText("Q", 1, 0, 10, paint); 1121 canvas->drawText("Q", 1, 0, 10, paint);
1121 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); 1122 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
1122 SkDynamicMemoryWStream stream; 1123 SkDynamicMemoryWStream stream;
1123 picture->serialize(&stream); 1124 picture->serialize(&stream);
1124 } 1125 }
1125 1126
1126 DEF_TEST(Picture, reporter) { 1127 DEF_TEST(Picture, reporter) {
1127 test_typeface(reporter); 1128 test_typeface(reporter);
1128 #ifdef SK_DEBUG 1129 #ifdef SK_DEBUG
1129 test_deleting_empty_picture(); 1130 test_deleting_empty_picture();
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization()); 1377 REPORTER_ASSERT(r, analyzer.suitableForGpuRasterization());
1377 1378
1378 recorder.beginRecording(10, 10)->drawPicture(vetoPicture); 1379 recorder.beginRecording(10, 10)->drawPicture(vetoPicture);
1379 sk_sp<SkPicture> nestedVetoPicture(recorder.finishRecordingAsPicture()); 1380 sk_sp<SkPicture> nestedVetoPicture(recorder.finishRecordingAsPicture());
1380 1381
1381 analyzer.analyze(nestedVetoPicture.get()); 1382 analyzer.analyze(nestedVetoPicture.get());
1382 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization()); 1383 REPORTER_ASSERT(r, !analyzer.suitableForGpuRasterization());
1383 } 1384 }
1384 1385
1385 #endif // SK_SUPPORT_GPU 1386 #endif // SK_SUPPORT_GPU
OLDNEW
« no previous file with comments | « tests/PDFPrimitivesTest.cpp ('k') | tests/TypefaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698