0f4bb76b41
Clicking an NPC tile opens description cards (multi-select accordion); Show puts avatars on screen. Optional URL opens a webview tab. Avatar pan in the editor commits on pointer up. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..');
|
|
|
|
void test('video playback: renderer hooks/components do not tick React each frame', () => {
|
|
const hookSrc = fs.readFileSync(
|
|
path.join(root, 'app', 'renderer', 'shared', 'video', 'useVideoPlaybackState.ts'),
|
|
'utf8',
|
|
);
|
|
// Регресс: раньше был setInterval(250ms) для clientNowMs, который заставлял перерисовываться окна.
|
|
assert.doesNotMatch(hookSrc, /\bsetInterval\s*\(/);
|
|
|
|
const previewSrc = fs.readFileSync(
|
|
path.join(root, 'app', 'renderer', 'control', 'ControlScenePreview.tsx'),
|
|
'utf8',
|
|
);
|
|
// Регресс: раньше был RAF loop с setState на каждом кадре.
|
|
assert.doesNotMatch(previewSrc, /\brequestAnimationFrame\s*\(\s*loop\s*\)/);
|
|
assert.doesNotMatch(previewSrc, /\brequestAnimationFrame\s*\(\s*loop\b/);
|
|
// timeupdate пишет scrub в DOM, без setState корня превью (дорого поверх декода видео).
|
|
assert.doesNotMatch(previewSrc, /\bsetTick\b/);
|
|
assert.ok(previewSrc.includes('paintScrub'));
|
|
assert.ok(previewSrc.includes('scrubFillRef'));
|
|
});
|
|
|
|
void test('editor scene cards do not decode full video files', () => {
|
|
const graph = fs.readFileSync(
|
|
path.join(root, 'app', 'renderer', 'editor', 'graph', 'SceneGraph.tsx'),
|
|
'utf8',
|
|
);
|
|
const editor = fs.readFileSync(
|
|
path.join(root, 'app', 'renderer', 'editor', 'EditorApp.tsx'),
|
|
'utf8',
|
|
);
|
|
assert.doesNotMatch(graph, /<video\b/);
|
|
assert.doesNotMatch(graph, /ContainedVideo/);
|
|
assert.doesNotMatch(editor, /sceneThumbVideo/);
|
|
});
|