[PathKit] Add various path effects

API Changes (nothing should be breaking):
 - Exposes conic, although all output formats (SVG, Canvas) need conics
to be approximated with quads. Tests have been added to verify this
happens.
 - Add .dash(), .trim(), .stroke() and examples for them.
 - Expose Stroke enums (StrokeJoin, StrokeCap)

Adds tests for the cubic part and clean up a few spacing things.

There are some changes to the C++ code to simplify the build -
otherwise, I need to appease the linker and add add in a bunch
of files that may or may not get optimized out.  Best make them
not even be compiled, just to make sure.

Bug: skia:8216
Change-Id: I1da3aaab1891f14a5b3dc01bb6523b4fd9a87b04
Reviewed-on: https://skia-review.googlesource.com/146650
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/experimental/pathkit/tests/path.spec.js b/experimental/pathkit/tests/path.spec.js
index 660ade5..0cafc38 100644
--- a/experimental/pathkit/tests/path.spec.js
+++ b/experimental/pathkit/tests/path.spec.js
@@ -2,12 +2,12 @@
 describe('PathKit\'s Path Behavior', function() {
     // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
     var PathKit = null;
-    const LoadPathKit = new Promise(function(resolve, reject){
+    const LoadPathKit = new Promise(function(resolve, reject) {
         if (PathKit) {
             resolve();
         } else {
             PathKitInit({
-                locateFile: (file) => '/base/npm-wasm/bin/test/'+file,
+                locateFile: (file) => '/pathkit/'+file,
             }).then((_PathKit) => {
                 PathKit = _PathKit;
                 resolve();
@@ -31,6 +31,10 @@
         });
     });
 
+    function bits2float(str) {
+        return PathKit.SkBits2FloatUnsigned(parseInt(str))
+    }
+
     it('has getBounds() and computeTightBounds()', function(done){
         LoadPathKit.then(() => {
             // Based on PathOpsTightBoundsIllBehaved
@@ -39,12 +43,36 @@
             path.quadraticCurveTo(4, 3, 2, 2);
             expect(path.getBounds()).toEqual(PathKit.MakeLTRBRect(1, 1, 4, 3));
             expect(path.computeTightBounds()).toEqual(PathKit.MakeLTRBRect(1, 1,
-                        PathKit.SkBits2FloatUnsigned(parseInt("0x40333334")),  // 2.8
-                        PathKit.SkBits2FloatUnsigned(parseInt("0x40155556")))); // 2.3333333
+                        bits2float("0x40333334"),  // 2.8
+                        bits2float("0x40155556"))); // 2.3333333
             path.delete();
 
             done();
         });
     });
 
+    it('does NOT approximates conics when dumping as toCmds', function(done){
+        LoadPathKit.then(() => {
+            let path = PathKit.NewPath();
+            path.moveTo(20, 120);
+            path.arc(20, 120, 18, 0, 1.75 * Math.PI);
+            path.lineTo(20, 120);
+
+            let expectedCmds = [
+                [PathKit.MOVE_VERB, 20, 120],
+                [PathKit.LINE_VERB, 38, 120],
+                [PathKit.CONIC_VERB, 38, 138, 20, 138, bits2float("0x3f3504f3)")], // 0.707107f
+                [PathKit.CONIC_VERB, 2, 138, 2, 120, bits2float("0x3f3504f3)")],   // 0.707107f
+                [PathKit.CONIC_VERB, 2, 102, 20, 102, bits2float("0x3f3504f3)")],  // 0.707107f
+                [PathKit.CONIC_VERB, bits2float("0x41dba58e"), 102, bits2float("0x4202e962"), bits2float("0x42d68b4d"), bits2float("0x3f6c8361")],  // 27.4558, 102, 32.7279, 107.272, 0.92388
+                [PathKit.LINE_VERB, 20, 120],
+            ];
+            let actual = path.toCmds();
+            expect(actual).toEqual(expectedCmds);
+
+            path.delete();
+            done();
+        });
+    });
+
 });