Implement unit test for edge case from #799.

This commit is contained in:
Jürg Lehni 2016-01-09 12:16:50 +01:00
parent e8390a76d8
commit 9a148700b7

View file

@ -14,7 +14,7 @@ module('Path Boolean Operations');
function createPath(str) {
var ctor = (str.match(/z/gi) || []).length > 1 ? CompoundPath : Path;
return new ctor(str)
return new ctor(str);
}
function compareBoolean(actual, expected, message, options) {
@ -226,7 +226,7 @@ test('#839', function() {
var p2 = new Path.Rectangle(250, 300, 100, 200);
compareBoolean(function() { return p1.subtract(p2); },
'M522,352l-22,48l-20,0l-32,48l-98,0l0,-96z M250,448l-150,0l0,-96l150,0z');
})
});
test('#865', function() {
function executeTest(offset) {
@ -466,6 +466,17 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
// Test all of @iconexperience's isolated cases in one batch.
// Read more in #784
var paths = [[
[
[240, 270, 0, 0, 0, 0],
[250.53466323186618, 221.0057178821544, 0, 0, 0, 0],
[237.67824477332854, 193.79795691566554, 0, 0, 0, 0],
[320, 240, 0, 0, 0, 0]
], [
[263.31216874462405, 248.04647709671602, 0, 0, 0, 0],
[230, 250, 0, 0, 0, 0],
[237.6782447781314, 193.79795691339606, 0, 0, 0, 0]
]
], [
[
[450, 230, 0, 0, 0, 0],
[362.46932779553646, 264.4394368330295, 0, 0, 0, 0],
@ -787,6 +798,7 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
]
]];
var results = [
['M240,270l4.48298,-20.84932l-14.48298,0.84932l7.67824,-56.20204l82.32176,46.20204z M237.67824,193.79796z', 'M244.48298,249.15068l6.05168,-28.14496l12.77751,27.04076z'],
['M450,230l-87.53067,34.43944l-0.01593,-0.02371c-0.91969,-0.32388 -30.35274,-0.48069 -30.67835,2.89141l-2.76789,-52.67014z', ''],
['M211.76471,391.55301c-1.13066,-11.28456 3.81977,12.25688 -5.47954,24.76763l-28.00902,-21.41225l-26.21252,2.62636l13.04584,-12.69198l-22.93592,-17.53397l30.159,10.50681l46.32376,-45.06725c-9.58101,10.09791 -8.78302,39.92732 -6.89161,58.80464z', 'M178.27615,394.90839l-13.16668,-10.06562l7.22309,-7.02716l39.43215,13.7374z'],
['M138.31417,456.06811c1.62465,-1.18877 -18.69614,16.61617 -34.61033,15.37458l22.34488,-66.7556l-23.16516,-97.04078l209.03396,72.10619c-68.45789,0.5466 -139.96009,51.6986 -173.60335,76.31563z', 'M126.04871,404.68708l21.5947,-64.51445l-9.32924,115.89547z'],