mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Update boolean tests to correct intersection results.
This commit is contained in:
parent
472972ed0c
commit
7bb102e218
2 changed files with 21 additions and 14 deletions
|
@ -83,7 +83,13 @@ function compareItem(actual, expected, message, options, properties) {
|
|||
// into a group with a white background of the united dimensions of the
|
||||
// bounds of both items before rasterizing.
|
||||
var resolution = options.rasterize == true ? 72 : options.rasterize,
|
||||
bounds = actual.strokeBounds.unite(expected.strokeBounds);
|
||||
actualBounds = actual.strokeBounds,
|
||||
expecedBounds = expected.strokeBounds,
|
||||
bounds = actualBounds.isEmpty()
|
||||
? expecedBounds
|
||||
: expecedBounds.isEmpty()
|
||||
? actualBounds
|
||||
: actualBounds.unite(expecedBounds);
|
||||
if (bounds.isEmpty()) {
|
||||
QUnit.push(true, 'empty', 'empty', message);
|
||||
return;
|
||||
|
|
|
@ -26,9 +26,10 @@ function compareBoolean(actual, expected, message, options) {
|
|||
message = getFunctionMessage(actual);
|
||||
actual = actual();
|
||||
}
|
||||
actual.strokeColor = expected.strokeColor = 're';
|
||||
actual.strokeWidth = expected.strokeWidth = 1;
|
||||
actual.fillColor = expected.fillColor = 'blue';
|
||||
actual.style = expected.style = {
|
||||
strokeColor: 'black',
|
||||
fillColor: 'yellow'
|
||||
};
|
||||
equals(actual, expected, message, options || { rasterize: true });
|
||||
}
|
||||
|
||||
|
@ -732,11 +733,11 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
|
|||
['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'],
|
||||
['M300.04122,200l-0.02301,55.81328l19.98178,24.18672l-19.98771,-9.82138l-0.01229,29.82138l-29.04124,-44.09743l-40.1367,-19.722z', 'M300.01822,255.81328l-0.00592,14.36534l-29.05353,-14.27606l-10.39571,-15.78528l29.74019,3.93662z'],
|
||||
['M320,240l-17.26682,25.90022l17.26682,34.09978l-27.9401,-18.08984l-12.0599,18.08984l-8.52877,-31.42l-35.04561,-22.69031z', 'M302.73318,265.90022l-10.67329,16.00993l-20.58867,-13.33015l-5.23726,-19.29408l29.80597,3.39596z'],
|
||||
['M157.63421,284.83942l-7.63421,44.55788l-40.73067,-80.07813l47.87749,-25.20588l4.59855,59.82352c-2.48454,0.19098 -3.64723,0.63304 -4.11116,0.90261z', 'M157.63689,284.82381l-0.00267,0.01561c-0.00547,0.00318 -0.01083,0.00633 -0.01611,0.00945c0.0062,-0.0081 0.01246,-0.01645 0.01878,-0.02506z M157.61811,284.84887c-0.25231,0.3297 -0.39376,0.23354 0,0z'],
|
||||
['M157.63421,284.83942l-7.63421,44.55788l-40.73067,-80.07813l47.87749,-25.20588l4.59855,59.82352c-2.48454,0.19098 -3.64723,0.63304 -4.11116,0.90261z', 'M157.63421,284.83942c-0.00547,0.00318 -0.01083,0.00633 -0.01611,0.00945c0.0062,-0.0081 0.01246,-0.01645 0.01878,-0.02506z M157.61811,284.84887c-0.25231,0.3297 -0.39376,0.23354 0,0z'],
|
||||
['M249.53401,269.57063c-5.12674,1.32393 -6.49012,2.86652 -6.50509,2.88317c-0.17123,0.40034 -0.45801,1.48334 -0.35964,3.78705l-45.48004,-42.50042z M243.02893,272.45376c0.00005,-0.00006 0.00012,-0.00014 0.00019,-0.00023l-0.00007,-0.00006c-0.00004,0.0001 -0.00008,0.00019 -0.00012,0.00029z', 'M243.02891,272.4538c-0.00017,0.00019 -0.00017,0.00018 0.00001,-0.00003c0,0.00001 -0.00001,0.00002 -0.00001,0.00003z'],
|
||||
['M326.35621,259.51658c1.15567,-2.02805 1.46269,-3.25061 1.52678,-3.82669l-7.88299,-5.68989l64.9541,-12.98727l-34.9541,62.98727z', 'M327.88299,255.68989c0.00623,-0.05602 0.01017,-0.10593 0.01237,-0.14987c0.01299,0.05713 0.03113,0.12366 0.05593,0.19917z M327.89536,255.54001c-0.0732,-0.32201 0.01728,-0.34576 0,0z'],
|
||||
['M231.45711,304.56979c6.9652,-10.69831 3.685,-25.31974 -0.83742,-39.30438c2.0145,6.22942 -5.98952,-12.01465 -1.16807,-25.36373l37.6026,13.58137l20.65457,-6.67936z', ''],
|
||||
['M534.41418,349.41355c0.99527,-5.06433 -2.16222,25.36794 -15.58857,34.81815l-30.9435,-43.96286l-12.34178,-2.42547l62.78203,-185.64163l38.32358,46.16604c-12.47171,10.35308 -32.36184,100.8236 -42.23175,151.04577z', 'M529.40254,348.42864c-0.93901,-2.14075 5.01164,0.98491 5.01164,0.98491z'],
|
||||
['M534.41418,349.41355c0.99527,-5.06433 -2.16222,25.36794 -15.58857,34.81815l-30.9435,-43.96286l-12.34178,-2.42547l62.78203,-185.64163l38.32358,46.16604c-12.47171,10.35308 -32.36184,100.8236 -42.23175,151.04577z', 'M534.41418,349.41355l-5.01164,-0.98491c-0.93901,-2.14075 5.01164,0.98491 5.01164,0.98491z'],
|
||||
['M100.10301,299.83601l92.88175,81.2024l2.017,-35.39586l286.25085,96.14134l-32.50522,50.43224c-122.96966,-79.25796 -221.91462,-84.66238 -257.15913,-86.67076c1.76118,0.10036 -21.43397,0.82725 -32.77944,-9.14494z', ''],
|
||||
['M219.28387,483.73556l-19.28387,16.26444l1.41,-43.11652l-35.08866,1.12954l38.29075,-137.5648l39.73416,44.95772c-18.08687,15.98539 -18.94914,62.93097 -18.05598,90.67661c-0.2833,-8.80044 3.02337,15.67671 -7.00641,27.65301z', ''],
|
||||
['M134.30251,172.00811c69.89455,-1.62545 89.33749,-12.29848 91.81689,-13.93979c-0.39444,0.32626 -1.16469,1.04523 -2.11233,2.26401c0.67085,-0.74847 1.44456,-1.56236 2.30914,-2.40044c-0.04649,0.03433 -0.11164,0.08005 -0.19681,0.13643c0.13147,-0.10874 0.22118,-0.17386 0.26181,-0.19932c3.45306,-3.33445 8.33582,-7.03437 13.89644,-8.51327l7.76544,29.19775l-24.74271,-17.26083c-3.03845,4.3555 -2.81641,3.24058 -0.39992,0.32276l-87.20297,70.37648z', 'M224.00707,160.33233c-0.22634,0.29111 -0.46281,0.61073 -0.70669,0.96032l-0.39992,0.32276c0.32907,-0.39735 0.69884,-0.82812 1.10661,-1.28308z M226.38122,157.869c0.04659,-0.0292 0.02861,-0.00624 -0.065,0.06289c0.02161,-0.02095 0.04328,-0.04191 0.065,-0.06289z'],
|
||||
|
@ -744,17 +745,17 @@ test('Isolated edge-cases from @iconexperience\'s boolean-test suite', function(
|
|||
['M290.12533,287.90652l22.75403,-2.60738l27.32709,-33.31167l30.67517,40.04265l-27.52018,-1.40525l1.72814,21.16356l-45.08133,-10.79944l9.90334,-12.07215z', 'M312.87936,285.29914l29.76865,-3.41118l0.71343,8.73692l-33.44985,-1.70803z'],
|
||||
['M371.53494,257.2226c-5.3407,-1.86741 -9.84549,-0.99074 -11.34052,-0.17407c0,0 0,0 0,0l-0.02947,-0.01324c0.0301,-0.00458 0.04264,0.00337 0.03269,0.01116c0.51449,-0.33235 62.44572,-40.28995 70.21684,-21.8115z M360.16495,257.03529c-0.16487,0.02506 -0.85657,0.42566 -1.2654,3.2836l-58.89955,-30.31889z', 'M360.19442,257.04853c0,0 0.00108,-0.0007 0.00322,-0.00208c-0.00089,0.0007 -0.00197,0.0014 -0.00322,0.00208z'],
|
||||
['M409.24903,253.44031c-4.3563,1.32265 -5.54585,2.71876 -5.62356,2.81333l-0.01222,-0.01004c-0.1837,0.27203 -0.74035,1.48841 -0.57864,4.75787l-45.76718,-42.83894z', ''],
|
||||
['M292.94,321.04496l3.31075,-9.23873l-24.81246,-15.67426l0,0l0,0l0,0l0,0l48.44426,-22.36542l-13.5895,23.84665l25.09113,1.06631l18.61582,47.08061l-52.31238,-33.04622z', 'M296.25075,311.80623l5.16049,-14.40049l4.88182,0.20746l-8.60544,15.1007z M271.43829,296.13197l0,0z'],
|
||||
['M349.2989,302.36012l-42.41417,8.48166l1.38218,-3.27015l-2.93573,-15.78682l-10.2988,-2.47711l9.58086,-1.38362l-7.18085,-38.61489l32.81153,6.26643l-16.1911,38.30696z', 'M304.61324,287.92408l12.73541,-1.83919l-3.29583,7.79769l-8.72164,-2.09777z'],
|
||||
['M150,290l30,-30l50,10l-24,16l14,14l-50,10l21.17647,-14.11765z', 'M206,286l14,14l-28.82353,-4.11765z'],
|
||||
['M292.94,321.04496l3.31075,-9.23873l-24.81246,-15.67426l0,0l0,0l0,0l0,0l48.44426,-22.36542l-13.5895,23.84665l25.09113,1.06631l18.61582,47.08061l-52.31238,-33.04622z', 'M296.25075,311.80623l5.16049,-14.40049l4.88182,0.20746l-8.60544,15.1007z M271.43829,296.13197l0,0l0,0z'],
|
||||
['M349.2989,302.36012l-42.41417,8.48166l1.38218,-3.27015l-2.93573,-15.78682l-10.2988,-2.47711l9.58086,-1.38362l-7.18085,-38.61489l32.81153,6.26643l-16.1911,38.30696z', 'M304.61324,287.92408l12.73541,-1.83919l-3.29583,7.79769l-8.72164,-2.09777z M308.40197,308.29791l-1.51724,2.54387l1.38218,-3.27015z'],
|
||||
['M150,290l30,-30l50,10l-24,16l14,14l-50,10l21.17647,-14.11765z', 'M191.17647,295.88235l14.82353,-9.88235l14,14z'],
|
||||
['M324.40827,86.1091l0.45123,-0.29442l-16.06828,-25.33943l22.46895,-3.97479l18.72801,12.91832c4.53222,6.94617 -10.24683,11.75354 -25.05014,16.51976l15.98481,25.2078l-22.46194,3.97305l6.36357,-29.14428c-0.13874,0.04467 -0.27748,0.08933 -0.4162,0.134z M324.40827,86.1091l-24.66974,16.09646c-4.37001,-6.69756 10.04945,-11.38915 24.66974,-16.09646z', 'M324.8595,85.81469l0,0l0,0z M324.93803,85.93854c-0.03785,0.01219 -0.07571,0.02438 -0.11356,0.03656l0.03503,-0.16042z'],
|
||||
['M388.92139,223.32159c120.27613,-2.24369 208.69681,19.62691 208.69681,19.62691l0.0116,0.00003l21.89025,-21.07283c0,0 8.54573,10.72909 8.51542,21.16115c-0.03104,10.68629 -208.75655,121.23392 -208.75655,121.23392z', ''],
|
||||
['M272.11155,196.81853l-22.11155,-66.81853l32.64261,64.05832c-6.17669,-1.04412 -8.29,-0.01335 -8.40866,0.04617l-0.00118,-0.00313c-0.09777,0.03858 -0.90866,0.4932 -2.12123,2.71717z', 'M274.23395,194.10449l-0.00118,-0.00313c0.01275,-0.00503 0.01337,-0.00299 0.00118,0.00313z'],
|
||||
['M386.40934,270.73027c77.4169,15.77719 129.39044,24.64733 142.22581,18.90659l5.47489,12.24096l40.60627,23.71608l-21.58416,18.81428z', ''],
|
||||
['M388.92139,223.32159c120.27613,-2.24369 208.69681,19.62691 208.69681,19.62691l0.0116,0.00003l21.89025,-21.07283c0,0 8.54573,10.72909 8.51542,21.16115c-0.03104,10.68629 -208.75655,121.23392 -208.75655,121.23392z', 'M576.29425,263.48737l-8.25852,-20.6248l29.59407,0.08596z'],
|
||||
['M272.11155,196.81853l-22.11155,-66.81853l32.64261,64.05832c-6.17669,-1.04412 -8.29,-0.01335 -8.40866,0.04617l-0.00118,-0.00313c-0.09777,0.03858 -0.90866,0.4932 -2.12123,2.71717z', ''],
|
||||
['M386.40934,270.73027c77.4169,15.77719 129.39044,24.64733 142.22581,18.90659l5.47489,12.24096l40.60627,23.71608l-21.58416,18.81428z', 'M522.90574,295.33395c2.3982,-4.10615 5.41392,-5.55598 5.72941,-5.69709l5.47489,12.24096z'],
|
||||
['M525,345l32.31797,18.04379l23.72504,-18.37449l6.0793,21.87157l-87.1223,33.45913z', 'M557.31797,363.04379l-23.71188,18.3643l-6.07498,-21.85933z'],
|
||||
['M250,150l-15.25375,32.05024l-8.90311,-28.94542l-45.84314,36.89518l63.48255,20.45333l-8.7363,-28.40309l29.10275,-7.1942z', 'M205.61256,189.25209l-0.01028,0.00254l0,0.2z'],
|
||||
['M598.5487,408.11025l-42.28034,59.10612l-37.73535,-87.53938l36.05709,27.56285l0.78705,28.12706z', 'M552.42922,437.2281l2.94792,-1.86119l0.89121,31.84947z'],
|
||||
['M570,290l2.68132,15.47954l6.15287,-0.90118c0,0 -2.36581,0.34651 -6.15287,0.90118l3.13628,18.10603l-28.17314,-14.439c-14.32289,2.0978 -28.17688,4.12693 -28.17688,4.12693l19.08162,-8.78834l-16.12739,-8.26544l27.9654,2.81326z M564.48039,306.68069c-2.28529,0.33471 3.11282,-0.45592 0,0z', 'M575.8176,323.58557l-28.17314,-14.439l16.83593,-2.46588z M564.48039,306.68069c-5.08619,0.74495 -10.99999,1.61111 -16.83593,2.46588c-14.32289,2.0978 -28.17688,4.12693 -28.17688,4.12693l30.91963,-14.24052l9.61279,0.96702z'],
|
||||
['M598.5487,408.11025l-42.28034,59.10612l0,0l-37.73535,-87.53938l36.05709,27.56285l0.78705,28.12706z', 'M556.26835,467.21638l-3.83913,-29.98827l2.94792,-1.86119l0.89121,31.84946z'],
|
||||
['M570,290l2.68132,15.47954l6.15287,-0.90118c0,0 -2.36581,0.34651 -6.15287,0.90118l3.13628,18.10603l-28.17314,-14.439c-14.32289,2.0978 -28.17688,4.12693 -28.17688,4.12693l19.08162,-8.78834l-16.12739,-8.26544l27.9654,2.81326z M564.48039,306.68069c-2.28529,0.33471 3.11282,-0.45592 0,0z', 'M538.5492,304.48516l11.83801,-5.45218l9.61279,0.96702l15.8176,23.58557z'],
|
||||
['', '']
|
||||
];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue