diff options
author | halcanary <halcanary@google.com> | 2015-03-01 06:55:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-01 06:55:20 -0800 |
commit | 3d32d50364d1b63777fbf05c3593a35601bde9e2 (patch) | |
tree | c1624a6fba189f14c9813727e463dccb84cd22c5 /tests/CanvasTest.cpp | |
parent | 9f2f3493f6185bb7d0c24c8ab451d5d012234edc (diff) |
PDF: Switch some unit tests to higher level API.
Also, clean up some headers.
Review URL: https://codereview.chromium.org/968683002
Diffstat (limited to 'tests/CanvasTest.cpp')
-rw-r--r-- | tests/CanvasTest.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index c405fcd52c..98cfbc158d 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -47,11 +47,9 @@ #include "SkCanvas.h" #include "SkDeferredCanvas.h" #include "SkDevice.h" +#include "SkDocument.h" #include "SkMatrix.h" #include "SkNWayCanvas.h" -#include "SkPDFCanon.h" -#include "SkPDFDevice.h" -#include "SkPDFDocument.h" #include "SkPaint.h" #include "SkPath.h" #include "SkPicture.h" @@ -558,17 +556,15 @@ static void AssertCanvasStatesEqual(skiatest::Reporter* reporter, const TestData static void TestPdfDevice(skiatest::Reporter* reporter, const TestData& d, CanvasTestStep* testStep) { - SkISize pageSize = SkISize::Make(d.fWidth, d.fHeight); - SkPDFCanon canon; - SkAutoTUnref<SkPDFDevice> pdfDevice( - SkPDFDevice::Create(pageSize, 72.0f, &canon)); - SkCanvas canvas(pdfDevice.get()); + SkDynamicMemoryWStream outStream; + SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(&outStream)); + SkCanvas* canvas = doc->beginPage(SkIntToScalar(d.fWidth), + SkIntToScalar(d.fHeight)); + REPORTER_ASSERT(reporter, canvas); testStep->setAssertMessageFormat(kPdfAssertMessageFormat); - testStep->draw(&canvas, d, reporter); - SkPDFDocument doc; - doc.appendPage(pdfDevice.get()); - SkDynamicMemoryWStream stream; - doc.emitPDF(&stream); + testStep->draw(canvas, d, reporter); + + REPORTER_ASSERT(reporter, doc->close()); } // The following class groups static functions that need to access |