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 |
| 572 REPORTER_ASSERT(reporter, doc); |
571 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), | 573 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), |
572 SkIntToScalar(d.fHeight)); | 574 SkIntToScalar(d.fHeight)); |
573 REPORTER_ASSERT(reporter, canvas); | 575 REPORTER_ASSERT(reporter, canvas); |
574 testStep->setAssertMessageFormat(kPdfAssertMessageFormat); | 576 testStep->setAssertMessageFormat(kPdfAssertMessageFormat); |
575 testStep->draw(canvas, d, reporter); | 577 testStep->draw(canvas, d, reporter); |
576 | 578 |
577 REPORTER_ASSERT(reporter, doc->close()); | 579 REPORTER_ASSERT(reporter, doc->close()); |
| 580 #else |
| 581 REPORTER_ASSERT(reporter, !doc); |
| 582 #endif // SK_SUPPORT_PDF |
578 } | 583 } |
579 | 584 |
580 // The following class groups static functions that need to access | 585 // The following class groups static functions that need to access |
581 // the privates members of SkDeferredCanvas | 586 // the privates members of SkDeferredCanvas |
582 class SkDeferredCanvasTester { | 587 class SkDeferredCanvasTester { |
583 public: | 588 public: |
584 static void TestDeferredCanvasStateConsistency( | 589 static void TestDeferredCanvasStateConsistency( |
585 skiatest::Reporter* reporter, | 590 skiatest::Reporter* reporter, |
586 const TestData& d, | 591 const TestData& d, |
587 CanvasTestStep* testStep, | 592 CanvasTestStep* testStep, |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 canvas.restore(); | 772 canvas.restore(); |
768 canvas.save(); | 773 canvas.save(); |
769 path.moveTo(5, 5); | 774 path.moveTo(5, 5); |
770 canvas.clipPath(path); | 775 canvas.clipPath(path); |
771 canvas.restore(); | 776 canvas.restore(); |
772 canvas.save(); | 777 canvas.save(); |
773 path.moveTo(7, 7); | 778 path.moveTo(7, 7); |
774 canvas.clipPath(path); // should not assert here | 779 canvas.clipPath(path); // should not assert here |
775 canvas.restore(); | 780 canvas.restore(); |
776 } | 781 } |
OLD | NEW |