Index: tests/CanvasTest.cpp |
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp |
index 70c2c04ffabf511239239fe8fe3cf91ab78582af..ea0d8cea2875ee48f7a25605e94c271fd3fc6479 100644 |
--- a/tests/CanvasTest.cpp |
+++ b/tests/CanvasTest.cpp |
@@ -779,6 +779,45 @@ DEF_TEST(Canvas_ClipEmptyPath, reporter) { |
canvas.restore(); |
} |
+class SkDrawDepthTester { |
+public: |
robertphillips
2016/07/11 18:39:35
kCanvas* ?
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ const static int canvasWidth = 100; |
+ const static int canvasHeight = 100; |
+ |
+ SkDrawDepthTester(skiatest::Reporter* reporter) { |
robertphillips
2016/07/11 18:39:35
It doesn't look like you are saving off the report
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ } |
+ |
+ void runTests() { |
+ this->test_updatedepth(this->_reporter); |
+ } |
+ |
+private: |
robertphillips
2016/07/11 18:39:35
Member variables are prefixed with 'f' not '_'
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ skiatest::Reporter* _reporter; |
+ |
robertphillips
2016/07/11 18:39:35
The SkPictureRecorder should just be on the stack
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ SkPictureRecorder _recorder; |
robertphillips
2016/07/11 18:39:35
Why do you need to store _canvas & _picture ?
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ sk_sp<SkPicture> _picture; |
+ SkCanvas* _canvas; |
robertphillips
2016/07/11 18:39:35
Do you use paint at all ?
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ SkPaint paint; |
+ |
+ void test_updatedepth(skiatest::Reporter* reporter) { |
+ // set some depths (with picture enabled), then check them as they get set |
+ this->_canvas = this->_recorder.beginRecording(SkRect::MakeIWH(100, 100)); |
+ |
+ this->_canvas->setZ(-10); |
+ this->_canvas->save(); |
+ this->_canvas->setZ(10); |
+ REPORTER_ASSERT(reporter, this->_canvas->getZ() == 10); |
+ |
+ this->_canvas->restore(); |
+ REPORTER_ASSERT(reporter, this->_canvas->getZ() == -10); |
+ |
+ this->_canvas->setZ(3.14); |
+ REPORTER_ASSERT(reporter, this->_canvas->getZ() == 3.14); |
+ |
+ this->_picture = this->_recorder.finishRecordingAsPicture(); |
+ } |
+}; |
+ |
namespace { |
class MockFilterCanvas : public SkPaintFilterCanvas { |
@@ -812,4 +851,85 @@ 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); |
+ |
+ SkDrawDepthTester depthTester(reporter); |
+ depthTester.runTests(); |
} |
robertphillips
2016/07/11 18:39:35
What's with all these lines ?
vjiaoblack
2016/07/11 18:58:03
Done.
|
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |