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>
This commit is contained in:
@@ -109,6 +109,16 @@ const FROM_JAVA: Readonly<Record<string, string>> = {
|
||||
'connections.local': 'jvermittlungsrechnerkonfiguration_msg22',
|
||||
'connections.add': 'jvermittlungsrechnerkonfiguration_msg24',
|
||||
'connections.most': 'jvermittlungsrechnerkonfiguration_msg25',
|
||||
'mode.speed': 'guimainmemu_msg16',
|
||||
'mode.currentSpeed': 'guimainmemu_msg15',
|
||||
'menu.showDesktop': 'guievents_msg3',
|
||||
'desktop.home': 'desktoppanel_application',
|
||||
'desktop.installation': 'desktoppanel_msg1',
|
||||
'network.ipAddress': 'network_msg1',
|
||||
'network.subnetMask': 'network_msg4',
|
||||
'network.dnsServer': 'network_msg2',
|
||||
'network.gateway': 'network_msg3',
|
||||
'network.macAddress': 'network_msg9',
|
||||
};
|
||||
|
||||
/** Java's words, mended: the prompt says "Vermittlungsrechnerns" (guicontainer_msg1). */
|
||||
@@ -128,6 +138,9 @@ const FROM_JAVA_MENDED: Readonly<Record<string, readonly [string, (java: string)
|
||||
// Java's "\n" as line breaks; the last sentence of the German starts with a small letter there.
|
||||
'firewall.intro': ['jfirewalldialog_msg37', (java) => java.replaceAll('\\n', '\n').replace('\nüber', '\nÜber')],
|
||||
'firewall.filterSynHint': ['jfirewalldialog_msg43', (java) => java.replaceAll('\\n', '\n')],
|
||||
// Without Java's key (Strg+D, Strg+R): in a browser they bookmark and reload the page.
|
||||
'mode.design': ['guimainmemu_msg3', (java) => java.replace(/ \((Strg|Ctrl)\+D\)$/, '')],
|
||||
'mode.simulation': ['guimainmemu_msg4', (java) => java.replace(/ \((Strg|Ctrl)\+R\)$/, '')],
|
||||
// Java's lines without their leading space and the empty one; a step starts with a capital letter.
|
||||
'connections.hint': [
|
||||
'jvermittlungsrechnerkonfiguration_msg19',
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user