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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 layerIter1.next(); | 595 layerIter1.next(); |
596 layerIter2.next(); | 596 layerIter2.next(); |
597 } | 597 } |
598 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.done(), | 598 REPORTER_ASSERT_MESSAGE(reporter, layerIter1.done(), |
599 testStep->assertMessage()); | 599 testStep->assertMessage()); |
600 REPORTER_ASSERT_MESSAGE(reporter, layerIter2.done(), | 600 REPORTER_ASSERT_MESSAGE(reporter, layerIter2.done(), |
601 testStep->assertMessage()); | 601 testStep->assertMessage()); |
602 */ | 602 */ |
603 } | 603 } |
604 | 604 |
605 // The following class groups static functions that need to access | |
606 // the privates members of SkPictureRecord | |
607 class SkPictureTester { | |
608 private: | |
609 static int EQ(const SkFlatData* a, const SkFlatData* b) { | |
610 return *a == *b; | |
611 } | |
612 | |
613 static void AssertFlattenedObjectsEqual( | |
614 SkPictureRecord* referenceRecord, | |
615 SkPictureRecord* testRecord, | |
616 skiatest::Reporter* reporter, | |
617 CanvasTestStep* testStep) { | |
618 | |
619 REPORTER_ASSERT_MESSAGE(reporter, | |
620 referenceRecord->fBitmapHeap->count() == | |
621 testRecord->fBitmapHeap->count(), testStep->assertMessage()); | |
622 REPORTER_ASSERT_MESSAGE(reporter, | |
623 referenceRecord->fPaints.count() == | |
624 testRecord->fPaints.count(), testStep->assertMessage()); | |
625 for (int i = 0; i < referenceRecord->fPaints.count(); ++i) { | |
626 REPORTER_ASSERT_MESSAGE(reporter, | |
627 EQ(referenceRecord->fPaints[i], testRecord->fPaints[i]), | |
628 testStep->assertMessage()); | |
629 } | |
630 REPORTER_ASSERT_MESSAGE(reporter, | |
631 !referenceRecord->fPathHeap == !testRecord->fPathHeap, | |
632 testStep->assertMessage()); | |
633 // The following tests are commented out because they currently | |
634 // fail. Issue: http://code.google.com/p/skia/issues/detail?id=507 | |
635 /* | |
636 if (referenceRecord->fPathHeap) { | |
637 REPORTER_ASSERT_MESSAGE(reporter, | |
638 referenceRecord->fPathHeap->count() == | |
639 testRecord->fPathHeap->count(), | |
640 testStep->assertMessage()); | |
641 for (int i = 0; i < referenceRecord->fPathHeap->count(); ++i) { | |
642 REPORTER_ASSERT_MESSAGE(reporter, | |
643 (*referenceRecord->fPathHeap)[i] == | |
644 (*testRecord->fPathHeap)[i], testStep->assertMessage()); | |
645 } | |
646 } | |
647 */ | |
648 | |
649 } | |
650 }; | |
651 | |
652 static void TestPdfDevice(skiatest::Reporter* reporter, | 605 static void TestPdfDevice(skiatest::Reporter* reporter, |
653 const TestData& d, | 606 const TestData& d, |
654 CanvasTestStep* testStep) { | 607 CanvasTestStep* testStep) { |
655 SkISize pageSize = SkISize::Make(d.fWidth, d.fHeight); | 608 SkISize pageSize = SkISize::Make(d.fWidth, d.fHeight); |
656 SkPDFDevice device(pageSize, pageSize, SkMatrix::I()); | 609 SkPDFDevice device(pageSize, pageSize, SkMatrix::I()); |
657 SkCanvas canvas(&device); | 610 SkCanvas canvas(&device); |
658 testStep->setAssertMessageFormat(kPdfAssertMessageFormat); | 611 testStep->setAssertMessageFormat(kPdfAssertMessageFormat); |
659 testStep->draw(&canvas, d, reporter); | 612 testStep->draw(&canvas, d, reporter); |
660 SkPDFDocument doc; | 613 SkPDFDocument doc; |
661 doc.appendPage(&device); | 614 doc.appendPage(&device); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 | 794 |
842 for (int testStep = 0; testStep < testStepArray().count(); testStep++) { | 795 for (int testStep = 0; testStep < testStepArray().count(); testStep++) { |
843 TestOverrideStateConsistency(reporter, d, testStepArray()[testStep]); | 796 TestOverrideStateConsistency(reporter, d, testStepArray()[testStep]); |
844 if (testStepArray()[testStep]->enablePdfTesting()) { | 797 if (testStepArray()[testStep]->enablePdfTesting()) { |
845 TestPdfDevice(reporter, d, testStepArray()[testStep]); | 798 TestPdfDevice(reporter, d, testStepArray()[testStep]); |
846 } | 799 } |
847 } | 800 } |
848 | 801 |
849 test_newraster(reporter); | 802 test_newraster(reporter); |
850 } | 803 } |
OLD | NEW |