more tests

This commit is contained in:
hkrish 2013-04-22 11:55:44 +02:00
parent f3e278f13b
commit eec2638146
2 changed files with 16 additions and 4 deletions

View file

@ -23,7 +23,7 @@
</div>
<footer>
<p>Vector boolean operations on paperjs objects. <br />
Still under development, mostly written for clarity and compatibility,
Still under development, mostly written for clarity and compatibility,
not optimised for performance, and has to be tested heavily.</p>
<p>--<br />
hari</p>

View file

@ -128,15 +128,27 @@ function runTests() {
pathB.addChild( npath );
testBooleanStatic( pathA, pathB, caption );
caption = prepareTest( 'CompoundPaths 6 - holes and islands 3', container );
group = paper.project.importSvg( document.getElementById( 'glyphsacirc' ) );
pathA = group.children[0];
pathB = new CompoundPath();
var npath = new Path.Circle([110, 110], 100);
pathB.addChild( npath );
npath = new Path.Circle([110, 110], 60);
pathB.addChild( npath );
npath = new Path.Circle([110, 110], 30);
pathB.addChild( npath );
testBooleanStatic( pathA, pathB, caption );
// To resolve self intersection on a single path,
// pass an empty second operand and do a Union operation
caption = prepareTest( 'Self-intersecting paths 1 - Resolve self-intersection on single path', container );
pathA = new Path.Star(new Point(80, 110), 10, 20, 80);
pathA = new Path.Star(new Point(110, 110), 10, 20, 80);
pathA.smooth();
pathB = new Path();
testBooleanStatic( pathA, pathB, caption, false, true, true, true );
caption = prepareTest( 'Self-intersecting paths 2 - Resolve self-intersection on single path', container );
caption = prepareTest( 'Self-intersecting paths 2 - Resolve self-intersecting CompoundPath', container );
pathA = new CompoundPath();
pathA.addChild( new Path.Circle([100, 110], 60) );
pathA.addChild( new Path.Circle([160, 110], 30) );
@ -166,7 +178,7 @@ var booleanStyle = {
var pathStyleNormal = {
strokeColor: new Color( 0, 0, 0 ),
fillColor: new Color( 0, 0, 0, 0.0 ),
fillColor: new Color( 0, 0, 0, 0.1 ),
strokeWidth: 1
};