From 94458ee0f2be19392042084f181b41308ae63624 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Tue, 6 Mar 2018 13:41:51 -0500 Subject: Add SkSurfaceCharacterization::createResized Change-Id: Ia98ce3cf6c0b9f9100eea9850af56048e43b8d07 Reviewed-on: https://skia-review.googlesource.com/112580 Commit-Queue: Robert Phillips Reviewed-by: Brian Salomon --- tests/DeferredDisplayListTest.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index 924a93464a..4b425aed7e 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -313,6 +313,33 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctxInfo) SkSurfaceCharacterization c; REPORTER_ASSERT(reporter, !rasterSurface->characterize(&c)); } + + // Exercise the createResized method + { + SurfaceParameters params; + + sk_sp s = params.make(context); + if (!s) { + return; + } + + SkSurfaceCharacterization char0; + SkAssertResult(s->characterize(&char0)); + + // Too small + SkSurfaceCharacterization char1 = char0.createResized(-1, -1); + REPORTER_ASSERT(reporter, !char1.isValid()); + + // Too large + SkSurfaceCharacterization char2 = char0.createResized(1000000, 32); + REPORTER_ASSERT(reporter, !char2.isValid()); + + // Just right + SkSurfaceCharacterization char3 = char0.createResized(32, 32); + REPORTER_ASSERT(reporter, char3.isValid()); + REPORTER_ASSERT(reporter, 32 == char3.width()); + REPORTER_ASSERT(reporter, 32 == char3.height()); + } } static constexpr int kSize = 8; -- cgit v1.2.3