Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: tests/CanvasTest.cpp

Issue 681083002: Removing dead code from CanvasTest (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove friend Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698