37ba855faf
Add a dedicated NPC editor window, directed relations, control/presentation avatar overlay, and ru/en help for the new section. Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
3.3 KiB
TypeScript
76 lines
3.3 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 here = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
function readCreateWindows(): string {
|
|
return fs.readFileSync(path.join(here, 'createWindows.ts'), 'utf8');
|
|
}
|
|
|
|
void test('createWindows: закрытие редактора завершает приложение', () => {
|
|
const src = readCreateWindows();
|
|
assert.match(src, /kind === 'editor'/);
|
|
assert.match(src, /win\.on\(\s*['"]close['"]/);
|
|
assert.ok(src.includes('appQuitting'));
|
|
assert.ok(src.includes('e.preventDefault()'));
|
|
assert.ok(src.includes('quitAppFromEditorClose') || src.includes('app.quit()'));
|
|
assert.ok(src.includes('markAppQuitting'));
|
|
});
|
|
|
|
void test('createWindows: иконка окна (pack PNG, затем window PNG; SVG только вне win32)', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('loadBrandingWindowIcon'));
|
|
const branding = fs.readFileSync(path.join(here, 'brandingIcon.ts'), 'utf8');
|
|
assert.ok(branding.includes('app-pack-icon.png'));
|
|
assert.ok(branding.includes('app-window-icon.png'));
|
|
assert.ok(branding.includes('tryDarwinSvgPaths'));
|
|
});
|
|
|
|
void test('createWindows: пульт поверх экрана просмотра (дочернее окно)', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('parent: presentation'));
|
|
assert.ok(src.includes("createWindow('control'"));
|
|
});
|
|
|
|
void test('createWindows: окно описания сцены закрывается с multi-window и отдельно', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('openSceneDescriptionWindow'));
|
|
assert.ok(src.includes('closeSceneDescriptionWindow'));
|
|
assert.ok(src.includes("createWindow('sceneDescription'"));
|
|
assert.match(src, /export function closeMultiWindow[\s\S]*closeSceneDescriptionWindow/);
|
|
assert.match(src, /kind !== 'presentation' && kind !== 'control'[\s\S]*closeSceneDescriptionWindow/);
|
|
});
|
|
|
|
void test('createWindows: окно материалов закрывается с multi-window', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('openMaterialsWindow'));
|
|
assert.ok(src.includes('closeMaterialsWindow'));
|
|
assert.ok(src.includes("createWindow('materials'"));
|
|
assert.match(src, /export function closeMultiWindow[\s\S]*closeMaterialsWindow/);
|
|
});
|
|
|
|
void test('createWindows: окно НПС закрывается с multi-window', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('openNpcsWindow'));
|
|
assert.ok(src.includes('closeNpcsWindow'));
|
|
assert.ok(src.includes('openNpcsEditorWindow'));
|
|
assert.ok(src.includes("createWindow('npcs'"));
|
|
assert.ok(src.includes("createWindow('npcsEditor'"));
|
|
assert.match(src, /export function closeMultiWindow[\s\S]*closeNpcsWindow/);
|
|
});
|
|
|
|
void test('createWindows: production — loadFile для HTML (не только file://)', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('loadFile'));
|
|
assert.ok(src.includes('loadWindowPage'));
|
|
});
|
|
|
|
void test('createWindows: показ окна — не только ready-to-show (холодный старт Windows)', () => {
|
|
const src = readCreateWindows();
|
|
assert.ok(src.includes('ensureWindowBecomesVisible'));
|
|
assert.ok(src.includes('did-finish-load'));
|
|
});
|