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 /* Description: | 8 /* Description: |
9 * This test defines a series of elementatry test steps that perform | 9 * This test defines a series of elementatry test steps that perform |
10 * a single or a small group of canvas API calls. Each test step is | 10 * a single or a small group of canvas API calls. Each test step is |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 REPORTER_ASSERT_MESSAGE(reporter, layerIter2.done(), | 561 REPORTER_ASSERT_MESSAGE(reporter, layerIter2.done(), |
562 testStep->assertMessage()); | 562 testStep->assertMessage()); |
563 | 563 |
564 } | 564 } |
565 | 565 |
566 static void TestPdfDevice(skiatest::Reporter* reporter, | 566 static void TestPdfDevice(skiatest::Reporter* reporter, |
567 const TestData& d, | 567 const TestData& d, |
568 CanvasTestStep* testStep) { | 568 CanvasTestStep* testStep) { |
569 SkDynamicMemoryWStream outStream; | 569 SkDynamicMemoryWStream outStream; |
570 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&outStream)); | 570 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&outStream)); |
571 #if SK_SUPPORT_PDF | 571 if (!doc) { |
572 REPORTER_ASSERT(reporter, doc); | 572 return; |
reed1
2015/08/11 19:08:47
Should we assert that we failed only when PDF was
hal.canary
2015/08/11 20:26:15
Done.
| |
573 } | |
573 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), | 574 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), |
574 SkIntToScalar(d.fHeight)); | 575 SkIntToScalar(d.fHeight)); |
575 REPORTER_ASSERT(reporter, canvas); | 576 REPORTER_ASSERT(reporter, canvas); |
576 testStep->setAssertMessageFormat(kPdfAssertMessageFormat); | 577 testStep->setAssertMessageFormat(kPdfAssertMessageFormat); |
577 testStep->draw(canvas, d, reporter); | 578 testStep->draw(canvas, d, reporter); |
578 | 579 |
579 REPORTER_ASSERT(reporter, doc->close()); | 580 REPORTER_ASSERT(reporter, doc->close()); |
580 #else | |
581 REPORTER_ASSERT(reporter, !doc); | |
582 #endif // SK_SUPPORT_PDF | |
583 } | 581 } |
584 | 582 |
585 // The following class groups static functions that need to access | 583 // The following class groups static functions that need to access |
586 // the privates members of SkDeferredCanvas | 584 // the privates members of SkDeferredCanvas |
587 class SkDeferredCanvasTester { | 585 class SkDeferredCanvasTester { |
588 public: | 586 public: |
589 static void TestDeferredCanvasStateConsistency( | 587 static void TestDeferredCanvasStateConsistency( |
590 skiatest::Reporter* reporter, | 588 skiatest::Reporter* reporter, |
591 const TestData& d, | 589 const TestData& d, |
592 CanvasTestStep* testStep, | 590 CanvasTestStep* testStep, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 canvas.restore(); | 770 canvas.restore(); |
773 canvas.save(); | 771 canvas.save(); |
774 path.moveTo(5, 5); | 772 path.moveTo(5, 5); |
775 canvas.clipPath(path); | 773 canvas.clipPath(path); |
776 canvas.restore(); | 774 canvas.restore(); |
777 canvas.save(); | 775 canvas.save(); |
778 path.moveTo(7, 7); | 776 path.moveTo(7, 7); |
779 canvas.clipPath(path); // should not assert here | 777 canvas.clipPath(path); // should not assert here |
780 canvas.restore(); | 778 canvas.restore(); |
781 } | 779 } |
OLD | NEW |