mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Implement unit tests for Item#getItems() with overlapping / inside properties.
Relates to #961
This commit is contained in:
parent
6d5d1ce077
commit
80c8aae5bc
2 changed files with 42 additions and 4 deletions
|
@ -5,7 +5,7 @@ node_js:
|
|||
sudo: false
|
||||
env:
|
||||
matrix:
|
||||
- CXX=g++-4.8
|
||||
- CXX=g++-4.9
|
||||
global:
|
||||
- secure: QD8wgggmlF0PPOSdQ84JLO9quLMlTDXu3Cg0+UM9yFSyih2ukL/XGn5wxR3B3XmaHfzRqxtrfhjMX6LT7DKFsriolhNVu0kER4zGyrKWK5irxAy2veosyj8qs/R1pXh9qnItlgXrz0fJwpH9o/08q8X+ZjXb0veZ34EMODLbV5zBJXoaHVC6WN62GzInAEEfdB0AEacb44sDIdK++1ujcTFLGnc+LJw8Ck2C/eOWwRhJyiNUrHHTQV3KaM0YtHz+DCz5InC9vWl+BG656AOU5C6PMTvnZ1M3CGfjmXydZoBbDvCQIcB5ylf17tXGoJKevHnmLWm6U3fPVwUwiPiKvisxyNShZw4BEDS7m1b799GnzGOiYsi37aH3G+iAORg1QVqoCAK/yQ77MkkA6a3tlLVHRaInVA6QlFxlbqc8WNlx+fa8lo4L7Y9KPGfr1Bpix/kHQV5JCzKS16Zc7wblTrOvIR/qb8qPfLoxhXi5fUZ3eRuXgR699X1IHJ1LlhkOoBfSiWl88qba01FBLrYSCPeVGb6/N91OFpIlq6eORnzBbc4mtoJSYttvZ45Hu3M5V0KDrGIHr7kNyPThdKr7PVaMXHLCpNrnmBSaxVCU5uhb8Ae3bnLAq/aBxHWZNA8cQ43/s6rS7QqOVJfquXNFYa6V9/QjbU3sJyqIgRzMkAM=
|
||||
addons:
|
||||
|
@ -14,7 +14,7 @@ addons:
|
|||
- ubuntu-toolchain-r-test
|
||||
- git-core
|
||||
packages:
|
||||
- g++-4.8
|
||||
- g++-4.9
|
||||
- git
|
||||
- libcairo2-dev
|
||||
- libpango1.0-dev
|
||||
|
|
|
@ -215,13 +215,51 @@ test('Project#getItems() overlapping', function() {
|
|||
fillColor: 'red'
|
||||
});
|
||||
|
||||
var rect = new Rectangle(0, 0, 400, 400);
|
||||
equals(function() {
|
||||
var matches = project.getItems({
|
||||
class: Path,
|
||||
overlapping: [0, 0, 400, 400]
|
||||
});
|
||||
return matches.length == 1 && matches[0] == path;
|
||||
}, true);
|
||||
|
||||
equals(function() {
|
||||
var matches = project.getItems({
|
||||
class: Path,
|
||||
overlapping: rect
|
||||
overlapping: [200, 0, 400, 400]
|
||||
});
|
||||
return matches.length == 1 && matches[0] == path;
|
||||
}, true);
|
||||
|
||||
equals(function() {
|
||||
var matches = project.getItems({
|
||||
class: Path,
|
||||
overlapping: [400, 0, 400, 400]
|
||||
});
|
||||
return matches.length == 0;
|
||||
}, true);
|
||||
});
|
||||
|
||||
test('Project#getItems() inside', function() {
|
||||
var path = new Path.Circle({
|
||||
radius: 100,
|
||||
center: [200, 200],
|
||||
fillColor: 'red'
|
||||
});
|
||||
|
||||
equals(function() {
|
||||
var matches = project.getItems({
|
||||
class: Path,
|
||||
inside: [0, 0, 400, 400]
|
||||
});
|
||||
return matches.length == 1 && matches[0] == path;
|
||||
}, true);
|
||||
|
||||
equals(function() {
|
||||
var matches = project.getItems({
|
||||
class: Path,
|
||||
inside: [200, 0, 400, 400]
|
||||
});
|
||||
return matches.length == 0;
|
||||
}, true);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue