aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar vjiaoblack <vjiaoblack@google.com>2016-07-12 14:50:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-12 14:50:41 -0700
commit6d3fb898d5f73a82e36f11c712a633c3921ed518 (patch)
treeedbc0625d6120008ac50c710f7486cc26be13a97 /tests
parent2052f313f0fa16daae86e6f298e12e6f23604036 (diff)
Added the framework for having canvas/recorder/picture record depth_set's.
Diffstat (limited to 'tests')
-rw-r--r--tests/CanvasTest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 82e065f5ac..0886b53652 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -779,6 +779,27 @@ DEF_TEST(Canvas_ClipEmptyPath, reporter) {
canvas.restore();
}
+class SkTestCanvas : public SkCanvas {
+public:
+ void testUpdateDepth(skiatest::Reporter* reporter) {
+ // set some depths (with picture enabled), then check them as they get set
+
+ REPORTER_ASSERT(reporter, this->getZ() == 0);
+ this->translateZ(-10);
+ REPORTER_ASSERT(reporter, this->getZ() == -10);
+
+ this->save();
+ this->translateZ(20);
+ REPORTER_ASSERT(reporter, this->getZ() == 10);
+
+ this->restore();
+ REPORTER_ASSERT(reporter, this->getZ() == -10);
+
+ this->translateZ(13.14f);
+ REPORTER_ASSERT(reporter, SkScalarNearlyEqual(this->getZ(),3.14f));
+ }
+};
+
namespace {
class MockFilterCanvas : public SkPaintFilterCanvas {
@@ -812,6 +833,11 @@ DEF_TEST(PaintFilterCanvas_ConsistentState, reporter) {
REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMatrix());
REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getClipBounds(&clip2));
REPORTER_ASSERT(reporter, clip1 == clip2);
+
+ SkTestCanvas* tCanvas;
+
+ tCanvas = (SkTestCanvas*) new SkCanvas(100,100);
+ tCanvas->testUpdateDepth(reporter);
}
///////////////////////////////////////////////////////////////////////////////////////////////////