Files
julian.kiedaischandClaude Opus 5.5 dfd5ec03ce feat(editor): F4.6a simulation mode and a computer's desktop
Java's mode buttons start and stop the room, now in a worker of the
editor's page (LocalSimHost), with Java's speed slider. While the
simulation runs the design is locked as in Java: no palette, no sheet,
nothing moves, no undo. Cables that carry a frame light up in Java's
green, and a tap on a computer opens its desktop: Java's title, the
software installation first, then the installed programs in the order
of Java's list for the language, a taskbar with the network icon and
the network as the simulation runs it. The room sends that over a new
topic, node:<id>. Desktops stay over a return to the design and show
again at the next start. The programs' windows follow from F4.6b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 13:41:41 +00:00

35 lines
2.2 KiB
TypeScript

// The desktop's programs against Java's lists (config/Desktop_<language>.txt):
// the same programs, in each language's order, with Java's names and icons.
import { existsSync, readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
import { desktopPrograms, DESKTOP_ORDER, JAVA_PROGRAMS } from '../src/desktop/programs.js';
import { CATALOGS, type Language } from '../src/i18n/i18n.js';
const config = join(dirname(fileURLToPath(import.meta.url)), '../../../tools/java-oracle/.upstream/src/main/resources/config');
const FILES: Readonly<Record<Language, string>> = { de: 'Desktop_de_DE.txt', en: 'Desktop_en_GB.txt' };
describe("the desktop's programs", () => {
it.skipIf(!existsSync(config))("are Java's, in the order of each language's list, with Java's names and icons", () => {
for (const language of ['de', 'en'] as const) {
const lines = readFileSync(join(config, FILES[language]), 'utf8')
.split(/\r?\n/)
.filter((line) => line.trim() !== '' && !line.trim().startsWith('#'))
.map((line) => line.split(';'));
expect(DESKTOP_ORDER[language].map((program) => JAVA_PROGRAMS[program].javaClass)).toEqual(lines.map((line) => line[1]));
expect(DESKTOP_ORDER[language].map((program) => CATALOGS[language][`program.${program}`])).toEqual(lines.map((line) => line[0]));
expect(DESKTOP_ORDER[language].map((program) => `gfx/desktop/${JAVA_PROGRAMS[program].iconFile}`)).toEqual(lines.map((line) => line[3]!.trim()));
}
});
it("shows a computer's programs only, in the language's order, without the DHCP server", () => {
expect(desktopPrograms(['webBrowser', 'commandPrompt', 'dhcpServer', 'imageViewer'], 'de')).toEqual(['commandPrompt', 'imageViewer', 'webBrowser']);
expect(desktopPrograms(['webBrowser', 'commandPrompt', 'dhcpServer', 'imageViewer'], 'en')).toEqual(['commandPrompt', 'imageViewer', 'webBrowser']);
expect(desktopPrograms(['webServer', 'webBrowser'], 'de')).toEqual(['webServer', 'webBrowser']);
expect(desktopPrograms(['webServer', 'webBrowser'], 'en')).toEqual(['webBrowser', 'webServer']);
expect(desktopPrograms([], 'de')).toEqual([]);
});
});