]> git.proxmox.com Git - extjs.git/blob - extjs/packages/charts/test/specs/draw/sprite/Path.js
add extjs 6.0.1 sources
[extjs.git] / extjs / packages / charts / test / specs / draw / sprite / Path.js
1 describe("Ext.draw.sprite.Path", function () {
2
3 describe("hitTest", function () {
4 var sprite, surface, container;
5
6 beforeEach(function () {
7 container = new Ext.draw.Container();
8 surface = new Ext.draw.Surface();
9 sprite = new Ext.draw.sprite.Circle({
10 hidden: false,
11 globalAlpha: 1,
12 fillOpacity: 1,
13 strokeOpacity: 1,
14 fillStyle: 'red',
15 strokeStyle: 'red',
16 r: 100,
17 cx: 100,
18 cy: 100
19 });
20 surface.add(sprite);
21 container.add(surface);
22 });
23
24 afterEach(function () {
25 Ext.destroy(sprite, surface, container);
26 });
27
28 it("should return an object with the 'sprite' property set to the sprite itself, " +
29 "if the sprite is visible and its bounding box and path are hit", function () {
30 var result = sprite.hitTest([90, 90]);
31 expect(result && result.sprite).toBe(sprite);
32 });
33
34 it("should return null, if the sprite is visible, its bounding box is hit, but the path isn't", function () {
35 var result = sprite.hitTest([10, 10]);
36 expect(result).toBe(null);
37 });
38
39 });
40
41 });