Initial commit of 001code-html Scratch frontend project.
Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
26
scratch-vm/test/unit/blocks_motion.js
Normal file
26
scratch-vm/test/unit/blocks_motion.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const test = require('tap').test;
|
||||
const Motion = require('../../src/blocks/scratch3_motion');
|
||||
const Runtime = require('../../src/engine/runtime');
|
||||
const Sprite = require('../../src/sprites/sprite.js');
|
||||
const RenderedTarget = require('../../src/sprites/rendered-target.js');
|
||||
|
||||
test('getPrimitives', t => {
|
||||
const rt = new Runtime();
|
||||
const motion = new Motion(rt);
|
||||
t.type(motion.getPrimitives(), 'object');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Coordinates have limited precision', t => {
|
||||
const rt = new Runtime();
|
||||
const motion = new Motion(rt);
|
||||
const sprite = new Sprite(null, rt);
|
||||
const target = new RenderedTarget(sprite, rt);
|
||||
const util = {target};
|
||||
|
||||
motion.goToXY({X: 0.999999999, Y: 0.999999999}, util);
|
||||
|
||||
t.equals(motion.getX({}, util), 1);
|
||||
t.equals(motion.getY({}, util), 1);
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user