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

Side by Side Diff: tests/PictureTest.cpp

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
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 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID); 1170 REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID);
1171 1171
1172 // both pictures should have different ids 1172 // both pictures should have different ids
1173 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID()); 1173 REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID());
1174 } 1174 }
1175 1175
1176 static void test_typeface(skiatest::Reporter* reporter) { 1176 static void test_typeface(skiatest::Reporter* reporter) {
1177 SkPictureRecorder recorder; 1177 SkPictureRecorder recorder;
1178 SkCanvas* canvas = recorder.beginRecording(10, 10); 1178 SkCanvas* canvas = recorder.beginRecording(10, 10);
1179 SkPaint paint; 1179 SkPaint paint;
1180 paint.setTypeface(SkTypeface::MakeFromName("Arial", SkTypeface::kItalic)); 1180 paint.setTypeface(SkTypeface::CreateFromName("Arial", SkTypeface::kItalic));
1181 canvas->drawText("Q", 1, 0, 10, paint); 1181 canvas->drawText("Q", 1, 0, 10, paint);
1182 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); 1182 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
1183 REPORTER_ASSERT(reporter, picture->hasText()); 1183 REPORTER_ASSERT(reporter, picture->hasText());
1184 SkDynamicMemoryWStream stream; 1184 SkDynamicMemoryWStream stream;
1185 picture->serialize(&stream); 1185 picture->serialize(&stream);
1186 } 1186 }
1187 1187
1188 DEF_TEST(Picture, reporter) { 1188 DEF_TEST(Picture, reporter) {
1189 test_typeface(reporter); 1189 test_typeface(reporter);
1190 #ifdef SK_DEBUG 1190 #ifdef SK_DEBUG
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 1404
1405 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); 1405 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
1406 sk_sp<SkPicture> deserializedPicture(SkPicture::MakeFromStream(rstream)); 1406 sk_sp<SkPicture> deserializedPicture(SkPicture::MakeFromStream(rstream));
1407 1407
1408 REPORTER_ASSERT(r, deserializedPicture != nullptr); 1408 REPORTER_ASSERT(r, deserializedPicture != nullptr);
1409 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); 1409 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1);
1410 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); 1410 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2);
1411 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); 1411 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3);
1412 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); 1412 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4);
1413 } 1413 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698