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