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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream)); | 508 sk_sp<SkDocument> doc(SkDocument::MakePDF(&outStream)); |
509 REPORTER_ASSERT(reporter, doc); | 509 REPORTER_ASSERT(reporter, doc); |
510 if (!doc) { | 510 if (!doc) { |
511 return; | 511 return; |
512 } | 512 } |
513 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), | 513 SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), |
514 SkIntToScalar(d.fHeight)); | 514 SkIntToScalar(d.fHeight)); |
515 REPORTER_ASSERT(reporter, canvas); | 515 REPORTER_ASSERT(reporter, canvas); |
516 step->setAssertMessageFormat(kPdfAssertMessageFormat); | 516 step->setAssertMessageFormat(kPdfAssertMessageFormat); |
517 step->draw(canvas, d, reporter); | 517 step->draw(canvas, d, reporter); |
518 | |
519 REPORTER_ASSERT(reporter, doc->close()); | |
520 } | 518 } |
521 | 519 |
522 /* | 520 /* |
523 * This sub-test verifies that the test step passes when executed | 521 * This sub-test verifies that the test step passes when executed |
524 * with SkCanvas and with classes derrived from SkCanvas. It also verifies | 522 * with SkCanvas and with classes derrived from SkCanvas. It also verifies |
525 * that the all canvas derivatives report the same state as an SkCanvas | 523 * that the all canvas derivatives report the same state as an SkCanvas |
526 * after having executed the test step. | 524 * after having executed the test step. |
527 */ | 525 */ |
528 static void TestOverrideStateConsistency(skiatest::Reporter* reporter, const Tes
tData& d, | 526 static void TestOverrideStateConsistency(skiatest::Reporter* reporter, const Tes
tData& d, |
529 CanvasTestStep* testStep) { | 527 CanvasTestStep* testStep) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 SkPaint paint; | 729 SkPaint paint; |
732 // paint.setShader(SkShader::MakeColorShader(SK_ColorRED)); | 730 // paint.setShader(SkShader::MakeColorShader(SK_ColorRED)); |
733 | 731 |
734 canvas.save(); | 732 canvas.save(); |
735 canvas.clipRect(SkRect::MakeWH(55, 55)); | 733 canvas.clipRect(SkRect::MakeWH(55, 55)); |
736 canvas.translate(10, 20); | 734 canvas.translate(10, 20); |
737 canvas.drawRect(SkRect::MakeWH(50, 50), paint); | 735 canvas.drawRect(SkRect::MakeWH(50, 50), paint); |
738 canvas.restore(); | 736 canvas.restore(); |
739 } | 737 } |
740 | 738 |
OLD | NEW |