aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-03-06 13:41:51 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-06 19:08:46 +0000
commit94458ee0f2be19392042084f181b41308ae63624 (patch)
treef38c4e6108ce2a3f88caf38c6b0920704e383709 /tests
parente041e31926f88bf76d8d29eb77868bb8b3749044 (diff)
Add SkSurfaceCharacterization::createResized
Change-Id: Ia98ce3cf6c0b9f9100eea9850af56048e43b8d07 Reviewed-on: https://skia-review.googlesource.com/112580 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/DeferredDisplayListTest.cpp27
1 files changed, 27 insertions, 0 deletions
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<SkSurface> 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;