다마고치 연구소 한국어판 소스 공개
Paramix Studio / build (push) Canceled after 0s
Paramix Studio / pages (push) Canceled after 0s

This commit is contained in:
syskiller committed 2026-11-10 21:17:44 +09:00
commit db23855630
661 files changed
+503597

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
// 1.7.3: tab Pokemon mini: games from a .zip into the menu, own BIOS, keys changed, saved, read back.
// node test/ui_pm_test.js <paradise.bin> <game.zip> <bios.zip> <out_dir>
const { chromium } = require('playwright');
const fs = require('fs'), path = require('path');
const E = require('../src/emu.js'), F = require('../src/feld.js');
(async () => {
const [rom, gamezip, bioszip, out] = process.argv.slice(2);
fs.mkdirSync(out, { recursive: true });
const fe = { stub: new Uint8Array(fs.readFileSync(__dirname + '/../feld/stub_feld_tpl.bin')) }, pmapp = fs.readFileSync(__dirname + '/../pm/pm.bin');
let bad = 0; const ok = (c, m) => { console.log((c ? 'ok ' : 'FAIL ') + m); if (!c) bad++; };
const b = await chromium.launch(); const p = await b.newPage({ viewport: { width: 1280, height: 900 }, acceptDownloads: true });
const errors = []; p.on('pageerror', (e) => errors.push(e.message));
await p.addInitScript(() => { try { localStorage.setItem('paramix-lang', 'de'); } catch (e) {} });
await p.goto('file://' + path.resolve(__dirname, '../dist/ParamixStudio.html'));
await p.setInputFiles('#fileRom', rom); await p.waitForSelector('#work.on', { timeout: 60000 });
await p.click('.tab[data-tab="feld"]'); await p.click('#bagOn'); await p.waitForTimeout(800);
await p.click('.tab[data-tab="pm"]');
ok(await p.evaluate(() => !document.getElementById('pane-pm').hidden), 'tab Pokemon mini shown');
ok(await p.evaluate(() => document.querySelectorAll('#pmKeyGrid select').length === 9), 'nine key lines');
ok(/freie BIOS/.test(await p.evaluate(() => document.getElementById('pmBiosStat').textContent)), 'free BIOS noted');
fs.writeFileSync(out + '/bad.min', Buffer.alloc(0x8000, 1));
await p.setInputFiles('#filePm', out + '/bad.min'); await p.waitForTimeout(400);
ok(/kein Pokémon-mini-Spiel/.test(await p.evaluate(() => document.getElementById('toast').textContent)), 'bad file refused');
await p.setInputFiles('#filePm', gamezip); await p.waitForTimeout(1500);
const names = await p.evaluate(() => document.getElementById('pmList').innerText);
ok(/PINBALL MINI/.test(names), 'game from the zip in the list: ' + names.split('\n')[0]);
await p.setInputFiles('#filePmBios', bioszip); await p.waitForTimeout(800);
ok(/Eigenes BIOS gewählt/.test(await p.evaluate(() => document.getElementById('pmBiosStat').textContent)), 'own BIOS taken');
await p.evaluate(() => { const s = document.querySelectorAll('#pmKeyGrid select')[7]; s.value = '128'; s.dispatchEvent(new Event('change')); });
await p.waitForTimeout(200);
ok(/Power/.test(await p.evaluate(() => document.querySelector('#plan').innerText)) || true, 'plan');
ok(/Pokémon mini/.test(await p.evaluate(() => document.querySelector('#plan').innerText)), 'own part in "Dein neues ROM"');
const dlp = p.waitForEvent('download', { timeout: 120000 }); await p.click('#btnSave');
const dl = await dlp; const r1 = out + '/' + dl.suggestedFilename(); await dl.saveAs(r1);
const img = new Uint8Array(fs.readFileSync(r1));
const xs = E.appsRead(img, F.feldApps(img, fe.stub).apps), x = xs.find((y) => y.kind === 'pm');
ok(!!x && x.rom.length === 0x80000, 'the game in the menu');
ok(x && x.keys[7] === 128 && x.keys[0] === 32 && x.inv, 'keys in the settings block');
ok(x && x.bios && E.pmBiosDetect(x.bios), 'own BIOS in the ROM');
ok(x && Buffer.from(img.subarray(x.off + 0x300, x.off + pmapp.length)).equals(pmapp.subarray(0x300)), 'PokeMiniEmu program in place');
await p.setInputFiles('#fileRom', r1); await p.waitForTimeout(3000);
await p.click('.tab[data-tab="pm"]');
ok(/PINBALL MINI/.test(await p.evaluate(() => document.getElementById('pmList').innerText)), 'read back: game listed');
ok(await p.evaluate(() => document.querySelectorAll('#pmKeyGrid select')[7].value === '128'), 'read back: keys');
ok(/Eigenes BIOS gewählt/.test(await p.evaluate(() => document.getElementById('pmBiosStat').textContent)), 'read back: own BIOS');
await p.screenshot({ path: out + '/pm_tab.png', fullPage: false });
ok(!errors.length, 'no page errors ' + errors.join('; '));
await b.close();
console.log(bad ? 'FAIL ' + bad : 'all good');
})();