Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
const Sprites = ChromeUtils.importESModule(
);
add_task(async function () {
Assert.ok(Sprites.Sprite);
const sempty = await Sprites.Sprite.init(null);
Assert.deepEqual(
await sempty.getPosition(),
new Sprites.Point({ x: 0, y: 0 })
);
const s = await Sprites.Sprite.init(new Sprites.Point({ x: 0, y: 1 }));
Assert.deepEqual(await s.getPosition(), new Sprites.Point({ x: 0, y: 1 }));
s.moveTo(new Sprites.Point({ x: 1, y: 2 }));
Assert.deepEqual(await s.getPosition(), new Sprites.Point({ x: 1, y: 2 }));
s.moveBy(new Sprites.Vector({ dx: -4, dy: 2 }));
Assert.deepEqual(await s.getPosition(), new Sprites.Point({ x: -3, y: 4 }));
const srel = await Sprites.Sprite.newRelativeTo(
new Sprites.Point({ x: 0, y: 1 }),
new Sprites.Vector({ dx: 1, dy: 1.5 })
);
Assert.deepEqual(
await srel.getPosition(),
new Sprites.Point({ x: 1, y: 2.5 })
);
});