feat: mousearea, datetime dates, dir(), renpy.image_size and style.rebuild for Ren'Py games
Screens get an invisible mousearea that reports the pointer entering and leaving without taking clicks. datetime.date/datetime/timedelta support construction and date arithmetic. dir() lists the game's variables, renpy.style.rebuild() is a no-op, and renpy.image_size answers only for pictures the browser already holds (otherwise an IOError the game can catch). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6c10d06d90
commit
4dc9836a8b
7 files changed
+119
-4
No files matched your search
@@ -89,3 +89,23 @@ test("random generators: choices, sample, seeded Random and frozenset", () => {
|
||||
assert.ok(renpy.random.randrange(0, 10, 5) % 5 === 0);
|
||||
} finally { engine.destroy(); }
|
||||
});
|
||||
|
||||
test("datetime date arithmetic, dir() and style.rebuild", () => {
|
||||
const { engine } = makeEngine(runtime());
|
||||
try {
|
||||
engine.newStore();
|
||||
const { datetime, renpy, dir } = engine.builtins;
|
||||
const start = datetime.date(2025, 1, 31);
|
||||
const next = start.__binop__("+", datetime.timedelta({ __kw: { days: 1 } }));
|
||||
assert.deepEqual([next.year, next.month, next.day], [2025, 2, 1]);
|
||||
assert.equal(next.weekday(), 5); // Saturday
|
||||
assert.throws(() => datetime.date(2025, 2, 30), /ValueError/);
|
||||
const back = next.__binop__("-", datetime.timedelta({ __kw: { days: 32 } }));
|
||||
assert.deepEqual([back.year, back.month, back.day], [2024, 12, 31]);
|
||||
assert.equal(next.__binop__("-", start).days, 1);
|
||||
engine.store.known_name = 1;
|
||||
assert.ok(dir().includes("known_name"));
|
||||
assert.equal(renpy.style.rebuild(), null);
|
||||
assert.throws(() => renpy.image_size("missing"), /IOError/);
|
||||
} finally { engine.destroy(); }
|
||||
});
|
||||
Reference in new issue
Block a user