[PathKit] Add more correctness tests to gold
Bug: skia:8216
Change-Id: I549f59f165e01ef2e827cf389a5412c123314a90
Reviewed-on: https://skia-review.googlesource.com/147817
Reviewed-by: Stephan Altmueller <stephana@google.com>
diff --git a/experimental/pathkit/tests/testReporter.js b/experimental/pathkit/tests/testReporter.js
index add6634..d1dcd7b 100644
--- a/experimental/pathkit/tests/testReporter.js
+++ b/experimental/pathkit/tests/testReporter.js
@@ -54,6 +54,23 @@
return reportSVG(newSVG, testname);
}
+// Reports a canvas and then an SVG of this path. Puts it on a standard size canvas.
+function reportPath(path, testname, done) {
+ let canvas = document.createElement('canvas');
+ let canvasCtx = canvas.getContext('2d');
+ // Set canvas size and make it a bit bigger to zoom in on the lines
+ standardizedCanvasSize(canvasCtx);
+ canvasCtx.stroke(path.toPath2D());
+
+ let svgStr = path.toSVGString();
+
+ return reportCanvas(canvas, testname).then(() => {
+ reportSVGString(svgStr, testname).then(() => {
+ done();
+ }).catch(reportError(done));
+ }).catch(reportError(done));
+}
+
function _report(data, outputType, testname) {
return fetch(REPORT_URL, {
method: 'POST',