Tests: Implement unit test for .

Closes .
This commit is contained in:
Jürg Lehni 2017-03-07 20:57:47 +01:00
parent fd797425e0
commit 5ea09c2fa2

View file

@ -243,10 +243,10 @@ test('#1233', function() {
});
test('#1239', function() {
var p1 = new Path([[890.91, 7.52, 0, 0, 85.40999999999997, 94.02], [1024, 351.78, 0, -127.03999999999996, 0, 127.14999999999998], [890.69, 696.28, 85.54999999999995, -94.03999999999996, 0, 0], [843.44, 653.28, 0, 0, 75.20000000000005, -82.66999999999996], [960, 351.78, 0, 111.75, 0, -111.63], [843.65, 50.51999999999998, 75.07000000000005, 82.63999999999999, 0, 0], true]);
var p2 = new Path([[960, 352, -0.05999999999994543, 111.67999999999995, 0, 0], [1024, 352, 0, 0, -0.05999999999994543, 127.07], [890.69, 696.28, 85.5, -93.98000000000002, 0, 0], [843.44, 653.28, 0, 0, 75.14999999999998, -82.61000000000001], true]);
var path1 = new Path([[890.91, 7.52, 0, 0, 85.40999999999997, 94.02], [1024, 351.78, 0, -127.03999999999996, 0, 127.14999999999998], [890.69, 696.28, 85.54999999999995, -94.03999999999996, 0, 0], [843.44, 653.28, 0, 0, 75.20000000000005, -82.66999999999996], [960, 351.78, 0, 111.75, 0, -111.63], [843.65, 50.51999999999998, 75.07000000000005, 82.63999999999999, 0, 0], true]);
var path2 = new Path([[960, 352, -0.05999999999994543, 111.67999999999995, 0, 0], [1024, 352, 0, 0, -0.05999999999994543, 127.07], [890.69, 696.28, 85.5, -93.98000000000002, 0, 0], [843.44, 653.28, 0, 0, 75.14999999999998, -82.61000000000001], true]);
project.activeLayer.scale(0.25);
testIntersections(p1.getIntersections(p2), [
testIntersections(path1.getIntersections(path2), [
{ point: { x: 956.28999, y: 351.925 }, index: 1, time: 0.000577, crossing: true},
{ point: { x: 956.28948, y: 352.2327 }, index: 1, time: 0.003804, crossing: true},
{ point: { x: 939.50932, y: 415.17952 }, index: 1, time: 0.701801, crossing: true},
@ -257,3 +257,17 @@ test('#1239', function() {
]);
});
test('#1270', function() {
var path1 = new Path([
[[518.1324333364005,525.3627791319631],[0,0],[-176.55448869390185,-21.18468723070137]],
[[566.2904364724154,410.76527247372775],[-46.47911627150603,52.76067378200145],[0,0]]
]);
var path2 = new Path([
[[559.0535685322159,597.7793459106795],[0,0],[-31.356180646343603,-39.95638485995187]],
[[433.62884594684147,437.953806470872],[31.356180646343603,39.95638485995187],[0,0]]
]);
testIntersections(path1.getIntersections(path2), [
{ point: { x: 500.36244, y: 522.99072 }, index: 0, time: 0.03613, crossing: true },
{ point: { x: 463.83556, y: 476.44545 }, index: 0, time: 0.52936, crossing: true }
]);
})