Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.
C#
Harnesses: one-query focus lookup, polled waits, LanguageCheck; library checks; handoff notes
Alexander Graefff183a8152f6
diff --git a/CLAUDE.md b/CLAUDE.mdindex 041c442..83102bb 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,6 +1,6 @@# Wave Dude 2D — project notes for Claude-Last updated 2026-10-09. Update this file when the facts below change.+Last updated 2026-10-14. Update this file when the facts below change.## What this is@@ -72,8 +72,80 @@ WPF shell as it stands:automatic run is not started while a scratch frame computes. **A picture changes only when a framefor the position itself arrives** (scratch or stored); with nothing for it yet the last picturestays. Showing the run's newest frame meanwhile was tried twice and rejected both times: it reads- as a replay from frame 0 (2026-10-10). A skipped scratch frame (predicted cost over+ as a replay from frame 0 (2026-10-10). That rule also holds without a run: the presenter is+ cleared only when both the run and the scratch frame are gone (the project replaced), not on+ every scrub step, which flashed the empty picture between frames (2026-10-13). A skipped scratch frame (predicted cost over`ScratchRunner.Budget`, 6 s) is said in the status bar once per frame.+- **Colour schemes and the scene image** (2026-10-13, decisions provisional, see the list at the end+ of this bullet): a `ColorScheme` is a list of `ColorStop`s, each a colour at a position 0..1+ (`Stops`; the table interpolates between neighbours and holds the end colours outside), observable+ (a stop's edit raises `Stops` on the scheme), XML-serialisable as attributes plus one+ `<Stop At="0.125" Color="#3020F4" />` per stop; `Rgb` prints and parses hex and has a+ `TypeConverter`, so a text box binds to a stop's `Color` directly. The author's files consolidate+ losslessly: his 9 evenly spaced stops stay 9 stops at k/8 (all 11 tables equal their+ interpolation, so his `colors` list was redundant there; his program reads only the table), the 12+ sampled colormaps were 255 stops at i/254 at first and are now **slimmed to their bends**+ (`ColorScheme.Simplify`, Ramer–Douglas–Peucker with a largest-channel tolerance of 3/255, applied+ once with `library_check -- simplify-schemes ColorSchemeList 3`, 2026-10-14): 3 to 21 stops each+ (Copper 3, Orange_hot 4, Hot_orange 5, Blue_to_yellow 7, Simply_red 7, Flare_inv 8, Greens 9,+ rainbow 12, magma 13, inferno 16, Ice_and_fire 21, Orange_symmetry 21). The stop arithmetic+ reproduces the author's resampling bit for bit for evenly spaced stops. **The shipped schemes are now `ColorSchemeList/*.wdscheme`** (converted 2026-10-13+ with `library_check -- convert-schemes <folder>`, a one-off kept in the harness), embedded as+ before; JSON is still read for files from the author's program, and the JSON export keeps his+ layout. `.wdscheme` is registered like `.wdproj` (`FileAssociation.Register` takes the ProgId and+ description); a double-clicked scheme file is added to the open project and selected.+ `Project.ColorSchemes` holds the project's own schemes (loaded files, edited copies) inside the+ `.wdproj`; `ColorSchemeCatalog.Resolve/LutFor(project, …)` look there first, then the user folder,+ then the built-ins.+ `Controls/ColorSchemePicker` (a `ComboBox`, value = the scheme name) lists the project's schemes+ tagged "project", then the shared ones of the layer's `Kind`, each with a gradient strip, plus+ "Load from file…" (JSON or `.wdscheme` into the project) and "Edit a copy in the project…" (clone,+ reduced to 9 stops, selected in the tree). The tree has a "Colour schemes" folder (add, duplicate,+ remove, move, drag like sources); `Views/ColorSchemeView` edits name, kind, category and one row+ per stop (position as a number box, swatch, hex), with "Add stop" (into the widest gap) and a+ remove button per row, plus "Reduce to 9 stops" for a 255-stop table, and a "Based on" combo that+ copies any shared or project scheme's stops into the one being edited (a new scheme starts grey).+ Edits+ recolour the preview at once (`ProjectWatcher` reports them as display changes,+ `PreviewPane.RefreshColors`). The scene image is picked with Scene > Browse… and **embedded**:+ `Scene.ImageData` holds the file's bytes (base64 element, `XmlSerializer`'s own encoding),+ `Scene.Image` just its name, the view shows "w × h, KB"; `LoadSceneImage` decodes the bytes once+ per array, a path is still honoured for old files. Open decisions: base64 vs BaseXML for the+ bytes (base64 is what `XmlSerializer` does natively; BaseXML would need an in-house codec); a colour+ picker dialog for the stops (hex text only today; the WinForms `ColorDialog` would need+ `UseWindowsForms`); renaming a project scheme does not update the layers that refer to it.+- **Scene image in the preview** (2026-10-13, the user's choice after the author's app was checked):+ the original shows the scene image itself as the picking background of its Sources/Probes tabs and+ lays a "glowing edges" outline (per-channel Sobel × 0.25, clamped) over the field and intensity+ previews, blended additively, gain 0–5 per preview, off by default, UI state only, baked into+ exports when on. Here: `GlowingEdges` in the library (`Compute`, and `BlendAdditive` for the+ export, both harness-checked); `DisplayLayer.Overlay` (default **on**), `OverlayGain` (0–5, 1),+ `OverlayInExport` (default **off**; no export code exists yet, it must honour it with+ `BlendAdditive`) stored in the project; `MainWindow.UpdateScenePixels` hands the decoded image+ to `PreviewPane.ScenePixels` on project replace and scene edits; the pane shows the image itself+ where no frame exists (and takes the canvas size from it, which was wrong for image scenes+ before), and draws `SceneBitmaps.Overlay` as a translucent `Image` over each picture (attached+ `PreviewPane.OverlayImage` on the picture cells). WPF composites source-over, not additively:+ the layer's alpha is the edge strength × gain and its colour the edge colour at full brightness,+ so the preview and a baked export differ slightly at strong edges.+- **Languages** (2026-10-14): `Strings/Strings.EN|DE|FR|NL.xaml` carry the same keys (menu headers+ with their mnemonics; the shortcut letters I/O/X/L/F/F5 stay). `Localization/LanguageController`+ mirrors the theme controller: View > Language lists "System" then the tables by their own names,+ the choice is the persisted setting `Language` ("" = system, which falls back to English), and the+ change swaps the merged string dictionary at once. Everything read through `DynamicResource`+ changes live; the dock pane titles, the theme menu entries, the tree's folder labels+ (`NamedCollection.Label` reads its resource key on demand and raises a change on a language switch;+ `Key` keeps the automation ids stable) and the picker's action rows are re-read on the change too,+ through `LanguageController.PropertyChanged` (2026-10-14, after "Sondes" and "Propriétés" stayed+ French). The Properties+ pane is localised through generated keys: `Label.<Type>.<Member>`, `Hint.<Type>.<Member>` and+ `Enum.<Type>.<Member>`; the `meta:Label`/`meta:Hint` extensions return a `DynamicResource` when+ the key exists (live) and the attribute text otherwise, `EnumNameConverter` looks the key up first.+ The model's `DisplayName`/`Description` attributes stay the English source; `_tools/…` is not+ needed: the generator was a one-off script, the English block in `Strings.EN.xaml` is what the+ attributes said on 2026-10-14. **Adding a model property means adding its keys to all four+ tables** (the key-set check in the notes' verification list catches a missing one). Not+ localised: log messages.- Preview document: `Panes/PreviewPane`. Two pictures (field,intensity) side by side or stacked (`Orientation`, persisted as the `PreviewOrientation` usersetting), each centred in its cell with its label laid out by `Controls/PictureFrame` (label above@@ -133,7 +205,8 @@ WPF shell as it stands:or wraps to the in point while looping.- **Keyboard first.** Every control must be reachable and operable with Tab and the arrow keys andshow its keyboard focus (accent border); the user tests without the mouse. The preview pane is- the model: explicit `TabIndex` order, the radio group is one tab stop (`IsTabStop` bound to+ the model: explicit `TabIndex` order, the menu bar is not in the Tab cycle (F10 focuses it,+ 2026-10-14), the radio group is one tab stop (`IsTabStop` bound to`IsChecked`, arrows handled in code because WPF's directional navigation skips non-tab-stops),Play/Pause hand focus to each other when they get disabled, `AutomationProperties.AutomationId`on everything a harness needs. Every shortcut a harness must press needs an **unmodified** key@@ -153,8 +226,8 @@ below). Baseline commit `1266f10` is the first compiling, cleaned, documented stafter it (AVI fix, style pass, engine refactor, WPF shell) is uncommitted at the time of writing.Repo root also holds runtime data that is tracked on purpose: `ColorSchemeList/` (the shipped colour-schemes, `*.json`; **embedded into `WaveDude.dll`** as resources `ColorSchemes/<file>` by the library's-csproj, loaded by `ColorSchemeStore.LoadBuiltIn`; the user's own schemes come from+schemes, `*.wdscheme` XML since 2026-10-13; **embedded into `WaveDude.dll`** as resources+`ColorSchemes/<file>` by the library's csproj, loaded by `ColorSchemeStore.LoadBuiltIn`; the user's own schemes come from`%LOCALAPPDATA%\WaveDude\ColorSchemes` and shadow built-ins of the same name; agreed 2026-10-10, noexternal files) and `Project/` (a sample project root). `.vs/`, `bin/`, `obj/` are ignored.@@ -184,7 +257,11 @@ No automated tests in the solution; standalone harnesses exist under `_tools/` (## Verification harnesses (`_tools/`)-Run these after touching the code they cover.+**Run only the check that covers the change** (the user's rule, 2026-10-14, after every small edit had+been followed by minutes of GUI harness runs): a clean build plus one targeted probe or screenshot is+the proof for a local change (a label, a glyph, one binding); `library_check` (about 20 s, no GUI) for+library changes; a UI harness only when the flow it covers changed, and only that one. Never re-run+passing harnesses for comfort, never all of them after an edit.- `_tools/library_check/` — an SDK console project (not in the `.sln`) referencing `WaveDude.csproj`:`dotnet run --project _tools/library_check -c Release`. 70+ checks over the library: scene from BGRA@@ -193,7 +270,10 @@ Run these after touching the code they cover.determinism (same project seed → bit-identical field, different seed → different, **CPU = GPU onrandomized gaps**); `Emitter.FromSource` mapping; `FrameStore` round trip in `%TEMP%` (zero-copyand copying reads, ordering, capacity, deletion); `FrameRenderer` index mapping; every shipped- colour scheme loads and `Save` reproduces the file; a headless `SimulationRun` (CPU, Completed,+ shipped `.wdscheme` loads (11 with the author's 9 stops, 12 with 255), `SaveXml` reproduces the+ shipped file byte for byte, the JSON export keeps the author's layout, stops at uneven positions+ interpolate as expected, `AddStop` fills the widest gap; a project file round-trips its own schemes+ and the embedded scene image bytes; editing a stop notifies once; a headless `SimulationRun` (CPU, Completed,frames and probe trace counted) and a GPU run paused, resumed and stopped; a 1 GB full-HD storemust dispose in under 1.5 s (no flush); `CaptureFrame`/`AwaitFrame` (deferred, both planes),`Reset` reproducing a run and `SetEmitters` matching a fresh engine, on both engines. Prints@@ -213,13 +293,14 @@ The two legacy harnesses are console programs compiled with `csc` against the `Wwalks the RIFF tree (44 structural checks: header offsets, strh dwQuality = -1, movi size, idx1 offsets, EOF).- `_tools/ui_check/PreviewCheck.ps1` drives the WPF preview pane end to end on the default project- (41 checks: play/pause at the 60 fps clock, speed incl. locale spelling, timeline keys, frame+ (43 checks: play/pause at the 60 fps clock, speed incl. locale spelling, timeline keys, framesteps, in/out/loop, split radios, splitter, tab order, focus hand-off, foreground untouched).- `_tools/ui_check/RunCheck.ps1` runs simulations (26 checks): `tiny.wdproj` (64×48, 200 steps) with+ `_tools/ui_check/RunCheck.ps1` runs simulations (33 checks): `tiny.wdproj` (64×48, 200 steps) withF5 to completion, live follow, `,` detaching, the field picture differing between frames (MD5 ofa `PrintWindow` crop), `F` re-attaching, playback of the stored frames, a second run, the source- handle sitting at the source's canvas position on both pictures and moving with the arrow keys- while the tree selection follows, a scratch frame replacing the black canvas after an edit with+ handle sitting at the source's canvas position on both pictures, staying there when the window+ is resized (`SetWindowPos` without activation; the handles once lagged a layout pass behind the+ labels, 2026-10-10) and moving with the arrow keys while the tree selection follows, a scratch frame replacing the black canvas after an edit withno run, and after the run: an edit marks it stale, the shown frame is recomputed from scratch,the automatic re-run completes with the position kept and reproduces the original picture; then`tiny_long.wdproj` (2 000 000 steps, a frame every 1000) for F6 pause/resume and Esc stop with the@@ -227,6 +308,17 @@ The two legacy harnesses are console programs compiled with `csc` against the `Walone, and a second edit stopping it at once before a fresh one starts. Both dot-source `Common.ps1` (native helpers, lookups, `Start-App`/`Stop-App`,`CanvasPoint` for the picture's uniform mapping, `TreeItemSelected`). The split orientation is apersisted user setting, so a harness must set the layout it expects instead of assuming it.+ `_tools/ui_check/LanguageCheck.ps1` (11 checks) drives View > Language by keyboard: F10 focuses the+ menu bar (a plain F10 is handled by `MainWindow.OnPreviewKeyDown`, since WPF's own menu mode needs a+ real Alt/F10), Down opens a menu, Left/Right move between menus, Enter picks; switches to German,+ checks menus, tooltips and property labels, restarts the app to check the setting was kept, and+ switches back to System. A window Windows never activated has no focused element and loses posted+ keys; `Start-App` posts `WM_SETFOCUS` then (`FocusedId` "(none)"). Settles are 60 ms per key+ (`Key`'s default), 100–300 ms where layout follows, `WaitFor` for anything the app computes.+ `FocusedId` is **one** UI Automation query for the element with keyboard focus (a template part's+ id such as `PART_EditableTextBox` is mapped to its owner); asking 17 ids one by one cost half a+ second per Tab and made `FocusOn` crawl. Timings after the 2026-10-14 clean-up: RunCheck 67 s+ (was 455), PreviewCheck 12 s (was 36), LanguageCheck 17 s (was 76).Run `powershell -ExecutionPolicy Bypass -File _tools/ui_check/<script>.ps1` (`-Trace` addsforeground/focus per line); exit code = failures. **How UI harnesses must work here**: the user maybe using the machine, so no mouse, no `SendKeys`, no `SetForegroundWindow`. Post `WM_KEYDOWN`/@@ -270,17 +362,22 @@ FrameStore (temporary file in %LOCALAPPDATA%\WaveDude\cache, DeleteOnClose, pre-- Namespaces: `WaveDude.Engine` (engines, `SceneData`, `Emitter`, `EngineOptions`, `OpenClApi`),`WaveDude.Probes` (`ProbeSpec`, sampler, collector, series, trace, update), `WaveDude.Rendering`- (`Rgb`, `ColorScheme`, `ColorLut`, `ColorSchemeStore` with `System.Text.Json`, built-in schemes- embedded, `FrameRenderer`),+ (`Rgb` with hex text and a `TypeConverter`, `ColorScheme` as one evenly spaced colour list that is+ observable and XML-serialisable, `ColorLut`, `ColorSchemeStore` reading the author's JSON and+ reading/writing XML, built-in schemes embedded, `FrameRenderer`),`WaveDude.Runs` (`RunSpec`, `SimulationRun`, `RunState`, `FrameStore`, `FrameLayer(s)`,`FrameCache`, `ScenePixels`). All copied from `Wave_Dude_2D` and adapted; the legacy app keepsits own copies and does not reference the library. Not ported: video sinks (`MfVideoWriter`,`AviMjpegWriter`, `AviFrameSink`), GDI+ painters (`ProbeGraphPainter`, `ProbeOverlay`), the glow- overlay; export will render from the store instead.+ overlay (now ported as `GlowingEdges`); export will render from the store instead.- **The engine choice is not in the project** (2026-10-09, the user's call: the old app's flag was anartefact): `Simulation > Use the GPU (OpenCL)` is the persisted user setting `UseGpu` (default on),passed to `RunSpec.Create(project, image, preferGpu)`; the CPU is the fallback with a note when no- device works. A `Gpu` attribute in an old `.wdproj` is ignored by the serializer.+ device works. A `Gpu` attribute in an old `.wdproj` is ignored by the serializer. Nothing but the+ menu item writes the setting; every change is logged with a time stamp and a CPU run caused by it+ says so (2026-10-10, after the GPU was found off twice with no known cause). Note that each exe path+ (Debug, Release, Publish) has its own `user.config` folder under `%LOCALAPPDATA%\WaveDude.WPF`, so+ check the one of the build that was running.- **Engine contract** (`IWaveEngine`): padded grid (`Stride = Width + 2`), one driver thread at atime, `PrepareFrame` before reading, CPU `FieldData` is a different array every sub-step, GPU`FieldData` a host copy. Added 2026-10-09: `CaptureFrame(FrameSnapshot, needIntensity)` /@@ -476,6 +573,88 @@ probes for `*.sln` (was `*.vbproj`, which never matched above the C# exe); NaN-s`ProbeGraphPainter`/`ProbeSettings`; `ProbeSampler` uses `!= Amplitude`; `Form1.StopRole` parity test;`HelpForm` disclaimer is the author's GPL wording.+## Author feedback (Jeroen Vleggaar, e-mail of 2026-10-10)++Thirteen points on a sneak peek of the WPF app; status as of 2026-10-12:+- Done: (3) handles misplaced after a pane move (the arrange-size bug above); (13) Enter commits a+ text edit, Escape reverts it (`Controls/EditBehavior`, set by the base `TextBox` style; the default+ binding waited for Tab) and every numeric field is a `Controls/NumberBox` (2026-10-12: a `TextBox`+ with up/down repeat buttons; Up/Down step by `Increment`, PageUp/PageDown by ten, the wheel while+ focused; each step clamps to `Minimum`/`Maximum`, commits through the `Text` binding at once and+ selects the text; the views set the model's ranges); (6) a read-only **wavelength** row in the source view+ (`Simulation.Wavelength`: λ = c / f, the author's `UpdateLambdaLabel` formula; "(nominal)" with the+ 9-point stencil, which disperses; the Properties pane got a `Project` DP for it); (8) the probe+ measurement combo offers only what the layer allows (`Probe.MeasurementsFor`, the layer setter+ coerces) and the intensity measurements read "Value" / "Integrated value" (`[Description]` on the+ enum members, honoured by `EnumNameConverter`); (9) the four random amounts of an array sit under+ their own header "Random offsets, added per emitter"; (2) the in/out tooltips say "export range".+- Done 2026-10-13: (1) a Run button (ring with a triangle, F5) left of Play, (4) two toggles left of+ the split radios show or hide each picture (bound to the layer's `Preview`, so hiding the intensity+ also stops storing it; the remaining picture takes the whole area and the splitter collapses,+ `UpdatePictureLayout`), (6/3) the scene image and its outline in the preview.+ (11) check boxes on the source and probe rows of the tree (bound to `Enabled` / `Active`,+ `ProjectCommands.ToggleEnabled` on Space and in the context menu; disabled rows read grey; rows+ carry `Tree:<name>` automation ids and the boxes `Enabled:<name>`).+ (1, second half) the step buttons now draw the frame-step look, "◀|" "|▶", instead of the players'+ skip glyphs, and the Run glyph is a 14 px ring (2026-10-13).+- Still open: "re-run automatically does not always work" (by design: display and probe edits do+ not re-run, and the run waits 1.5 s of quiet).+- Roadmap already: (7) probe graphs, (10) export, (12) project format (the user answered: images+ embedded or relative, output next to the file, the JSON format imported).+- The author also suggests dropping the 9-point Laplacian (confusing; only useful to show dispersion).++## Handoff 2026-10-14: state and next work++Everything up to here is committed in five commits (editors, colour schemes + scene image, preview+outline/toggles/tree, localisation, harnesses). Working state: a project with sources, probes, an+embedded scene image and its own colour schemes is edited in the tree and the Properties pane, the+preview shows scratch frames and stored runs with the scene outline, runs go to a temp frame store,+the language switches live, and three UI harnesses plus `library_check` are green (RunCheck 67 s,+PreviewCheck 12 s, LanguageCheck 17 s, `library_check` about 20 s). The next session is meant for+**probes** and **export**; here is what exists for each and what is decided.++**Probes (nothing drawn yet).**+- Recorded: `SimulationRun.Traces` (`ProbeTrace` per active probe, `ProbeSeries` of samples per+ visualised step, line probes as profiles), filled on the UI context in `ProbeUpdate` batches+ (at most 20 Hz). `ScratchRunner` does not sample probes; only a run has traces (decide whether a+ scratch frame should carry a single sample).+- Model: `Probe` has everything the author's graph box used: `Kind` (point/line), `Layer`,+ `Measurement` (amplitude | value | integrated value), `BoxSize`, `BoxX/BoxY` (canvas pixels),+ `ScaleMode` (running window / full run), `Window` (steps), `AutoScaleX/Y`, `YMin/YMax`,+ `StartAfter`. The handles on the pictures exist (`SceneOverlay`, ids `Probe:<name>:A|B`).+- Spec: the author's `ProbeGraphPainter.cs` / `ProbeOverlay.cs` in `Wave_Dude_2D/` (GDI+, not+ ported) draw the box over the output picture; `HelpForm.cs` describes the controls. Agreed plan: a+ **probe signal lane** under the timeline on the same time axis (roadmap item 5), and the graph box+ over the picture as the author had it. Rendering belongs in the library as pixel/geometry code (no+ GDI+); the WPF side draws it (an `OnRender` layer like `TimelineBar`). Author's point 7.++**Export (nothing wired).**+- Frames: `FrameStore.CopyLayer(frame, layer, Span<Half>)` of a run (finished, or after+ `Run.Completion`), rendered with `FrameRenderer.RenderField/RenderIntensity` and the layer's LUT+ (`ColorSchemeCatalog.LutFor(project, name, blackLevel)`, brightness), then, per layer and only when+ `DisplayLayer.OverlayInExport`, `GlowingEdges.BlendAdditive` with the layer's `OverlayGain` (the+ author bakes the outline additively; the preview only composites it). Range:+ `Display.ExportFrom/ExportTo` in **steps** (0 = start/end), one frame per `VisualizeEvery` steps.+ Which outputs: `DisplayLayer.Export`. Encoder settings: `Video.Fps`, `Video.Quality`.+- Writers: none in the library yet; the legacy `Wave_Dude_2D/MfVideoWriter.cs` (+ `IMF*Native`,+ Media Foundation SinkWriter, .mp4) and `AviMjpegWriter.cs` (MJPEG fallback, spec-exact, see+ `_tools/avi_check`) compile anywhere and were listed as movable as-is; stills can use WPF's+ `PngBitmapEncoder` on the rendered `int[]`. The author names exports with a running number+ (`_0001`, one above the highest in the folder) and stores them next to the project; the user told+ him output goes relative to the project file (the folder of `Filename`; an unsaved project must be+ saved first, like `RunErrorUnsavedImagePath`).+- Needs: a progress item (status text only today), cancellation, a menu entry (Simulation or File),+ and a decision whether export needs a finished run (simplest: export the frames that exist).+ Author's point 10.++**Also open, smaller.** Import of the author's JSON projects (`Wave_Dude_Examples/*/configuration.json`;+the legacy `ProjectConfig`/`ProjectStore` read them; the user promised the author an importer);+a colour picker dialog for stops (hex only now; WinForms `ColorDialog` needs `UseWindowsForms`);+offer `ColorScheme.Simplify` in the editor; renaming a project scheme does not update the layers that+refer to it; base64 vs BaseXML for the embedded image; the RAM-first frame store (numbers above);+dropping the 9-point Laplacian (author's suggestion, user undecided); timeline event tracks, zoom and+pan (roadmap); Help > About has no content; dock pane titles are not exposed to UI Automation.+## Roadmap1. ~~Make it compile~~ · 2. ~~clean up / document~~ · 2b. ~~AVI fix, style pass, engine refactor~~@@ -484,9 +663,10 @@ probes for `*.sln` (was `*.vbproj`, which never matched above the C# exe); NaN-skeep the `dotnet run` harness for now).4. ~~**Make the engine loop `Task`-based**~~ (`SimulationRun`, 2026-10-09).5. **WPF UI** in `WaveDude.WPF`: the preview shows a live run and replays it from the frame store- (done 2026-10-09). Next, in this order of value: **export from the store** (video and stills,- rendered with the current display settings, the export range), the **probe signal lane** and- probe markers on the pictures, a progress bar (the theme choice is persisted already).+ (done 2026-10-09); editors, colour schemes, scene image and outline, languages (done 2026-10-14,+ see the handoff section). Next, in this order of value: **probes** (graph box and signal lane),+ **export from the store** (video and stills, rendered with the current display settings, the+ export range, the outline when opted in), a progress bar.Store: a RAM-first frame store with a budget and background spill (see the numbers above),so a run is compute-bound instead of disk-bound.Timeline, agreed 2026-10-09 (the scrub bar, in/out range, transport keys and the available-framesdiff --git a/_tools/library_check/Program.cs b/_tools/library_check/Program.csindex 9b4fba6..603eba3 100644--- a/_tools/library_check/Program.cs+++ b/_tools/library_check/Program.cs@@ -1,3 +1,4 @@+using System.Globalization;using System.Diagnostics;using NLog;using WaveDude.Engine;@@ -123,6 +124,36 @@ internal static class ProgramBench(args.Length > 1 ? int.Parse(args[1]) : 1920, args.Length > 2 ? int.Parse(args[2]) : 1080);return 0;}+ if (args.Length > 2 && args[0] == "simplify-schemes")+ {+ // one-off: slims every .wdscheme of a folder with more than the editor's 9 stops to its bends (2026-10-14)+ double tolerance = double.Parse(args[2], CultureInfo.InvariantCulture);+ foreach (string file in Directory.GetFiles(args[1], "*" + ColorSchemeStore.XmlExtension))+ {+ ColorScheme scheme = ColorSchemeStore.LoadXml(file);+ int before = scheme.Stops.Count;+ if (before <= ColorScheme.StopCount)+ {+ continue;+ }+ scheme.Simplify(tolerance);+ ColorSchemeStore.SaveXml(scheme, file);+ Console.WriteLine($"{Path.GetFileName(file)}: {before} -> {scheme.Stops.Count} stops");+ }+ return 0;+ }+ if (args.Length > 1 && args[0] == "convert-schemes")+ {+ // one-off: the author's JSON files of a folder become .wdscheme files beside them (2026-10-13)+ foreach (string file in Directory.GetFiles(args[1], "*.json"))+ {+ ColorScheme scheme = ColorSchemeStore.Load(file);+ string target = ColorSchemeStore.PathFor(args[1], Path.GetFileNameWithoutExtension(file));+ ColorSchemeStore.SaveXml(scheme, target);+ Console.WriteLine($"{Path.GetFileName(file)} -> {Path.GetFileName(target)} ({scheme.Stops.Count} stops)");+ }+ return 0;+ }const int W = 64, H = 48, Steps = 200;(byte[] bgra, int stride) = ScenePixels(W, H);SceneData scene = SceneData.FromBgra(bgra, W, H, stride, true, 6);@@ -578,20 +609,79 @@ internal static class ProgramCheck(schemes.Count >= 20 && schemes.All(s => s.IsBuiltIn && s.FilePath == ""), "at least 20 schemes embedded, marked built-in");List<ColorScheme> fromFiles = ColorSchemeStore.LoadFolder(folder, null);Check(fromFiles.Count == schemes.Count && fromFiles.Select(s => s.Name).SequenceEqual(schemes.Select(s => s.Name)), "the embedded set equals the repo's ColorSchemeList folder");+ Check(fromFiles.Count > 0 && fromFiles.All(s => s.FilePath.EndsWith(ColorSchemeStore.XmlExtension, StringComparison.OrdinalIgnoreCase)), "the shipped schemes are XML (.wdscheme)");ColorScheme? field = ColorSchemeStore.Find(schemes, Display.DefaultFieldColorScheme);ColorScheme? intensity = ColorSchemeStore.Find(schemes, Display.DefaultIntensityColorScheme);Check(field != null && intensity != null, "default field and intensity schemes found (case-insensitive)");- Check(field != null && field.HasStops && field.Stops!.Length == ColorScheme.StopCount, "Default_Field has 9 stops");- Check(intensity != null && intensity.SchemeType == ColorScheme.SchemeTypeIntensity, "Default_Intensity is typed intensity");+ Check(field != null && field.IsStopScheme, "Default_Field is a 9-stop scheme (its table consolidated into the stops)");+ Check(intensity != null && intensity.Kind == ColorSchemeKind.Intensity, "Default_Intensity is typed intensity");+ Check(schemes.Count(s => s.IsStopScheme && s.IsEvenlySpaced) == 11 && schemes.All(s => s.Stops.Count <= 24), "11 shipped schemes have the author's 9 evenly spaced stops, the 12 sampled colormaps are slimmed to at most 24");+ // simplification: a ramp with one bend, sampled at 255 points, keeps its two ends and the bend only+ var ramp = new ColorScheme("ramp", Enumerable.Range(0, 255).Select(i => i <= 127 ? new Rgb((byte)(i * 2), 0, 0) : new Rgb(254, (byte)((i - 127) * 2), 0)));+ int sampled = ramp.Stops.Count;+ ramp.Simplify(1.0);+ Check(sampled == 255 && ramp.Stops.Count == 3 && Math.Abs(ramp.Stops[1].Position - 127 / 254.0) < 1e-9 && ramp.GetEntry(127) == new Rgb(254, 0, 0) && ramp.GetEntry(254) == new Rgb(254, 254, 0),+ "Simplify keeps only the bend of a two-segment ramp and the table still hits it");+ Check(Rgb.Parse("#FF8000") == new Rgb(255, 128, 0) && Rgb.Parse("[10, 20, 30]") == new Rgb(10, 20, 30) && new Rgb(1, 2, 3).ToString() == "#010203", "Rgb parses hex and triplets and prints #RRGGBB");if (field != null){+ // the author's JSON layout still comes out of a 9-stop scheme (what his program reads)string temp = Path.Combine(Path.GetTempPath(), "library_check-scheme.json");ColorSchemeStore.Save(field.Clone(field.Name), temp);- string original = File.ReadAllText(Path.Combine(folder, "Default_Field.json"));- string saved = File.ReadAllText(temp);+ string json = File.ReadAllText(temp);File.Delete(temp);- Check(saved.ReplaceLineEndings() == original.ReplaceLineEndings(), "Save reproduces the shipped file");+ Check(json.Contains("\"stops\": [[253,253,253]") && json.Contains("\"scheme_type\": \"field\""), "JSON export writes the author's stops and type");+ // the program's own format: the shipped XML round-trips byte for byte, standalone and inside a project+ string xmlPath = Path.Combine(Path.GetTempPath(), "library_check-scheme" + ColorSchemeStore.XmlExtension);+ ColorSchemeStore.SaveXml(field.Clone(field.Name), xmlPath);+ string xml = File.ReadAllText(xmlPath);+ ColorScheme back = ColorSchemeStore.LoadXml(xmlPath);+ File.Delete(xmlPath);+ string shipped = File.ReadAllText(Path.Combine(folder, "Default_Field" + ColorSchemeStore.XmlExtension));+ Check(xml.ReplaceLineEndings() == shipped.ReplaceLineEndings(), "SaveXml reproduces the shipped .wdscheme file");+ Check(xml.Contains("<Stop At=\"0.125\" Color=\"#") && !xml.Contains("xmlns"), "XML writes one Stop element per stop with its position and #RRGGBB, no namespaces");+ Check(back.Name == field.Name && back.Kind == field.Kind && back.Stops.Select(s => (s.Position, s.Color)).SequenceEqual(field.Stops.Select(s => (s.Position, s.Color))), "XML round trip keeps name, kind and the 9 stops with positions");+ var uneven = new ColorScheme("uneven", [new Rgb(0, 0, 0)]);+ uneven.SetStops([new ColorStop(0.0, new Rgb(0, 0, 0)), new ColorStop(0.25, new Rgb(255, 255, 255)), new ColorStop(1.0, new Rgb(0, 0, 255))]);+ Check(uneven.GetEntry(0) == new Rgb(0, 0, 0) && uneven.GetEntry(127) == new Rgb(170, 170, 255) && uneven.GetEntry(254) == new Rgb(0, 0, 255) && uneven.GetEntry(32) == new Rgb(129, 129, 129), "stops at any position interpolate between their neighbours (0, 0.25, 1)");+ ColorStop added = uneven.AddStop();+ Check(uneven.Stops.Count == 4 && Math.Abs(added.Position - 0.625) < 1e-9 && uneven.Stops.IndexOf(added) == 2, "AddStop fills the widest gap, in position order");+ var project = new Project();+ project.ColorSchemes.Add(field.Clone("Mine"));+ project.Scene.ImageData = [1, 2, 3, 4, 250, 0, 255];+ project.Scene.Image = "scene.png";+ project.Scene.Mode = SceneMode.Image;+ using var stream = new MemoryStream();+ project.Save(stream);+ stream.Position = 0;+ Project loaded = Project.Load(stream);+ Check(loaded.ColorSchemes.Count == 1 && loaded.ColorSchemes[0].Name == "Mine" && loaded.ColorSchemes[0].Colors.SequenceEqual(field.Colors), "a project file embeds its own schemes");+ Check(loaded.Scene.ImageData != null && loaded.Scene.ImageData.SequenceEqual(project.Scene.ImageData) && loaded.Scene.Image == "scene.png", "a project file embeds the scene image bytes (base64)");+ var edited = loaded.ColorSchemes[0];+ int changes = 0;+ edited.PropertyChanged += (_, args) => changes += args.PropertyName == nameof(ColorScheme.Stops) ? 1 : 0;+ edited.Stops[4].Color = new Rgb(1, 2, 3);+ Check(changes == 1 && edited.GetEntry(127) == new Rgb(1, 2, 3), "editing one stop notifies once and rebuilds the table");+ }+ // the author's glowing edges: a vertical black|white step at x = 2 of a 5 x 5 image+ var image = new byte[5 * 5 * 4];+ for (int y = 0; y < 5; y++)+ {+ for (int x = 2; x < 5; x++)+ {+ int o = (y * 5 + x) * 4;+ image[o] = image[o + 1] = image[o + 2] = 255;+ image[o + 3] = 255;+ }}+ byte[] edges = GlowingEdges.Compute(image, 5, 5, 20);+ int At(int x, int y) => edges[(y * 5 + x) * 4];+ Check(At(1, 1) == 255 && At(2, 2) == 255 && At(3, 2) == 0 && At(0, 2) == 0 && At(2, 0) == 0 && edges[(2 * 5 + 2) * 4 + 3] == 255,+ "glowing edges: the two columns beside the step light up (Sobel x 0.25 clamps at 255), the flat area and the outer ring stay black");+ int[] frame = new int[25];+ Array.Fill(frame, unchecked((int)0xFF404040));+ GlowingEdges.BlendAdditive(frame, 5, 5, edges, 0.5);+ Check(frame[2 * 5 + 2] == unchecked((int)0xFFBFBFBF) && frame[2 * 5 + 3] == unchecked((int)0xFF404040), "additive blend adds edge x gain per channel and leaves flat pixels alone");}private static void CheckRun()diff --git a/_tools/ui_check/Common.ps1 b/_tools/ui_check/Common.ps1index c37beaf..e420672 100644--- a/_tools/ui_check/Common.ps1+++ b/_tools/ui_check/Common.ps1@@ -21,6 +21,12 @@ public static class Native[DllImport("user32.dll")] static extern bool PostMessage(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);[DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hwnd, int cmd);+ [DllImport("user32.dll")] static extern bool SetWindowPos(IntPtr hwnd, IntPtr after, int x, int y, int cx, int cy, uint flags);++ // resizes the window in place without activating it (SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE)+ public static void Resize(IntPtr hwnd, int width, int height) { SetWindowPos(hwnd, IntPtr.Zero, 0, 0, width, height, 0x0002 | 0x0004 | 0x0010); }+ public static int WindowWidth(IntPtr hwnd) { RECT r; GetWindowRect(hwnd, out r); return r.Right - r.Left; }+ public static int WindowHeight(IntPtr hwnd) { RECT r; GetWindowRect(hwnd, out r); return r.Bottom - r.Top; }[StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left, Top, Right, Bottom; }// PW_RENDERFULLCONTENT: ask DWM for the composed content, which a hardware-rendered WPF window needs@@ -66,12 +72,24 @@ public static class Native// WM_CHAR: text input independent of the keyboard layoutpublic static void Char(IntPtr hwnd, char c) { PostMessage(hwnd, 0x0102, (IntPtr)c, (IntPtr)1); }+ // WM_SYSKEYDOWN / WM_SYSKEYUP (bit 29 = the Alt context), what the keyboard driver sends for Alt+key and F10;+ // WPF's menus and access keys listen to these, not to plain WM_KEYDOWN+ public static void SysKey(IntPtr hwnd, int vk, bool alt)+ {+ long context = alt ? (1L << 29) : 0;+ PostMessage(hwnd, 0x0104, (IntPtr)vk, (IntPtr)(1 | context));+ PostMessage(hwnd, 0x0105, (IntPtr)vk, (IntPtr)(1 | context | (1L << 30) | (1L << 31)));+ }+ // WM_SETFOCUS, posted: WPF's keyboard provider then assigns its focused element (no OS activation involved)+ public static void SetFocusMessage(IntPtr hwnd) { PostMessage(hwnd, 0x0007, IntPtr.Zero, IntPtr.Zero); }+ // WM_SYSCHAR: the character of an Alt+letter, which WPF turns into an access key (menu mnemonic)+ public static void SysChar(IntPtr hwnd, char c) { PostMessage(hwnd, 0x0106, (IntPtr)c, (IntPtr)(1 | (1L << 29))); }}"@$A = [System.Windows.Automation.AutomationElement]$VK_BACK = 0x08; $VK_TAB = 0x09; $VK_SPACE = 0x20; $VK_END = 0x23; $VK_HOME = 0x24-$VK_LEFT = 0x25; $VK_RIGHT = 0x27; $VK_PRIOR = 0x21; $VK_NEXT = 0x22; $VK_RETURN = 0x0D; $VK_ESCAPE = 0x1B+$VK_LEFT = 0x25; $VK_UP = 0x26; $VK_RIGHT = 0x27; $VK_DOWN = 0x28; $VK_PRIOR = 0x21; $VK_NEXT = 0x22; $VK_RETURN = 0x0D; $VK_ESCAPE = 0x1B$VK_F4 = 0x73; $VK_F5 = 0x74; $VK_F6 = 0x75$VK_F = 0x46; $VK_I = 0x49; $VK_O = 0x4F; $VK_X = 0x58; $VK_L = 0x4C; $VK_COMMA = 0xBC; $VK_PERIOD = 0xBE$script:failures = 0@@ -105,7 +123,7 @@ function Position() { return [int](((Frame) -split " / ")[0]) }function Playing() { return (Find "PreviewPause").Current.IsEnabled }function Selected([string]$id) { return (Pattern (Find $id) "SelectionItem").Current.IsSelected }function SpeedText() { return (Pattern (Find "PreviewSpeed") "Value").Current.Value }-function Focused([string]$id) { return (Find $id).Current.HasKeyboardFocus }+function Focused([string]$id) { return (FocusedId) -eq $id }function StepText() { return (Find "PreviewStep").Current.Name }function ToggleOn([string]$id) { return (Pattern (Find $id) "Toggle").Current.ToggleState -eq [System.Windows.Automation.ToggleState]::On }function LoopOn() { return ToggleOn "PreviewLoop" }@@ -134,32 +152,45 @@ function TreeItemSelected([string]$name) {if ($e -eq $null) { return $false }return (Pattern $e "SelectionItem").Current.IsSelected}+# the element with keyboard focus, in one UI Automation query (asking 17 ids one by one cost half a second per+# Tab and made FocusOn crawl, 2026-10-14): its automation id, "PreviewSpeed" for the editable combo's inner text+# box, else "(other: <type> '<name>')"; "(none)" when nothing in the window has focus (the window was never activated)+function FocusedElement() {+ $c = New-Object System.Windows.Automation.PropertyCondition($A::HasKeyboardFocusProperty, $true)+ return $script:win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c)+}function FocusedId() {- foreach ($id in "PreviewPlay", "PreviewPause", "PreviewStepBack", "PreviewStepForward", "PreviewSetIn", "PreviewSetOut", "PreviewClearRange", "PreviewLoop",- "PreviewLive", "PreviewSpeed", "PreviewSideBySide", "PreviewStacked", "PreviewTimeline", "PreviewSplitter") {- if (Focused $id) { return $id }+ $e = FocusedElement+ if ($e -eq $null) { return "(none)" }+ $id = $e.Current.AutomationId+ if ($id -ne "" -and -not $id.StartsWith("PART_")) { return $id }+ # the editable combo keeps focus in its inner text box (a template part, "PART_EditableTextBox"): the combo names it+ $walker = [System.Windows.Automation.TreeWalker]::ControlViewWalker+ $parent = $walker.GetParent($e)+ for ($i = 0; $i -lt 4 -and $parent -ne $null; $i++) {+ if ($parent.Current.AutomationId -eq "PreviewSpeed") { return "PreviewSpeed" }+ $parent = $walker.GetParent($parent)}- # the editable combo keeps focus in its inner text box- $c = New-Object System.Windows.Automation.PropertyCondition($A::HasKeyboardFocusProperty, $true)- if ((Find "PreviewSpeed").FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c) -ne $null) { return "PreviewSpeed" }- $other = $script:win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c)- if ($other -ne $null) { return "(other: " + $other.Current.ControlType.ProgrammaticName + " '" + $other.Current.Name + "')" }- # nothing in the window reports focus: ask the system (only meaningful while the app is foreground)- $fe = $A::FocusedElement- if ($fe -ne $null -and $fe.Current.ProcessId -eq $script:p.Id) { return "(focused: " + $fe.Current.ControlType.ProgrammaticName + " '" + $fe.Current.Name + "' " + $fe.Current.ClassName + ")" }- return "(none)"+ return "(other: " + $e.Current.ControlType.ProgrammaticName + " '" + $e.Current.Name + "')"+}+# the settle covers the app's handling of the key before the next UI Automation read; 60 ms is plenty for a binding+# update, a layout change wants ~150, a scratch frame or a run is waited for with WaitFor instead (2026-10-14)+function Key([int]$vk, [int]$settle = 60) { [Native]::Key($script:hwnd, $vk); Start-Sleep -Milliseconds $settle }+# resizes the app window by the given amounts (no activation) and lets the layout settle+function ResizeApp([int]$dw, [int]$dh) {+ [Native]::Resize($script:hwnd, ([Native]::WindowWidth($script:hwnd) + $dw), ([Native]::WindowHeight($script:hwnd) + $dh))+ Start-Sleep -Milliseconds 500}-function Key([int]$vk, [int]$settle = 150) { [Native]::Key($script:hwnd, $vk); Start-Sleep -Milliseconds $settle }# Tab (posted) until the wanted element holds focus; the cycle runs through the whole windowfunction FocusOn([string]$id) {for ($i = 0; $i -lt 80; $i++) {- if ((Focused $id) -or (FocusedId) -eq $id) { return }- Key $VK_TAB+ if ((FocusedId) -eq $id) { return }+ Key $VK_TAB 30}throw "could not reach '$id' with Tab; focus is at $(FocusedId)"}# polls a condition; returns whether it became true within the timeout-function WaitFor([scriptblock]$condition, [int]$timeoutMs = 10000, [int]$pollMs = 100) {+function WaitFor([scriptblock]$condition, [int]$timeoutMs = 10000, [int]$pollMs = 50) {$deadline = [DateTime]::Now.AddMilliseconds($timeoutMs)while ([DateTime]::Now -lt $deadline) {if (& $condition) { return $true }@@ -184,7 +215,8 @@ function Start-App([string]$Exe, [string]$ProjectFile = "") {if ($script:win -eq $null) { throw "main window not found" }$script:p.Refresh()$script:hwnd = $script:p.MainWindowHandle- Start-Sleep -Milliseconds 800+ # ready when the status bar's run item exists (the window is fully built), instead of a fixed wait+ $null = WaitFor { try { (Find "StatusRun") -ne $null } catch { $false } } 5000 50$script:park = New-Object System.Windows.Forms.Form$script:park.StartPosition = "Manual"@@ -192,14 +224,21 @@ function Start-App([string]$Exe, [string]$ProjectFile = "") {$script:park.Size = New-Object System.Drawing.Size(10, 10)$script:park.ShowInTaskbar = $false$script:park.Show(); $script:park.Activate(); [System.Windows.Forms.Application]::DoEvents()- Start-Sleep -Milliseconds 500+ Start-Sleep -Milliseconds 200for ($i = 0; $i -lt 3 -and (Foreground) -eq "APP"; $i++) {[Native]::ShowWindow($script:hwnd, 6) | Out-Null # SW_MINIMIZE: the OS activates something else- Start-Sleep -Milliseconds 300+ Start-Sleep -Milliseconds 150$script:park.Activate(); [System.Windows.Forms.Application]::DoEvents()- Start-Sleep -Milliseconds 300+ Start-Sleep -Milliseconds 150[Native]::ShowWindow($script:hwnd, 4) | Out-Null # SW_SHOWNOACTIVATE- Start-Sleep -Milliseconds 500+ Start-Sleep -Milliseconds 250+ }+ # a window that Windows never activated (the user was busy elsewhere) has no focused element, and posted keys+ # then go nowhere; a posted WM_SETFOCUS makes WPF assign its keyboard focus without activating the window+ if ((FocusedId) -eq "(none)") {+ [Native]::SetFocusMessage($script:hwnd)+ Start-Sleep -Milliseconds 150+ if ((FocusedId) -eq "(none)") { Write-Output "note: no element has keyboard focus; keys may be lost" }}Write-Output ("window: '{0}' foreground: {1}" -f $script:win.Current.Name, (Foreground))}diff --git a/_tools/ui_check/LanguageCheck.ps1 b/_tools/ui_check/LanguageCheck.ps1new file mode 100644index 0000000..38733e6--- /dev/null+++ b/_tools/ui_check/LanguageCheck.ps1@@ -0,0 +1,69 @@+# Drives View > Language by keyboard (F10 focuses the menu bar, Down opens a menu, Left/Right move between menus, Enter picks): switches to+# German, checks that menus, tooltips and property labels change at once, closes the app, starts it again+# and checks the choice was kept (the Language user setting), then switches back to System and checks the+# strings are English again. Posted keys and UI Automation properties only, as in the other harnesses.+#+# powershell -ExecutionPolicy Bypass -File _tools\ui_check\LanguageCheck.ps1 [-Trace]+param([switch]$Trace)+. (Join-Path $PSScriptRoot "Common.ps1")+$exe = Join-Path $PSScriptRoot "..\..\WaveDude.WPF\bin\Debug\net10.0-windows\WaveDude.WPF.exe"+$project = Join-Path $PSScriptRoot "tiny.wdproj"+$failures = 0+function Check([string]$name, [bool]$ok, [string]$detail = "") {+ if ($ok) { if ($Trace) { "PASS $name" } } else { "FAIL $name $detail"; $script:failures++ }+}+function MenuNames() {+ $c = New-Object System.Windows.Automation.PropertyCondition($A::ControlTypeProperty, [System.Windows.Automation.ControlType]::MenuItem)+ return ($script:win.FindAll([System.Windows.Automation.TreeScope]::Descendants, $c) | ForEach-Object { $_.Current.Name }) -join "|"+}+# any element of this name in the window (a menu entry, a tree folder, a pane title)+function MenuItemVisible([string]$name) {+ $c = New-Object System.Windows.Automation.PropertyCondition($A::NameProperty, $name)+ return ($script:win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c) -ne $null)+}+# View (2nd header) > Language (3rd entry) > the language at $index (0 = System, 1 = English, 2 = Deutsch, ...)+function Step([string]$what, [int]$vk, [int]$settle) {+ Key $vk $settle+ if ($Trace) { " {0,-12} focus {1} foreground {2}" -f $what, (FocusedId), (Foreground) }+}+function ChooseLanguage([int]$index) {+ Step "F10" 0x79 150 # the menu bar's first header (File)+ Step "Down" 0x28 150 # opens File+ Step "Right" $VK_RIGHT 150 # moves to View and opens it on its first entry+ Step "Down" 0x28 100; Step "Down" 0x28 100 # Theme, Language+ Step "Right" $VK_RIGHT 150 # opens Language on System+ for ($i = 0; $i -lt $index; $i++) { Step "Down" 0x28 100 }+ Step "Enter" $VK_RETURN 300+}++Start-App $exe $project+try {+ Check "menus are English to begin with" ((MenuNames) -eq "File|View|Simulation|Help") (MenuNames)+ Key 0x79 200; Key 0x28 200; Key $VK_RIGHT 500+ Check "F10, Down, Right opens the View menu by keyboard" (MenuItemVisible "Panes") (MenuNames)+ Key $VK_ESCAPE 150; Key $VK_ESCAPE 150+ ChooseLanguage 2+ Check "View > Language > Deutsch relabels the menus at once" ((MenuNames) -eq "Datei|Ansicht|Simulation|Hilfe") (MenuNames)+ Check "tooltips follow (Play)" ((Find "PreviewPlay").Current.Name -eq "Wiedergabe (Leertaste)") ((Find "PreviewPlay").Current.Name)+ FocusOn "Source:Source 1"+ $c = New-Object System.Windows.Automation.PropertyCondition($A::NameProperty, "Frequenz")+ Check "the Properties pane's labels follow (Frequenz)" ($script:win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c) -ne $null)+ # the dock pane titles are not exposed to UI Automation by name, so only the tree folders are checked here+ Check "the tree's folders follow at once (Sonden, Farbschemata)" ((MenuItemVisible "Sonden") -and (MenuItemVisible "Farbschemata") -and -not (MenuItemVisible "Probes"))+ Check "the app never took the foreground" ((Foreground) -ne "APP") (Foreground)+}+finally { Stop-App }++# the choice is a user setting: a fresh start comes up German+Start-App $exe $project+try {+ Check "after a restart the menus are still German (setting kept)" ((MenuNames) -eq "Datei|Ansicht|Simulation|Hilfe") (MenuNames)+ ChooseLanguage 0+ Check "View > Language > System brings English back" ((MenuNames) -eq "File|View|Simulation|Help") (MenuNames)+ Check "the folders are English again (Probes, Colour schemes)" ((MenuItemVisible "Probes") -and (MenuItemVisible "Colour schemes") -and -not (MenuItemVisible "Sonden"))+ Check "the app never took the foreground" ((Foreground) -ne "APP") (Foreground)+}+finally { Stop-App }++"$failures failure(s)"+exit $failuresdiff --git a/_tools/ui_check/PreviewCheck.ps1 b/_tools/ui_check/PreviewCheck.ps1index 94ec97c..4a2f5ea 100644--- a/_tools/ui_check/PreviewCheck.ps1+++ b/_tools/ui_check/PreviewCheck.ps1@@ -17,7 +17,7 @@ Start-App $Exetry {Check "initial readout" ((Frame) -eq "0 / 1249") (Frame)# the split orientation is a persisted user setting: start from side by side whatever the last session left- if (Selected "PreviewStacked") { FocusOn "PreviewStacked"; Key $VK_LEFT 400 }+ if (Selected "PreviewStacked") { FocusOn "PreviewStacked"; Key $VK_LEFT 200 }Check "side by side to begin with" (Selected "PreviewSideBySide")Check "play enabled, pause disabled" ((Find "PreviewPlay").Current.IsEnabled -and -not (Playing))Check "live is disabled without a run" (-not (Find "PreviewLive").Current.IsEnabled)@@ -28,9 +28,17 @@ try {FocusOn "PreviewPlay"Check "Tab reaches play while the window stays inactive" (((FocusedId) -eq "PreviewPlay") -and ((Foreground) -ne "APP")) (FocusedId)$order = @()- for ($i = 0; $i -lt 10; $i++) { Key $VK_TAB 250; $order += (FocusedId) }+ for ($i = 0; $i -lt 12; $i++) { Key $VK_TAB 120; $order += (FocusedId) }# pause, clear-range and live are disabled and skipped; the split group is one stop (its checked radio); timeline; splitter; then the pane is left- Check "tab order play > step back/forward > in > out > loop > speed > split > timeline > splitter > out of the pane" (($order[0..8] -join ",") -eq "PreviewStepBack,PreviewStepForward,PreviewSetIn,PreviewSetOut,PreviewLoop,PreviewSpeed,PreviewSideBySide,PreviewTimeline,PreviewSplitter" -and $order[9] -like "(other*") ($order -join ",")+ Check "tab order play > step back/forward > in > out > loop > speed > show field/intensity > split > timeline > splitter > out of the pane" (($order[0..10] -join ",") -eq "PreviewStepBack,PreviewStepForward,PreviewSetIn,PreviewSetOut,PreviewLoop,PreviewSpeed,PreviewShowField,PreviewShowIntensity,PreviewSideBySide,PreviewTimeline,PreviewSplitter" -and $order[11] -notlike "Preview*") ($order -join ",")+ # the picture toggles: Space on the intensity toggle hides that picture, again shows it+ FocusOn "PreviewShowIntensity"+ $fwBoth = (Find "PreviewFieldImage").Current.BoundingRectangle.Width+ Key $VK_SPACE 200+ $fwAlone = (Find "PreviewFieldImage").Current.BoundingRectangle.Width+ Check "Space on the intensity toggle hides the intensity picture and the field takes the room" (-not (ToggleOn "PreviewShowIntensity") -and ((Find "PreviewIntensityImage").Current.IsOffscreen) -and $fwAlone -gt $fwBoth * 1.5) ("field width {0} -> {1}" -f $fwBoth, $fwAlone)+ Key $VK_SPACE 200+ Check "and shows it again at the old size" ((ToggleOn "PreviewShowIntensity") -and -not ((Find "PreviewIntensityImage").Current.IsOffscreen) -and [math]::Abs((Find "PreviewFieldImage").Current.BoundingRectangle.Width - $fwBoth) -lt 2)FocusOn "PreviewPlay"Key $VK_SPACE 2000@@ -38,7 +46,7 @@ try {# the clock is the project's video frame rate, 60 fps by defaultCheck "Space on play: ~120 frames in 2 s at speed 1" ($pos -ge 90 -and $pos -le 150) "position $pos"Check "pause enabled while playing, focus handed to pause" ((Playing) -and -not (Find "PreviewPlay").Current.IsEnabled -and (Focused "PreviewPause")) (FocusedId)- Key $VK_SPACE 300+ Key $VK_SPACE 150$held = PositionStart-Sleep -Milliseconds 700Check "Space on pause: position holds, focus handed back to play" (-not (Playing) -and (Position) -eq $held -and (Focused "PreviewPlay")) ("position {0}, focus {1}" -f $held, (FocusedId))@@ -48,84 +56,84 @@ try {FocusOn "PreviewSpeed"# the drop-down lists the presets in the user's locale ("0,25" where the decimal separator is a comma)$quarter = (0.25).ToString([System.Globalization.CultureInfo]::CurrentCulture)- Key $VK_F4 400+ Key $VK_F4 200$item = $win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, (New-Object System.Windows.Automation.PropertyCondition($A::NameProperty, $quarter)))- Key $VK_ESCAPE 300+ Key $VK_ESCAPE 150Check "drop-down lists the presets in the current locale" ($item -ne $null -and $item.Current.ControlType -eq [System.Windows.Automation.ControlType]::ListItem) "looked for '$quarter'"$onePointFive = (1.5).ToString([System.Globalization.CultureInfo]::CurrentCulture)for ($i = 0; $i -lt 6; $i++) { Key $VK_BACK 30 }foreach ($ch in $onePointFive.ToCharArray()) { [Native]::Char($hwnd, $ch) }- Start-Sleep -Milliseconds 300+ Start-Sleep -Milliseconds 200Check "typed 1.5 in the locale's spelling is accepted and shown as typed" ((SpeedText) -eq $onePointFive) ("typed '{0}', shows '{1}'" -f $onePointFive, (SpeedText))for ($i = 0; $i -lt 6; $i++) { Key $VK_BACK 30 }- [Native]::Char($hwnd, [char]"4"); Start-Sleep -Milliseconds 300+ [Native]::Char($hwnd, [char]"4"); Start-Sleep -Milliseconds 200Check "typed speed 4 accepted" ((SpeedText) -eq "4") (SpeedText)- Key $VK_SPACE 300+ Key $VK_SPACE 150Check "Space in the speed box neither plays nor types" (-not (Playing) -and (SpeedText) -eq "4") (SpeedText)$before = PositionFocusOn "PreviewPlay"Key $VK_SPACE 2000- Key $VK_SPACE 300 # focus was handed to pause+ Key $VK_SPACE 150 # focus was handed to pause$delta = (Position) - $beforeCheck "speed 4: ~480 frames in 2 s" ($delta -ge 400 -and $delta -le 560) "delta $delta"# ------------------------------------------------------------ timeline keysFocusOn "PreviewTimeline"- Key $VK_END 300+ Key $VK_END 150Check "timeline End goes to the last frame" ((Frame) -eq "1249 / 1249") (Frame)Check "step readout follows (last frame x visualize every)" ((StepText) -eq "step 2498") (StepText)- Key $VK_HOME 200- Key $VK_RIGHT; Key $VK_RIGHT 300+ Key $VK_HOME 100+ Key $VK_RIGHT; Key $VK_RIGHT 150Check "timeline Home then Right twice gives frame 2" ((Position) -eq 2) (Frame)- Key $VK_PRIOR 300+ Key $VK_PRIOR 150Check "timeline PageUp steps 10 frames" ((Position) -eq 12) (Frame)- Key $VK_NEXT 300+ Key $VK_NEXT 150Check "timeline PageDown steps back 10 frames" ((Position) -eq 2) (Frame)Key $VK_SPACE 1000$playing = Playing- Key $VK_SPACE 300+ Key $VK_SPACE 150Check "Space on the timeline starts playback, Space again pauses" ($playing -and -not (Playing)) (Frame)# ------------------------------------------------------------ frame steps and in/out range (gestures work from any transport control)FocusOn "PreviewPlay"- Key $VK_HOME 200- Key $VK_PERIOD; Key $VK_PERIOD; Key $VK_PERIOD 300+ Key $VK_HOME 100+ Key $VK_PERIOD; Key $VK_PERIOD; Key $VK_PERIOD 150Check "period steps forward three frames from play button" ((Position) -eq 3) (Frame)- Key $VK_COMMA 300+ Key $VK_COMMA 150Check "comma steps back one frame" ((Position) -eq 2) (Frame)Key $VK_PRIOR 100 # no effect here: PageUp is only the timeline's keyFocusOn "PreviewTimeline"- Key $VK_HOME 100; Key $VK_PRIOR 300 # frame 10- Key $VK_I 300+ Key $VK_HOME 100; Key $VK_PRIOR 150 # frame 10+ Key $VK_I 150Check "I sets the in point at frame 10 (clear range becomes enabled)" ((Find "PreviewClearRange").Current.IsEnabled) (Frame)- Key $VK_END 300+ Key $VK_END 150for ($i = 0; $i -lt 5; $i++) { Key $VK_LEFT 60 }- Start-Sleep -Milliseconds 300- Key $VK_O 300+ Start-Sleep -Milliseconds 200+ Key $VK_O 150Check "O sets the out point at frame 1244" ((Position) -eq 1244) (Frame)- Key $VK_HOME 300+ Key $VK_HOME 150Check "Home now jumps to the in point" ((Position) -eq 10) (Frame)- Key $VK_END 300+ Key $VK_END 150Check "End now jumps to the out point" ((Position) -eq 1244) (Frame)- Key $VK_HOME 200- Key $VK_L 300+ Key $VK_HOME 100+ Key $VK_L 150Check "L turns looping on" (LoopOn)Key $VK_SPACE 2500 # 2.5 s at speed 4 = ~600 frames through a range of 1234: still inside, and still playing$pos = Position$still = Playing- Key $VK_SPACE 300+ Key $VK_SPACE 150Check "looped playback stays inside the range and keeps running" ($still -and $pos -ge 10 -and $pos -le 1244) ("position {0}, playing {1}" -f $pos, $still)- Key $VK_L 300+ Key $VK_L 150Check "L turns looping off" (-not (LoopOn))- Key $VK_X 300+ Key $VK_X 150Check "X clears the range (clear range disabled again)" (-not (Find "PreviewClearRange").Current.IsEnabled)- Key $VK_END 300+ Key $VK_END 150Check "End is the last frame again" ((Position) -eq 1249) (Frame)- Key $VK_HOME 300+ Key $VK_HOME 150# ------------------------------------------------------------ splitFocusOn "PreviewSideBySide"- Key $VK_RIGHT 400+ Key $VK_RIGHT 200Check "Right arrow focuses and selects the stacked radio" ((Focused "PreviewStacked") -and (Selected "PreviewStacked") -and -not (Selected "PreviewSideBySide")) (FocusedId)# stacked: the intensity picture sits below the field picture, both centred on the same axis$fr = (Find "PreviewFieldImage").Current.BoundingRectangle; $ir = (Find "PreviewIntensityImage").Current.BoundingRectangle@@ -136,19 +144,19 @@ try {Write-Output "screenshot: $Shot"# Tab must enter the group at the checked radio, which is now the second oneFocusOn "PreviewSpeed"- Key $VK_TAB 300+ Key $VK_TAB 150Check "Tab enters the split group at the checked (stacked) radio" (Focused "PreviewStacked") (FocusedId)- Key $VK_LEFT 400+ Key $VK_LEFT 200$fr = (Find "PreviewFieldImage").Current.BoundingRectangle; $ir = (Find "PreviewIntensityImage").Current.BoundingRectangleCheck "Left arrow selects side by side again, pictures on one row, same top" ((Selected "PreviewSideBySide") -and (Focused "PreviewSideBySide") -and [math]::Abs($ir.Top - $fr.Top) -lt 2 -and $ir.Left -gt $fr.Right) ("field {0},{1} intensity {2},{3}" -f $fr.Left, $fr.Top, $ir.Left, $ir.Top)# ------------------------------------------------------------ splitterFocusOn "PreviewSplitter"$fw0 = (Find "PreviewFieldImage").Current.BoundingRectangle.Width- Key $VK_RIGHT; Key $VK_RIGHT; Key $VK_RIGHT 400+ Key $VK_RIGHT; Key $VK_RIGHT; Key $VK_RIGHT 200$fw1 = (Find "PreviewFieldImage").Current.BoundingRectangle.WidthCheck "Right arrow on the splitter widens the field picture" ($fw1 -gt $fw0 + 20) ("width {0} -> {1}" -f $fw0, $fw1)- Key $VK_RETURN 400+ Key $VK_RETURN 200$fw2 = (Find "PreviewFieldImage").Current.BoundingRectangle.Width$iw2 = (Find "PreviewIntensityImage").Current.BoundingRectangle.WidthCheck "Enter on the splitter resets to half" ([math]::Abs($fw2 - $iw2) -lt 2 -and [math]::Abs($fw2 - $fw0) -lt 2) ("field {0} intensity {1}" -f $fw2, $iw2)diff --git a/_tools/ui_check/RunCheck.ps1 b/_tools/ui_check/RunCheck.ps1index 692b522..0d2118f 100644--- a/_tools/ui_check/RunCheck.ps1+++ b/_tools/ui_check/RunCheck.ps1@@ -25,41 +25,60 @@ try {$black = FieldHashFocusOn "Source:Source 1"Check "Tab reaches the source marker, which selects Source 1 in the tree" ((Focused "Source:Source 1") -and (TreeItemSelected "Source 1")) (FocusedId)- Key $VK_RIGHT 400+ # the Properties pane shows the source: its wavelength readout (level 120, c = 1, scale 2: 13.35 px)+ $lambda = (Find "SourceWavelength").Current.Name+ Check "the source view shows the estimated wavelength" ($lambda -match "13[,.]4 px") $lambda+ # the tree's check box: Tab to the selected row, Space flips Enabled (the check box follows), Space again restores it+ FocusOn "Tree:Source 1"+ Key $VK_SPACE 200+ Check "Space on the tree row disables the source (its check box clears)" (-not (ToggleOn "Enabled:Source 1"))+ Key $VK_SPACE 200+ Check "Space again enables it" (ToggleOn "Enabled:Source 1")+ # the number box: Up commits X + 1 at once (the marker follows), Down puts it back+ FocusOn "SourceX"+ $beforeX = (Pattern (Find "SourceX") "Value").Current.Value+ Key $VK_UP 200+ $afterX = (Pattern (Find "SourceX") "Value").Current.Value+ $upped = CentreOf "Source:Source 1"+ Check "Up in the X box adds one and moves the marker" (([int]$afterX) -eq ([int]$beforeX + 1) -and [math]::Abs(($upped[0] - $centre[0]) - $expected[2]) -lt 2) ("x $beforeX -> $afterX, marker dx {0:0.0}" -f ($upped[0] - $centre[0]))+ Key $VK_DOWN 200+ Check "Down puts it back" (((Pattern (Find "SourceX") "Value").Current.Value) -eq $beforeX)+ FocusOn "Source:Source 1"+ Key $VK_RIGHT 200$moved = CentreOf "Source:Source 1"Check "Right arrow moves the marker one canvas pixel" ([math]::Abs(($moved[0] - $centre[0]) - $expected[2]) -lt 2 -and [math]::Abs($moved[1] - $centre[1]) -lt 2) ("dx {0:0.0} expected {1:0.0}" -f ($moved[0] - $centre[0]), $expected[2])# no run yet: the edit alone makes the preview compute the shown frame from scratchCheck "a scratch frame replaces the black canvas after the edit" (WaitFor { (FieldHash) -ne $black } 6000 200)- Key $VK_LEFT 400+ Key $VK_LEFT 200$back = CentreOf "Source:Source 1"Check "Left arrow moves it back" ([math]::Abs($back[0] - $centre[0]) -lt 2) ("x {0:0} vs {1:0}" -f $back[0], $centre[0])# ------------------------------------------------------------ play without a run starts oneFocusOn "PreviewTimeline"- Key $VK_HOME 100; Key $VK_PRIOR 50; Key $VK_PRIOR 50; Key $VK_PRIOR 300 # frame 30+ Key $VK_HOME 100; Key $VK_PRIOR 50; Key $VK_PRIOR 50; Key $VK_PRIOR 150 # frame 30Check "skipped to frame 30 with no run" ((Position) -eq 30) (Frame)$dark = FieldHash- Key $VK_SPACE 200+ Key $VK_SPACE 100Check "Space starts a run when there is none" (WaitFor { (RunStatus) -like "Running:*" -or (RunStatus) -like "Completed:*" } 5000 50) (RunStatus)Check "playback went on from frame 30 once the frames existed" (WaitFor { (Position) -gt 30 } 5000 20) ("position {0}, {1}" -f (Position), (RunStatus))Check "play did not switch to live follow" (-not (LiveOn))Check "and ran to the end of the run" (WaitFor { -not (Playing) -and (Position) -eq 99 } 5000 50) (Frame)Check "the picture is not black any more" ((FieldHash) -ne $dark)FocusOn "PreviewPlay"- Key $VK_F5 200+ Key $VK_F5 100Check "F5 starts the run (status appears)" (WaitFor { (RunStatus) -ne "" } 5000) (RunStatus)Check "run completes" (WaitFor { (RunStatus) -like "Completed:*" } 30000) (RunStatus)Check "status names the steps and the engine" ((RunStatus) -match "^Completed: 200 / 200 steps, (CPU|GPU)") (RunStatus)- Start-Sleep -Milliseconds 500+ Start-Sleep -Milliseconds 200Check "preview followed the run to its last frame; Live is off again once it ended" (-not (LiveOn) -and (Frame) -eq "99 / 99") ("live {0}, {1}" -f (LiveOn), (Frame))Check "live button disabled after the run, play enabled" (-not (Find "PreviewLive").Current.IsEnabled -and (Find "PreviewPlay").Current.IsEnabled)$late = FieldHashKey $VK_COMMA 500Check "comma steps back to frame 98" ((Frame) -eq "98 / 99") (Frame)- Key $VK_HOME 600+ Key $VK_HOME 300Check "Home goes to frame 0" ((Frame) -eq "0 / 99") (Frame)$early = FieldHashCheck "the field picture differs between frame 0 and the last frame" ($early -ne $late) ("{0} vs {1}" -f $early.Substring(0, 8), $late.Substring(0, 8))- Key $VK_F 300+ Key $VK_F 150Check "F does nothing once the run has ended" (-not (LiveOn) -and (Frame) -eq "0 / 99") ("live {0}, {1}" -f (LiveOn), (Frame))Key $VK_END 500Check "End goes to the last frame" ((Frame) -eq "99 / 99") (Frame)@@ -70,30 +89,39 @@ try {Check "both pictures carry the source marker" ($all.Count -eq 2) ("found " + $all.Count)$second = $all[1].Current.BoundingRectangleCheck "the intensity picture's marker sits at the source too" ([math]::Abs(($second.Left + $second.Width / 2) - $expected[0]) -lt 3 -and [math]::Abs(($second.Top + $second.Height / 2) - $expected[1]) -lt 3) ("marker {0:0},{1:0} expected {2:0},{3:0}" -f ($second.Left + $second.Width / 2), ($second.Top + $second.Height / 2), $expected[0], $expected[1])+ # the handles must follow a resize of the pictures in the same layout pass (they lagged one pass behind once)+ ResizeApp -160 -120+ $shrunk = CanvasPoint "PreviewFieldImage" 64 48 20 24+ $centre = CentreOf "Source:Source 1"+ Check "after shrinking the window the marker is still at the source" ([math]::Abs($centre[0] - $shrunk[0]) -lt 3 -and [math]::Abs($centre[1] - $shrunk[1]) -lt 3 -and [math]::Abs($shrunk[2] - $expected[2]) -gt 0.01) ("marker {0:0},{1:0} expected {2:0},{3:0} (scale {4:0.00} was {5:0.00})" -f $centre[0], $centre[1], $shrunk[0], $shrunk[1], $shrunk[2], $expected[2])+ ResizeApp 160 120+ $grown = CanvasPoint "PreviewFieldImage" 64 48 20 24+ $centre = CentreOf "Source:Source 1"+ Check "and after growing it back" ([math]::Abs($centre[0] - $grown[0]) -lt 3 -and [math]::Abs($centre[1] - $grown[1]) -lt 3) ("marker {0:0},{1:0} expected {2:0},{3:0}" -f $centre[0], $centre[1], $grown[0], $grown[1])# ------------------------------------------------------------ live: an edit after the run# both pictures compared below are taken with the marker focused, so its highlight is the same in bothFocusOn "Source:Source 1"- Start-Sleep -Milliseconds 300+ Start-Sleep -Milliseconds 200$stored = FieldHash- Key $VK_RIGHT 200+ Key $VK_RIGHT 100Check "moving the source marks the run stale" (WaitFor { (RunStatus) -like "*edited since*" } 3000) (RunStatus)Check "the shown frame is recomputed from scratch before any run" (WaitFor { (FieldHash) -ne $stored } 6000 200)Check "the stored run is redone automatically after the edit" (WaitFor { (RunStatus) -like "Completed:*" -and (RunStatus) -notlike "*edited since*" } 20000 200) (RunStatus)Check "the preview kept its position through the re-run" ((Frame) -eq "99 / 99") (Frame)- Key $VK_LEFT 200+ Key $VK_LEFT 100Check "moving it back: stale, then re-run" ((WaitFor { (RunStatus) -like "*edited since*" } 3000) -and (WaitFor { (RunStatus) -like "Completed:*" -and (RunStatus) -notlike "*edited since*" } 20000 200)) (RunStatus)- Start-Sleep -Milliseconds 800+ Start-Sleep -Milliseconds 200Check "the re-run reproduces the original frame (same picture)" ((FieldHash) -eq $stored) ("{0} vs {1}" -f (FieldHash).Substring(0, 8), $stored.Substring(0, 8))FocusOn "PreviewPlay"Key $VK_SPACE 100$moving = WaitFor { $p = Position; $p -gt 0 -and $p -lt 99 } 3000 20$live = LiveOn- Key $VK_SPACE 200+ Key $VK_SPACE 100Check "Space plays the stored frames from the start (live off)" ($moving -and -not $live) (Frame)# a second F5 replaces the run and its frames- Key $VK_F5 200+ Key $VK_F5 100Check "second run completes" (WaitFor { (RunStatus) -like "Completed:*" } 30000) (RunStatus)- Start-Sleep -Milliseconds 500+ Start-Sleep -Milliseconds 200Check "the new run was followed to its last frame" ((Frame) -eq "99 / 99") ("live {0}, {1}" -f (LiveOn), (Frame))Check "the app never took the foreground" ((Foreground) -ne "APP") (Foreground)}@@ -106,33 +134,33 @@ Start-App $Exe (Join-Path $PSScriptRoot "tiny_long.wdproj")try {Check "long project loaded: 2000 frames" ((Frame) -eq "0 / 1999") (Frame)FocusOn "PreviewPlay"- Key $VK_F5 200+ Key $VK_F5 100Check "F5: running" (WaitFor { (RunStatus) -like "Running:*" } 10000) (RunStatus)- Start-Sleep -Milliseconds 1500+ $null = WaitFor { (Position) -ge 2 } 5000 50$f1 = Position- Start-Sleep -Milliseconds 1500- $f2 = Position- Check "live preview advances while the run is in progress" ((LiveOn) -and $f2 -gt $f1) ("{0} -> {1}" -f $f1, $f2)- Key $VK_F6 200+ $advanced = WaitFor { (Position) -gt $f1 } 5000 50+ Check "live preview advances while the run is in progress" ((LiveOn) -and $advanced) ("{0} -> {1}" -f $f1, (Position))+ Key $VK_F6 100Check "F6 pauses" (WaitFor { (RunStatus) -like "Paused:*" } 5000) (RunStatus)$held = RunStatus- Start-Sleep -Milliseconds 800+ Start-Sleep -Milliseconds 200Check "paused run holds its step count" ((RunStatus) -eq $held) (RunStatus)- Key $VK_F6 200+ Key $VK_F6 100Check "F6 resumes" (WaitFor { (RunStatus) -like "Running:*" } 5000) (RunStatus)- Key $VK_ESCAPE 200+ $null = WaitFor { (Position) -ge 40 } 20000 50 # enough frames for the scrub checks below, however fast the keys are+ Key $VK_ESCAPE 100Check "Esc stops the run" (WaitFor { (RunStatus) -like "Stopped:*" } 10000) (RunStatus)- Start-Sleep -Milliseconds 500+ Start-Sleep -Milliseconds 200$last = PositionCheck "the frames computed so far stay, the preview on the newest one, Live off" (-not (LiveOn) -and $last -gt 0 -and (Frame) -eq ("{0} / {0}" -f $last)) (Frame)Key $VK_HOME 500Check "Home scrubs back to frame 0 of the partial run" ((Frame) -eq ("0 / {0}" -f $last)) (Frame)# ------------------------------------------------------------ an edit during an automatic re-run stops itFocusOn "PreviewTimeline"- Key $VK_HOME 100; Key $VK_PRIOR 50; Key $VK_PRIOR 50; Key $VK_PRIOR 300 # frame 30 of the 40 that exist+ Key $VK_HOME 100; Key $VK_PRIOR 50; Key $VK_PRIOR 50; Key $VK_PRIOR 150 # frame 30 of the 40 that existCheck "scrubbed to frame 30 of the stopped run" ((Position) -eq 30) (Frame)FocusOn "Source:Source 1"- Key $VK_RIGHT 200+ Key $VK_RIGHT 100Check "an edit after the stopped run starts an automatic re-run" (WaitFor { (RunStatus) -like "Running:*" } 6000 100) (RunStatus)Check "the position stayed at frame 30 and Live is off" ((Position) -eq 30 -and -not (LiveOn)) (Frame)Key $VK_RIGHT 100@@ -140,8 +168,8 @@ try {Check "the cancelled run does not pull the position back" ((Position) -eq 30) (Frame)Check "and a fresh automatic run starts after the quiet period" (WaitFor { (RunStatus) -like "Running:*" } 6000 100) (RunStatus)Check "the position is still frame 30" ((Position) -eq 30) (Frame)- Key $VK_ESCAPE 300- Key $VK_LEFT 50; Key $VK_LEFT 300+ Key $VK_ESCAPE 150+ Key $VK_LEFT 50; Key $VK_LEFT 150Key $VK_ESCAPE 100Check "the app never took the foreground" ((Foreground) -ne "APP") (Foreground)}