aboutsummaryrefslogtreecommitdiffziptar.gz
path: root/viewer/tools/smoke/export.mjs
diff options
context:
space:
mode:
authorgodosa <godosa@godosa.eu>2026-10-07 00:14:38 +0200
committergodosa <godosa@godosa.eu>2026-10-07 00:14:38 +0200
commit3443c1c65e9f1753e1e656b35d08416c1fa298f2 (patch)
tree4e43236f460145a4d75d1b4616dcb7aa6ef08f51 /viewer/tools/smoke/export.mjs
downloadworldmap-viewer-3443c1c65e9f1753e1e656b35d08416c1fa298f2.tar.gz
worldmap-viewer-3443c1c65e9f1753e1e656b35d08416c1fa298f2.zip
worldmap-viewer: initial public history
Diffstat (limited to 'viewer/tools/smoke/export.mjs')
-rw-r--r--viewer/tools/smoke/export.mjs18
1 files changed, 18 insertions, 0 deletions
diff --git a/viewer/tools/smoke/export.mjs b/viewer/tools/smoke/export.mjs
new file mode 100644
index 0000000..d6183cf
--- /dev/null
+++ b/viewer/tools/smoke/export.mjs
@@ -0,0 +1,18 @@
+// export.mjs — Export tab: the square around the map centre, export it, progress, the list, the square goes away
+const wait = `const a = window.mapViewer; for (let i = 0; i < 300; i++) { await new Promise(r => setTimeout(r, 500));
+ if (['done', 'failed'].includes(a.exports.status?.state)) break; }
+ return { state: a.exports.status?.state, n: a.exports.list.length, text: document.getElementById('tab-export').textContent };`;
+export const steps = [
+ { name: 'the Export tab shows the square and the sample count', wait: 4000,
+ expect: v => v.line && /257 × 257/.test(v.info),
+ js: `const a = window.mapViewer; a.view.setState({ lat: 46.5, lon: 9.8, alt: 0.02 }); a.showTab('export');
+ const box = document.getElementById('tab-export'), set = (n, v) => { const s = box.querySelector('select[name=' + n + ']');
+ s.value = v; s.dispatchEvent(new Event('change')); };
+ set('size', '5'); set('res', '20'); await new Promise(r => setTimeout(r, 300));
+ return { line: a.view.lines.objects.has('export-square'), info: box.textContent };` },
+ { name: 'export runs and lists the result', expect: v => v.state === 'done' && v.n === 1 && /n46\.500-e9\.800-5km-20m/.test(v.text),
+ js: `[...document.querySelectorAll('#tab-export button')].find(b => b.textContent.startsWith('Export here')).click();
+ await new Promise(r => setTimeout(r, 500));` + wait },
+ { name: 'leaving the tab hides the square', expect: v => v === false,
+ js: `window.mapViewer.showTab('inspector'); return window.mapViewer.view.lines.objects.has('export-square');` },
+];