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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 1916093002: SkDocument/PDF: new API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-26 (Tuesday) 15:55:33 EDT 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
« no previous file with comments | « tests/PDFOpaqueSrcModeToSrcOverTest.cpp ('k') | tests/Test.h » ('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 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
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 "Resources.h" 8 #include "Resources.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 REPORTER_ASSERT(reporter, stub.get() == substituteMap.getSubstitute(proxy.ge t())); 172 REPORTER_ASSERT(reporter, stub.get() == substituteMap.getSubstitute(proxy.ge t()));
173 REPORTER_ASSERT(reporter, proxy.get() != substituteMap.getSubstitute(stub.ge t())); 173 REPORTER_ASSERT(reporter, proxy.get() != substituteMap.getSubstitute(stub.ge t()));
174 } 174 }
175 175
176 // This test used to assert without the fix submitted for 176 // This test used to assert without the fix submitted for
177 // http://code.google.com/p/skia/issues/detail?id=1083. 177 // http://code.google.com/p/skia/issues/detail?id=1083.
178 // SKP files might have invalid glyph ids. This test ensures they are ignored, 178 // SKP files might have invalid glyph ids. This test ensures they are ignored,
179 // and there is no assert on input data in Debug mode. 179 // and there is no assert on input data in Debug mode.
180 static void test_issue1083() { 180 static void test_issue1083() {
181 SkDynamicMemoryWStream outStream; 181 SkDynamicMemoryWStream outStream;
182 sk_sp<SkDocument> doc(SkDocument::CreatePDF(&outStream)); 182 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream));
183 SkCanvas* canvas = doc->beginPage(100.0f, 100.0f); 183 SkCanvas* canvas = doc->beginPage(100.0f, 100.0f);
184 SkPaint paint; 184 SkPaint paint;
185 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 185 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
186 186
187 uint16_t glyphID = 65000; 187 uint16_t glyphID = 65000;
188 canvas->drawText(&glyphID, 2, 0, 0, paint); 188 canvas->drawText(&glyphID, 2, 0, 0, paint);
189 189
190 doc->close(); 190 doc->close();
191 } 191 }
192 192
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 str->append(")"); 401 str->append(")");
402 } 402 }
403 #endif 403 #endif
404 404
405 }; 405 };
406 406
407 // Check that PDF rendering of image filters successfully falls back to 407 // Check that PDF rendering of image filters successfully falls back to
408 // CPU rasterization. 408 // CPU rasterization.
409 DEF_TEST(PDFImageFilter, reporter) { 409 DEF_TEST(PDFImageFilter, reporter) {
410 SkDynamicMemoryWStream stream; 410 SkDynamicMemoryWStream stream;
411 sk_sp<SkDocument> doc(SkDocument::CreatePDF(&stream)); 411 sk_sp<SkDocument> doc(SkDocument::MakePDF(&stream));
412 SkCanvas* canvas = doc->beginPage(100.0f, 100.0f); 412 SkCanvas* canvas = doc->beginPage(100.0f, 100.0f);
413 413
414 sk_sp<DummyImageFilter> filter(DummyImageFilter::Make()); 414 sk_sp<DummyImageFilter> filter(DummyImageFilter::Make());
415 415
416 // Filter just created; should be unvisited. 416 // Filter just created; should be unvisited.
417 REPORTER_ASSERT(reporter, !filter->visited()); 417 REPORTER_ASSERT(reporter, !filter->visited());
418 SkPaint paint; 418 SkPaint paint;
419 paint.setImageFilter(filter.get()); 419 paint.setImageFilter(filter.get());
420 canvas->drawRect(SkRect::MakeWH(100, 100), paint); 420 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
421 doc->close(); 421 doc->close();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 float alwaysCheck[] = { 482 float alwaysCheck[] = {
483 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX, 483 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX,
484 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f, 484 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f,
485 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity, 485 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity,
486 -FLT_MIN / 8388608.0 486 -FLT_MIN / 8388608.0
487 }; 487 };
488 for (float inputFloat: alwaysCheck) { 488 for (float inputFloat: alwaysCheck) {
489 check_pdf_scalar_serialization(reporter, inputFloat); 489 check_pdf_scalar_serialization(reporter, inputFloat);
490 } 490 }
491 } 491 }
OLDNEW
« no previous file with comments | « tests/PDFOpaqueSrcModeToSrcOverTest.cpp ('k') | tests/Test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698