MCPcopy
hub / github.com/paperjs/paper.js / test

Function test

test/tests/Path_Intersections.js:115–149  ·  view source on GitHub ↗
(ctor, applyMatrix)

Source from the content-addressed store, hash-verified

113
114test('intersecting paths with applyMatrix = true / false', function() {
115 function test(ctor, applyMatrix) {
116 var name = ctor.name.toLowerCase();
117
118 var item1 = new ctor.Rectangle({
119 point: [0, 0],
120 size: [200, 200],
121 applyMatrix: applyMatrix
122 });
123
124 var offset = new Point(200, 200);
125
126 item1.translate(offset);
127
128 var item2 = new ctor.Rectangle({
129 point: [100, 100],
130 size: [200, 200],
131 applyMatrix: applyMatrix
132 });
133
134 if (!applyMatrix)
135 offset = new Point(0, 0);
136
137 if (ctor === Path) {
138 testIntersections(item1.getIntersections(item2), [{
139 point: new Point(0, 100).add(offset), index: 0, time: 0.5,
140 crossing: true
141 }, {
142 point: new Point(100, 0).add(offset), index: 1, time: 0.5,
143 crossing: true
144 }]);
145 }
146
147 equals(item1.intersects(item2), true,
148 name + '1.intersects(' + name + '2);');
149 }
150
151 test(Path, true);
152 test(Path, false);

Callers 15

Raster.jsFile · 0.70
PaperScript.jsFile · 0.70
PathItem.jsFile · 0.70
Shape.jsFile · 0.70
HitResult.jsFile · 0.70
Interactions.jsFile · 0.70
Item_Order.jsFile · 0.70
Curve.jsFile · 0.70
CurveLocation.jsFile · 0.70
JSON.jsFile · 0.70
SvgImport.jsFile · 0.70
Item.jsFile · 0.70

Calls 2

testIntersectionsFunction · 0.85
equalsFunction · 0.85

Tested by

no test coverage detected