Port · Parity: every page matches gpui 0.2.2's; the rules re-tested
Every page and scripted state was shot with gpui 0.2.2 and with the port, light and dark, full width and at 280px, judged pair by pair by agents with skeptics, and every page's log diffed. What differed is fixed, each with a test that fails without it where the test platform can show it: - The gallery's harness takes posted mouse moves (gpui_macos listens to a tracking area), posts each drag move twice (it no longer replays a held drag), and waits three frames before each shot. - Rolling digits: a block column, so taffy 0.13 lends the cell no baseline, and a line of whole device pixels, since gpui snaps each length on its own. DescriptionList's row aligns ends. - Margins that taffy 0.13 collapses through a plain block: the drawer's pull and snap, the stagger and transition rise, the dialog and palette rises, the fullscreen dialog's slide. - An Input keeps room to type in a squeezed row; the field rows drop w_full, whose reason was taffy 0.9's. AGENTS.md's rules that named gpui 0.2.2 or taffy 0.9 were re-tested against both sources and rewritten, and new ones say what the port changed. TASKS.md's tags follow: what the new gpui makes possible is prove. Captions, doc comments and README say what holds now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
41368430f5
commit
d7272e88bd
44 files changed
+535
-138
No files matched your search
@@ -1,6 +1,7 @@
|
||||
use std::{path::PathBuf, time::Duration};
|
||||
|
||||
use anyhow::{Context as _, Result};
|
||||
use futures::future::{Either, select};
|
||||
use gpui::{AsyncApp, Bounds, Keystroke, Pixels, Point, WindowHandle, point, px};
|
||||
|
||||
use crate::{
|
||||
@@ -53,6 +54,8 @@ pub enum Step {
|
||||
}
|
||||
|
||||
const FRAME: Duration = Duration::from_millis(120);
|
||||
/// How long a shot waits for each frame of the window it shoots.
|
||||
const SHOWN: Duration = Duration::from_secs(5);
|
||||
/// How long an out-of-process file panel may take to open.
|
||||
const PANEL: Duration = Duration::from_secs(10);
|
||||
const DRAG_STEPS: u32 = 10;
|
||||
@@ -148,10 +151,13 @@ pub async fn play(
|
||||
last.x + (goal.x - last.x) * t,
|
||||
last.y + (goal.y - last.y) * t,
|
||||
);
|
||||
send(window, Mouse::Drag, at, cx)?;
|
||||
cx.background_executor()
|
||||
.timer(Duration::from_millis(16))
|
||||
.await;
|
||||
// Each move twice, as gpui 0.2.2 replayed a held drag; gpui_macos replays only under a real button.
|
||||
for _ in 0..2 {
|
||||
send(window, Mouse::Drag, at, cx)?;
|
||||
cx.background_executor()
|
||||
.timer(Duration::from_millis(16))
|
||||
.await;
|
||||
}
|
||||
}
|
||||
last = goal;
|
||||
}
|
||||
@@ -188,12 +194,14 @@ pub async fn play(
|
||||
}
|
||||
Step::Shot(name) => {
|
||||
let file = path(name);
|
||||
shown(window.into(), cx).await?;
|
||||
snapshot(window.update(cx, |_, window, _| number(window))??, &file)?;
|
||||
log::info!("script: wrote {}", file.display());
|
||||
}
|
||||
Step::ShotWindow(key, name) => {
|
||||
let file = path(name);
|
||||
let handle = opened(key, cx)?;
|
||||
shown(handle, cx).await?;
|
||||
snapshot(handle.update(cx, |_, window, _| number(window))??, &file)?;
|
||||
log::info!("script: wrote {}", file.display());
|
||||
}
|
||||
@@ -247,6 +255,24 @@ pub async fn play(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Waits three frames: the first draws what the steps left, and AppKit shows it by the third, since gpui presents without waiting on the GPU.
|
||||
pub async fn shown(window: gpui::AnyWindowHandle, cx: &mut AsyncApp) -> Result<()> {
|
||||
for _ in 0..3 {
|
||||
let (drawn, frame) = futures::channel::oneshot::channel();
|
||||
window.update(cx, |_, window, _| {
|
||||
window.on_next_frame(move |_, _| drawn.send(()).unwrap_or_default())
|
||||
})?;
|
||||
match select(frame, cx.background_executor().timer(SHOWN)).await {
|
||||
Either::Left((Ok(()), _)) => {}
|
||||
Either::Left((Err(_), _)) => anyhow::bail!("the window dropped its frame callback"),
|
||||
Either::Right(_) => {
|
||||
anyhow::bail!("the window drew no frame in {SHOWN:?}; is it hidden?")
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Presses a key without holding the root view; Enter and Space also release through AppKit, since components pick on release.
|
||||
fn press(window: gpui::AnyWindowHandle, stroke: Keystroke, cx: &mut AsyncApp) -> Result<()> {
|
||||
let release = match stroke.key.as_str() {
|
||||
|
||||
Reference in new issue
Block a user