M7: test platform — Platform traits, Application, TestPlatform, VisualTestContext (#7)

This commit was merged in pull request #7.
This commit is contained in:
nandi committed 2026-11-24 23:54:56 +00:00
1 parent fbe4c081e6
commit 73c67825b2
25 files changed
+3592 -83

No files matched your search

+7 -6
View File
@@ -17,18 +17,19 @@ roadmap.
| `experiments/gpui/style` | `style.rs`, `styled.rs`, Refineable, gpui_macros style helpers | Ported (`Style`/`StyleRefinement`, the full `Styled` fluent API) |
| `experiments/gpui/app` | `app.rs`, `entity_map.rs`, `context.rs`, `subscription.rs` | Ported (entities, contexts, notify/observe, typed events and globals, effect flushing) |
| `experiments/gpui/executor` | `executor.rs`, `scheduler` crate | Ported (tasks, timers, cancellation, deterministic test dispatcher; single thread) |
| `experiments/gpui/input` | mouse events of `interactive.rs` | Ported (mouse events, modifiers) |
| `experiments/gpui/window` | `window.rs`, `element.rs`, `view.rs` | Ported, headless (frame lifecycle, views, hitboxes, mouse dispatch, painting) |
| `experiments/gpui/input` | mouse/window input of `interactive.rs` | Ported (mouse events, modifiers, `PlatformInput`, `DispatchEventResult`) |
| `experiments/gpui/window` | `window.rs`, `element.rs`, `view.rs`, `app.rs` | Ported, headless (`Application`, `PlatformWindow` integration, frame lifecycle, views, hitboxes, mouse dispatch, painting) |
| `experiments/gpui/elements` | `elements/div.rs`, `elements/canvas.rs` | Ported (`div` with styles, hover, clicks and mouse listeners; `canvas`) |
| `experiments/gpui/layout` | `taffy.rs` | Ported on [`Milky2018/chicle`](https://mooncakes.io/docs/Milky2018/chicle) (flexbox, grid, block) |
| `experiments/gpui/platform` | `platform.rs` | Ported (core `Platform`/`PlatformWindow` traits, window options/params, clipboard) |
| `experiments/gpui/platform/test` | `platform/test/*`, `app/test_context.rs` | Ported (`TestPlatform`, `TestWindow`, `TestAppContext`, `VisualTestContext`) |
## Example
Nothing is shown on screen yet (the renderer comes with M8). `src/examples/card`
is a view rendering a `div()` card with GPUI's fluent API; a headless window
lays it out, paints it into a `Scene`, and dispatches a simulated hover and
click (which expands the card). It prints the scene's draw batches and
quads:
is a view rendering a `div()` card with GPUI's fluent API inside a
`TestPlatform` window; `VisualTestContext` simulates a hover and click while
pumping frames automatically, and prints the scene's draw batches and quads:
```sh
moon run src/examples/card --target js