This commit is contained in:
Evan
2026-09-07 09:55:36 +08:00
parent 9b6892f2ed
commit badbc11154
9098 changed files with 985321 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
const test = require('tap').test;
const Runtime = require('../../src/engine/runtime');
const Scratch3PenBlocks = require('../../src/extensions/scratch3_pen/index');
test('_clampPenSize', t => {
const rt = new Runtime();
const pen = new Scratch3PenBlocks(rt);
t.equal(pen._clampPenSize(-1), 1);
t.equal(pen._clampPenSize(0), 1);
t.equal(pen._clampPenSize(0.25), 1);
t.equal(pen._clampPenSize(1), 1);
t.equal(pen._clampPenSize(10), 10);
t.equal(pen._clampPenSize(1000), 1000);
t.equal(pen._clampPenSize(1200), 1200);
t.equal(pen._clampPenSize(1201), 1200);
rt.setRuntimeOptions({
miscLimits: false
});
t.equal(pen._clampPenSize(-1), 0);
t.equal(pen._clampPenSize(0), 0);
t.equal(pen._clampPenSize(0.25), 0.25);
t.equal(pen._clampPenSize(1), 1);
t.equal(pen._clampPenSize(10), 10);
t.equal(pen._clampPenSize(1000), 1000);
t.equal(pen._clampPenSize(1200), 1200);
t.equal(pen._clampPenSize(1201), 1201);
t.end();
});