From dfdc37c74232dda04b845b6bcf9c9b30d8b0e24d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 29 Nov 2026 04:34:25 +0000 Subject: [PATCH] Framework sync, platform area: resolve the conflicts of craft-libs main 07a8c471ed automation: upstream's frozen-clock and ended-connection server hooks join the port's ServerLimits as ServeOptions {limits, clock, ended}; serve_with and listen_with take impl Into, so ServerLimits callers are unchanged. AuthDeadlineStream keeps upstream's DeadlineClock. ControlChannel keeps the port's held request and upstream's held-OK waiters. ui.drag is upstream's {from, to, button, steps, modifiers} form; the port's drag trial is carried to it with the same assertions. draw: TransformBox keeps the port's BoxLook and takes upstream's handle_side; the port's shared hit declarations use upstream's reach_of_handles. settings: DiskFiles::read_bytes carries upstream's MAX_CONFIG_BYTES cap. platform: both logger trials kept (port's attach trial, upstream's poisoned sink). ui-canvas: the tool pass reports upstream's held Space on the port's env read; CanvasScrollbars::clear_of takes the port's ShownBars. Co-Authored-By: Claude Opus 5.5 --- crates/automation/README.md | 8 +- crates/automation/src/control.rs | 5 +- crates/automation/src/security.rs | 12 +- crates/automation/src/server.rs | 155 ++++++------------ crates/automation/src/synthetic.rs | 56 +------ crates/automation/tests/it/control.rs | 41 +---- crates/automation/tests/it/synthetic.rs | 60 +++---- crates/draw/src/ui/transform/transform_box.rs | 46 +----- crates/draw/tests/it/transform_box.rs | 8 - crates/platform/src/logs_tests.rs | 22 +-- crates/settings/src/files.rs | 15 +- crates/ui-canvas/src/canvas/mod.rs | 5 - crates/ui-canvas/src/canvas/scrollbars/mod.rs | 39 ++--- .../ui-canvas/tests/it/canvas/scrollbars.rs | 17 +- 14 files changed, 111 insertions(+), 378 deletions(-) diff --git a/crates/automation/README.md b/crates/automation/README.md index 97a3effa6f..5afe6ebb78 100644 --- a/crates/automation/README.md +++ b/crates/automation/README.md @@ -14,13 +14,9 @@ Features: `ui` (the egui parts), `agents` (agents in the open window: the launch | `security` | Tokens (`generate_token`, `validate_token`, `server_token`, `client_token`), the authentication handshake (`ServerHandshake`: the challenge handshake, which never sends the token, or the one-frame `auth {token}`), bounded line reads, connection and request limits. | | `protocol` | The JSON-lines wire format: one `{"id", "method", "params"}` request per line, one `{"id", "ok", "result" | "error"}` reply per line; `Params` validators that name the bad parameter. | | `control` | `ControlRequest`, `Reply`, `Dispatch` and `ControlChannel`: the UI-thread side that drains requests between frames, replies after injected input or a background job settles, and admits screenshots. The app supplies the method table. | -<<<<<<< HEAD -| `synthetic` | `Click`, `Move`, `Drag`, `Wheel`, `KeyPress` and `Release`: the validated parameters of `ui.click`, `ui.move` (also to the centre of a node named by `label` or `id`), `ui.drag` (a held press, `steps` moves and the release), `ui.wheel` (`unit: "points"` or `"lines"`), `ui.key` and `ui.release`, each point a screen point, a document point or a `control` target, and `input_method`'s `ui.ime` `{preedit, cursor}` and `{commit}` forms, queued through `WindowHost::inject_*` one step per pass. | -======= -| `synthetic` | `Click`, `Move`, `Drag`, `Wheel`, `KeyPress` and `Release`: the validated parameters of `ui.click`, `ui.move`, `ui.drag` (a press, moves in even steps and the release, from one request), `ui.wheel` (`unit: "points"` or `"lines"`), `ui.key` and `ui.release`, each point a screen point, a document point or a `control` target, and `input_method`'s `ui.ime` `{preedit, cursor}` and `{commit}` forms, queued through `WindowHost::inject_*` one step per pass. | ->>>>>>> 07a8c471ed +| `synthetic` | `Click`, `Move`, `Drag`, `Wheel`, `KeyPress` and `Release`: the validated parameters of `ui.click`, `ui.move` (also to the centre of a node named by `label` or `id`), `ui.drag` (a press, moves in even steps and the release, from one request), `ui.wheel` (`unit: "points"` or `"lines"`), `ui.key` and `ui.release`, each point a screen point, a document point or a `control` target, and `input_method`'s `ui.ime` `{preedit, cursor}` and `{commit}` forms, queued through `WindowHost::inject_*` one step per pass. | | `access` | Named controls over the window's access tree (`ui` feature): `Target` (`{name, role?, within?, index?}`, found in reading order), `describe`, and `access_method`, which answers `ui.find` from the tree `ControlChannel::poll_input` has the host keep. | -| `server` | `listen` (bind a port) and `serve` (a listener bound earlier), or `listen_with` / `serve_with` with `ServerLimits`: the loopback TCP server that authenticates each connection and forwards requests to the channel, until its `Listening` is dropped. | +| `server` | `listen` (bind a port) and `serve` (a listener bound earlier), or `listen_with` / `serve_with` with `ServerLimits` or `ServeOptions` (the limits, the clock the authentication deadline is read against, and a signal for each ended connection): the loopback TCP server that authenticates each connection and forwards requests to the channel, until its `Listening` is dropped. | | `client` | `ControlClient`: connect, authenticate, call (a screenshot is `call("ui.screenshot", ..)`); for integration tests and CLIs. | | `screenshot` | `Captures`: the bounded, cancellable screenshot queue over `WindowHost::screenshot`, with settling, geometry epochs, retries and the PNG reply. | | `profiler` | `FrameStages` and `SlowFrames`: where a frame's time went, the slow ones kept for the control channel's `perf` output and one log line a second. | diff --git a/crates/automation/src/control.rs b/crates/automation/src/control.rs index ebc0eb6fe7..b12ec5fcea 100644 --- a/crates/automation/src/control.rs +++ b/crates/automation/src/control.rs @@ -199,18 +199,15 @@ pub struct ControlChannel { impl ControlChannel { /// Attach a transport's receiver (TCP, stdin, tests). pub fn new(rx: Receiver) -> Self { -<<<<<<< HEAD - Self { rx, held: None, input_waiters: Vec::new(), job_waiters: Vec::new(), tree_waiters: Vec::new(), captures: Captures::default() } -======= Self { rx, + held: None, input_waiters: Vec::new(), job_waiters: Vec::new(), tree_waiters: Vec::new(), held_waiters: Vec::new(), captures: Captures::default(), } ->>>>>>> 07a8c471ed } /// The next request to run, claimed through [`Dispatch::start`]. Expired or abandoned diff --git a/crates/automation/src/security.rs b/crates/automation/src/security.rs index 19879b1acc..eebbcfec66 100644 --- a/crates/automation/src/security.rs +++ b/crates/automation/src/security.rs @@ -490,12 +490,6 @@ pub fn configure_stream(stream: &std::net::TcpStream) -> std::io::Result<()> { stream.set_write_timeout(Some(IO_TIMEOUT)) } -<<<<<<< HEAD -/// A read wrapper that fails once the supplied `ServerLimits::auth_deadline` ([`AUTH_DEADLINE`] by default) -/// passes without [`Self::authenticated`] being called, whatever the client sends meanwhile; -/// after that only [`IO_TIMEOUT`] applies. -#[derive(Debug)] -======= /// The time an [`AuthDeadlineStream`] reads its deadline against: [`Instant::now`] in a server, or a time a test sets /// by hand. pub type DeadlineClock = std::sync::Arc Instant + Send + Sync>; @@ -505,9 +499,9 @@ pub fn real_clock() -> DeadlineClock { std::sync::Arc::new(Instant::now) } -/// A read wrapper that fails once [`AUTH_DEADLINE`] passes without [`Self::authenticated`] being -/// called, whatever the client sends meanwhile; after that only [`IO_TIMEOUT`] applies. ->>>>>>> 07a8c471ed +/// A read wrapper that fails once the supplied `ServerLimits::auth_deadline` ([`AUTH_DEADLINE`] by default) +/// passes without [`Self::authenticated`] being called, whatever the client sends meanwhile; +/// after that only [`IO_TIMEOUT`] applies. pub struct AuthDeadlineStream { inner: std::net::TcpStream, deadline: Option, diff --git a/crates/automation/src/server.rs b/crates/automation/src/server.rs index fcef060686..8dd7eb187e 100644 --- a/crates/automation/src/server.rs +++ b/crates/automation/src/server.rs @@ -16,13 +16,8 @@ use serde_json::{Value, json}; use crate::control::{ControlRequest, REPLY_DEADLINE}; use crate::protocol::{MAX_RESPONSE_BYTES, write_reply}; use crate::security::{ -<<<<<<< HEAD - AUTH_DEADLINE, AuthDeadlineStream, AuthStep, ConnectionLimiter, ConnectionPermit, LineRead, MAX_CONNECTIONS, MAX_REQUEST_BYTES, ServerHandshake, - configure_stream, read_bounded_line, repeat_auth_reply, -======= - AUTH_DEADLINE, AuthDeadlineStream, AuthStep, ConnectionLimiter, DeadlineClock, LineRead, MAX_CONNECTIONS, MAX_REQUEST_BYTES, ServerHandshake, - configure_stream, read_bounded_line, real_clock, repeat_auth_reply, ->>>>>>> 07a8c471ed + AUTH_DEADLINE, AuthDeadlineStream, AuthStep, ConnectionLimiter, ConnectionPermit, DeadlineClock, LineRead, MAX_CONNECTIONS, MAX_REQUEST_BYTES, + ServerHandshake, configure_stream, read_bounded_line, real_clock, repeat_auth_reply, }; /// Caps on authenticated request and reply lines, and the time a connection has to authenticate. @@ -61,13 +56,46 @@ impl ServerLimits { } } -/// Serves a listener under the supplied caps, waiting after failed accepts and bounding refused drains. +/// How [`serve_with`] runs a server: its [`ServerLimits`], the clock its authentication deadline is +/// read against, and a signal for each ended connection. A [`ServerLimits`] converts into the +/// options with the real clock and no signal. +pub struct ServeOptions { + /// The caps on lines and the time a connection has to authenticate. + pub limits: ServerLimits, + /// The clock the authentication deadline is read against. + pub clock: DeadlineClock, + /// Sent `()` each time a connection has ended: its request sender is dropped and its place under + /// [`MAX_CONNECTIONS`] is free again. + pub ended: Option>, +} + +impl Default for ServeOptions { + fn default() -> Self { + ServerLimits::default().into() + } +} + +impl From for ServeOptions { + fn from(limits: ServerLimits) -> Self { + Self { limits, clock: real_clock(), ended: None } + } +} + +impl std::fmt::Debug for ServeOptions { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ServeOptions").field("limits", &self.limits).field("ended", &self.ended.is_some()).finish_non_exhaustive() + } +} + +/// Serves a listener under the supplied caps ([`ServerLimits`], or [`ServeOptions`] with a clock and an ended-connection +/// signal), waiting after failed accepts and bounding refused drains. pub fn serve_with( listener: TcpListener, token: String, host: WindowHost, - limits: ServerLimits, + options: impl Into, ) -> std::io::Result<(Receiver, Listening)> { + let ServeOptions { limits, clock, ended } = options.into(); let (tx, rx) = channel::(); let addr = listener.local_addr()?; // Inspection must work for the first request, before any connection has arrived. @@ -102,12 +130,18 @@ pub fn serve_with( let tx = tx.clone(); let host = host.clone(); let token = Arc::clone(&token); + let clock = Arc::clone(&clock); + let ended = ended.clone(); std::thread::spawn(move || { - serve_connection(stream, &token, &tx, &host, limits); + serve_connection(stream, &token, &tx, &host, limits, clock); + drop(tx); // The last client's held input needs releasing; other live clients keep theirs. if permit.release() { host.end_injection(); } + if let Some(ended) = ended { + let _ = ended.send(()); + } }); } })?; @@ -115,8 +149,8 @@ pub fn serve_with( } /// Binds `127.0.0.1:port` and serves it under the supplied limits. -pub fn listen_with(port: u16, token: String, host: WindowHost, limits: ServerLimits) -> std::io::Result<(Receiver, Listening)> { - serve_with(TcpListener::bind(("127.0.0.1", port))?, token, host, limits) +pub fn listen_with(port: u16, token: String, host: WindowHost, options: impl Into) -> std::io::Result<(Receiver, Listening)> { + serve_with(TcpListener::bind(("127.0.0.1", port))?, token, host, options) } // Exhausted file descriptors can make every accept fail; retrying immediately would spin. @@ -182,105 +216,14 @@ pub fn serve(listener: TcpListener, token: String, host: WindowHost) -> std::io: serve_with(listener, token, host, ServerLimits::default()) } -<<<<<<< HEAD /// Serve one connection: it must authenticate ([`ServerHandshake`]) within `limits.auth_deadline` of -/// connecting, however much it sends meanwhile; after that only the idle timeout applies. -fn serve_connection(stream: TcpStream, token: &str, tx: &Sender, host: &WindowHost, limits: ServerLimits) { -======= -/// [`serve`] with `auth_deadline` in place of [`AUTH_DEADLINE`], so a test sees a connection closed at the deadline -/// without waiting the real one. -#[doc(hidden)] -pub fn serve_with_deadline( - listener: TcpListener, - token: String, - host: WindowHost, - auth_deadline: Duration, -) -> std::io::Result<(Receiver, Listening)> { - serve_with(listener, token, host, ServeOptions { auth_deadline, ..ServeOptions::default() }) -} - -/// What a test sets on a server [`serve_with`] starts. -#[doc(hidden)] -pub struct ServeOptions { - /// How long a connection has to authenticate ([`AUTH_DEADLINE`] in [`serve`]). - pub auth_deadline: Duration, - /// The clock the authentication deadline is read against. - pub clock: DeadlineClock, - /// Sent `()` each time a connection has ended: its request sender is dropped and its place under - /// [`MAX_CONNECTIONS`] is free again. - pub ended: Option>, -} - -impl Default for ServeOptions { - fn default() -> Self { - Self { auth_deadline: AUTH_DEADLINE, clock: real_clock(), ended: None } - } -} - -/// [`serve`] with the authentication deadline, its clock and a signal for each ended connection set by a test. -#[doc(hidden)] -pub fn serve_with( - listener: TcpListener, - token: String, - host: WindowHost, - options: ServeOptions, -) -> std::io::Result<(Receiver, Listening)> { - let ServeOptions { auth_deadline, clock, ended } = options; - let (tx, rx) = channel::(); - let addr = listener.local_addr()?; - // `ui.inspect`, `ui.click {label}` and `ui.focus` read the kept tree of the last presented frame; it is kept - // from before the first connection, so the first request already finds it. - host.keep_access_tree(); - let stop = Arc::new(AtomicBool::new(false)); - let stopped = Arc::clone(&stop); - let accept = std::thread::Builder::new().name("control server".into()).spawn(move || { - let limiter = ConnectionLimiter::new(MAX_CONNECTIONS); - let token = Arc::new(token); - for mut stream in listener.incoming().flatten() { - if stopped.load(Ordering::Acquire) { - break; - } - let Some(permit) = limiter.try_acquire() else { - let _ = configure_stream(&stream); - let _ = writeln!(stream, "{}", json!({"id": null, "ok": false, "error": "connection limit reached"})); - close_after_reply(&stream); - continue; - }; - let tx = tx.clone(); - let host = host.clone(); - let token = Arc::clone(&token); - let clock = Arc::clone(&clock); - let ended = ended.clone(); - std::thread::spawn(move || { - serve_connection(stream, &token, &tx, &host, auth_deadline, clock); - drop(tx); - // What the last client held down would otherwise stay held with no one left to - // release it; while another connection is live, its input is left alone. - if permit.release() { - host.end_injection(); - } - if let Some(ended) = ended { - let _ = ended.send(()); - } - }); - } - })?; - Ok((rx, Listening { addr, stop, accept: Some(accept) })) -} - -/// Serve one connection: it must authenticate ([`ServerHandshake`]) within `auth_deadline` of -/// connecting, however much it sends meanwhile; after that only the idle timeout applies. -fn serve_connection(stream: TcpStream, token: &str, tx: &Sender, host: &WindowHost, auth_deadline: Duration, clock: DeadlineClock) { ->>>>>>> 07a8c471ed +/// connecting, read against `clock`, however much it sends meanwhile; after that only the idle timeout applies. +fn serve_connection(stream: TcpStream, token: &str, tx: &Sender, host: &WindowHost, limits: ServerLimits, clock: DeadlineClock) { if configure_stream(&stream).is_err() { return; } let Ok(read) = stream.try_clone() else { return }; -<<<<<<< HEAD - let mut reader = BufReader::new(AuthDeadlineStream::new(read, limits.auth_deadline)); -======= - let mut reader = BufReader::new(AuthDeadlineStream::with_clock(read, auth_deadline, clock)); ->>>>>>> 07a8c471ed + let mut reader = BufReader::new(AuthDeadlineStream::with_clock(read, limits.auth_deadline, clock)); let mut out = stream; let mut line = String::new(); let mut handshake = ServerHandshake::new(); diff --git a/crates/automation/src/synthetic.rs b/crates/automation/src/synthetic.rs index 8c5b591227..2577ca8dd6 100644 --- a/crates/automation/src/synthetic.rs +++ b/crates/automation/src/synthetic.rs @@ -25,13 +25,8 @@ //! //! A node of the access tree (`id` or `label`, [`NodeTarget`]) is clicked or focused through the node's own action //! instead of a point: [`crate::access::resolve`] finds it in the window's kept tree when the request arrives, so a -<<<<<<< HEAD //! missing, ambiguous, disabled or undeclared node is refused before anything is queued. `ui.move` to a node goes to the -//! centre of its rect ([`access::node_rect`]). `ui.drag` is a held press, moves and a release in one request; a drag -//! with modifiers or a pause is `ui.click {hold}`, `ui.move` and `ui.release`. -======= -//! missing, ambiguous, disabled or undeclared node is refused before anything is queued. ->>>>>>> 07a8c471ed +//! centre of its rect ([`access::node_rect`]). A drag with a pause is `ui.click {hold}`, `ui.move` and `ui.release`. use std::path::PathBuf; @@ -330,54 +325,6 @@ impl Move { } } -<<<<<<< HEAD -/// The most moves one `ui.drag` may ask for (`steps`). -pub const MAX_DRAG_STEPS: u64 = 120; - -/// The moves of a `ui.drag` that names no `steps`. -pub const DRAG_STEPS: u64 = 8; - -/// A validated `ui.drag`: a press at one point, moves to another and the release there. -#[derive(Clone, Debug, PartialEq)] -#[non_exhaustive] -pub struct Drag { - /// Where the press goes down. - pub from: At, - /// Where it is let go. - pub to: At, - /// The button held. - pub button: PointerButton, - /// Moves from `from` to `to`, evenly spaced, the last one at `to`. - pub steps: u64, -} - -impl Drag { - /// `{x, y, toX, toY, coordinates?, page?, steps?, button?}`, no other fields: both points in the space - /// `coordinates` names, on the same page. `steps` is 1 to [`MAX_DRAG_STEPS`], default [`DRAG_STEPS`]; `button` - /// defaults to `left`. - pub fn from_params(params: &Value) -> Result { - let p = Params(params).only(None, &["x", "y", "toX", "toY", "coordinates", "page", "steps", "button"])?; - let p = Params(&p); - let range = Some((-MAX_SCREEN_POINT, MAX_SCREEN_POINT)); - let to_x = p.number_in("toX", "toX", range)?.ok_or_else(|| "missing `toX`".to_owned())? as f32; - let to_y = p.number_in("toY", "toY", range)?.ok_or_else(|| "missing `toY`".to_owned())? as f32; - let steps = p.uint_field("steps")?.unwrap_or(DRAG_STEPS); - if !(1..=MAX_DRAG_STEPS).contains(&steps) { - return Err(format!("`steps` must be 1 to {MAX_DRAG_STEPS} (got {steps})")); - } - Ok(Self { from: At::required(&p)?, to: At::in_space(&p, pos2(to_x, to_y))?, button: button(&p)?.unwrap_or(PointerButton::Primary), steps }) - } - - /// Queues the press at `from`, the moves and the release at `to` in `viewport`, one step per pass. Both points are - /// placed first, so one that cannot be placed queues nothing. - pub fn inject(&self, host: &WindowHost, viewport: ViewportId, map: DocumentMap<'_>) -> Result<(), String> { - let (from, to) = (self.from.place(host, viewport, map)?, self.to.place(host, viewport, map)?); - host.inject_click(viewport, from, self.button, 1, Mods::default(), true); - for step in 1..=self.steps { - host.inject_move(viewport, from.lerp(to, step as f32 / self.steps as f32), Mods::default(), 0.0); - } - host.inject_release(viewport, Some(to), Released::Button(self.button)); -======= /// A validated `ui.drag`: a press at one point, moves in even steps to another with the button down, and the release /// there. #[derive(Clone, Debug, PartialEq)] @@ -439,7 +386,6 @@ impl Drag { // A click of no presses at the pointer's place queues no event: it only lets the modifiers go when nothing // stays held. host.inject_click(viewport, to, self.button, 0, self.mods, false); ->>>>>>> 07a8c471ed Ok(()) } } diff --git a/crates/automation/tests/it/control.rs b/crates/automation/tests/it/control.rs index 6901e830cc..7d6a31c6a1 100644 --- a/crates/automation/tests/it/control.rs +++ b/crates/automation/tests/it/control.rs @@ -10,11 +10,7 @@ use craft_automation::client::ControlClient; use craft_automation::control::{ControlChannel, ControlRequest, ControlResponse, Reply, expired_error, result_reply, timeout_error}; use craft_automation::protocol::{MAX_RESPONSE_BYTES, write_reply}; use craft_automation::security::{CHALLENGE_METHOD, MAX_CONNECTIONS, MAX_REQUEST_BYTES, ProofRole, generate_nonce, handshake_proof, proof_matches}; -<<<<<<< HEAD -use craft_automation::server::{self, ServerLimits}; -======= -use craft_automation::server::{self, ServeOptions}; ->>>>>>> 07a8c471ed +use craft_automation::server::{self, ServeOptions, ServerLimits}; use craft_ui::runtime::motion; use craft_ui::runtime::windows::WindowHost; use craft_ui::testing::trial; @@ -135,13 +131,6 @@ fn host() -> WindowHost { /// sent is dispatched. #[trial] fn an_unauthenticated_connection_is_closed_at_the_deadline_whatever_it_sends() { -<<<<<<< HEAD - // A short deadline, so the test does not wait out the real one. - let deadline = Duration::from_millis(400); - let listener = TcpListener::bind("127.0.0.1:0").expect("bound"); - let (rx, server) = server::serve_with(listener, TOKEN.into(), host(), ServerLimits::default().auth_deadline(deadline)).expect("started"); - // Blank lines and partial frames, one byte every 20 ms: each read succeeds long before the idle timeout. -======= let start = motion::now(); let at = Arc::new(Mutex::new(start)); let read_at = Arc::clone(&at); @@ -153,9 +142,8 @@ fn an_unauthenticated_connection_is_closed_at_the_deadline_whatever_it_sends() { let _ = read.send(()); now }); - let options = ServeOptions { auth_deadline: Duration::from_secs(10), clock, ended: Some(ended) }; + let options = ServeOptions { limits: ServerLimits::default().auth_deadline(Duration::from_secs(10)), clock, ended: Some(ended) }; let (rx, server) = server::serve_with(TcpListener::bind("127.0.0.1:0").expect("bound"), TOKEN.into(), host(), options).expect("started"); ->>>>>>> 07a8c471ed let mut stream = TcpStream::connect(server.addr).expect("connected"); stream.set_read_timeout(Some(Duration::from_secs(5))).expect("timeout"); let mut reader = BufReader::new(stream.try_clone().expect("cloned")); @@ -207,7 +195,8 @@ fn a_reset_connection_counts_as_closed() { fn serve_counting_ends() -> (Receiver, server::Listening, Receiver<()>) { let (ended, connection_ended) = channel(); let start = motion::now(); - let options = ServeOptions { auth_deadline: Duration::from_secs(60), clock: Arc::new(move || start), ended: Some(ended) }; + let options = + ServeOptions { limits: ServerLimits::default().auth_deadline(Duration::from_secs(60)), clock: Arc::new(move || start), ended: Some(ended) }; let (rx, server) = server::serve_with(TcpListener::bind("127.0.0.1:0").expect("bound"), TOKEN.into(), host(), options).expect("started"); (rx, server, connection_ended) } @@ -306,19 +295,8 @@ fn a_refused_first_frame_closes_the_connection() { /// and the connection closed, so neither the body's `auth` nor a request after it reaches the app. #[trial] fn a_browser_post_never_reaches_the_app() { -<<<<<<< HEAD - // Far longer than the trial, so the close comes from the refusal, not the deadline. - let (rx, server) = server::serve_with( - TcpListener::bind("127.0.0.1:0").expect("bound"), - TOKEN.into(), - host(), - ServerLimits::default().auth_deadline(Duration::from_secs(60)), - ) - .expect("started"); -======= // The server's clock stands still, so the close comes from the refusal, not the deadline. let (rx, server, ended) = serve_counting_ends(); ->>>>>>> 07a8c471ed let mut stream = TcpStream::connect(server.addr).expect("connected"); stream.set_read_timeout(Some(Duration::from_secs(5))).expect("timeout"); let mut reader = BufReader::new(stream.try_clone().expect("cloned")); @@ -675,19 +653,8 @@ fn a_complete_json_request_at_eof_can_reach_the_app() { #[trial] fn idle_unauthenticated_connections_are_limited() { use craft_automation::security::MAX_CONNECTIONS; -<<<<<<< HEAD - // Far longer than the trial, so only the limit refuses. - let (rx, server) = server::serve_with( - TcpListener::bind("127.0.0.1:0").expect("bound"), - TOKEN.into(), - host(), - ServerLimits::default().auth_deadline(Duration::from_secs(60)), - ) - .expect("started"); -======= // The server's clock stands still, so only the limit refuses. let (rx, server, ended) = serve_counting_ends(); ->>>>>>> 07a8c471ed let idle: Vec = (0..MAX_CONNECTIONS).map(|_| TcpStream::connect(server.addr).expect("connected")).collect(); // Admission is counted by the accept thread: it is done once the next connection is answered. let refused = |addr| { diff --git a/crates/automation/tests/it/synthetic.rs b/crates/automation/tests/it/synthetic.rs index d32293a75a..7426c4a211 100644 --- a/crates/automation/tests/it/synthetic.rs +++ b/crates/automation/tests/it/synthetic.rs @@ -5,11 +5,7 @@ use std::cell::{Cell, RefCell}; use std::rc::Rc; -<<<<<<< HEAD -use craft_automation::access::NO_TREE; -======= use craft_automation::access::{NO_CONTROL, NO_TREE}; ->>>>>>> 07a8c471ed use craft_automation::synthetic::{At, Click, Focus, MAX_CLICKS, MAX_DRAG_STEPS, MAX_SCREEN_POINT, NO_DOCUMENT, NOT_FINITE, input_method}; use craft_ui::contract::{Bind, Show as _}; use craft_ui::runtime::egui::injected::hook_without_pass; @@ -127,7 +123,6 @@ fn a_held_press_stays_down_until_its_release() { assert!(!rig.now().primary_down, "a click without hold releases"); } -<<<<<<< HEAD /// `ui.drag` presses at its start, moves with the button down through `steps` points towards its end, each on a pass /// of its own, and lets go at the end. Its points are mapped as every request's are. #[trial] @@ -135,7 +130,10 @@ fn a_drag_presses_moves_held_and_releases_at_its_end() { let mut rig = Rig::new(); rig.fx.settle(); rig.take(); - rig.send("ui.drag", json!({"x": 200, "y": 100, "toX": 600, "toY": 300, "coordinates": "document", "steps": 4})); + rig.send( + "ui.drag", + json!({"from": {"x": 200, "y": 100, "coordinates": "document"}, "to": {"x": 600, "y": 300, "coordinates": "document"}, "steps": 4}), + ); let (from, to) = (pos2(100.0, 50.0), pos2(300.0, 150.0)); let passes = rig.take(); let held: Vec = passes.iter().filter(|pass| pass.primary_down).filter_map(|pass| pass.pos).collect(); @@ -149,7 +147,8 @@ fn a_drag_presses_moves_held_and_releases_at_its_end() { }); assert_eq!(released, Some(to), "the release is at the mapped end"); assert!(passes.last().is_some_and(|pass| !pass.primary_down), "nothing stays held"); -======= +} + /// `ui.drag` presses at `from`, moves to `to` in `steps` even steps with the button down, releases at `to` with its /// modifiers held throughout, then lets them go. Each point is in its own space: `to` here is a document point. #[trial] @@ -194,7 +193,6 @@ fn a_drag_keeps_its_modifiers_while_a_held_key_stays_down() { assert!(after.shift, "the modifiers stay with the held key"); rig.send("ui.release", json!({})); assert!(!rig.now().space_down && !rig.now().shift, "the release lets everything go"); ->>>>>>> 07a8c471ed } /// A move's modifiers stay held after it (a hover with modifiers); a click that holds nothing lets its own go. @@ -366,25 +364,6 @@ fn document_points_need_a_canvas() { assert_eq!(screen, Some(Ok(()))); } -<<<<<<< HEAD -/// The reply a waiter on `method` gets once `channel` polls `rig`'s host after its passes ran out of input. -fn answer_after_input(rig: &mut Rig, channel: &mut craft_automation::control::ControlChannel, reply: &std::sync::mpsc::Receiver) -> Value { - let host = rig.host(); - for _ in 0..32 { - channel.poll_input(&host); - if let Ok(answer) = reply.try_recv() { - return answer; - } - rig.fx.frame(Vec::new()); - } - panic!("the waiter is answered"); -} - -/// A click at a point handed to the input whose pass has not run is withdrawn when the focus moved, and when the -/// application withdraws the input because its document or layout changed: its point now means another place. The -/// integration's preserved copy leaves the input, the rest of the click goes with it, no button stays down, and the -/// waiter fails with `TARGET_CHANGED`. -======= /// A drag whose end cannot be placed is refused whole: its press at a screen point is not queued either. That holds /// for a document end without a canvas and for a control end that names no control of the window. #[trial] @@ -404,10 +383,23 @@ fn a_drag_with_an_end_it_cannot_place_queues_no_press() { assert!(hook_without_pass(&ctx, ViewportId::ROOT).is_empty(), "the drag to an unplaced control queued nothing"); } -/// A step handed to the input whose pass has not run is withdrawn when the focus moved, and when the application -/// withdraws the input because its document changed: the integration's preserved copy leaves the input, no key -/// stays down, and the waiters fail with `TARGET_CHANGED`. ->>>>>>> 07a8c471ed +/// The reply a waiter on `method` gets once `channel` polls `rig`'s host after its passes ran out of input. +fn answer_after_input(rig: &mut Rig, channel: &mut craft_automation::control::ControlChannel, reply: &std::sync::mpsc::Receiver) -> Value { + let host = rig.host(); + for _ in 0..32 { + channel.poll_input(&host); + if let Ok(answer) = reply.try_recv() { + return answer; + } + rig.fx.frame(Vec::new()); + } + panic!("the waiter is answered"); +} + +/// A click at a point handed to the input whose pass has not run is withdrawn when the focus moved, and when the +/// application withdraws the input because its document or layout changed: its point now means another place. The +/// integration's preserved copy leaves the input, the rest of the click goes with it, no button stays down, and the +/// waiter fails with `TARGET_CHANGED`. #[trial] fn a_click_at_a_point_is_withdrawn_when_its_target_changes() { use craft_automation::control::{ControlChannel, ControlRequest, Reply}; @@ -518,10 +510,8 @@ fn bad_input_params_are_refused_before_anything_is_queued() { ("ui.focus", json!({})), ("ui.drop", json!({"paths": []})), ("ui.drop", json!({"paths": ["a.pdf"], "alt": true})), - ("ui.drag", json!({"x": 10, "y": 10, "toX": 50})), - ("ui.drag", json!({"x": 10, "y": 10, "toX": 50, "toY": 50, "steps": 0})), - ("ui.drag", json!({"x": 10, "y": 10, "toX": 50, "toY": 50, "steps": MAX_DRAG_STEPS + 1})), - ("ui.drag", json!({"x": 10, "y": 10, "toX": 50, "toY": 50, "shift": true})), + ("ui.drag", json!({"from": {"x": 10, "y": 10}, "to": {"x": 50}, "steps": 0})), + ("ui.drag", json!({"from": {"x": 10, "y": 10}, "to": {"x": 50, "y": 50}, "steps": MAX_DRAG_STEPS + 1})), ]; for (method, params) in &refused { let answer = input_method(method, params, &host, ViewportId::ROOT, &map); diff --git a/crates/draw/src/ui/transform/transform_box.rs b/crates/draw/src/ui/transform/transform_box.rs index db669d4f28..8bac3fae4c 100644 --- a/crates/draw/src/ui/transform/transform_box.rs +++ b/crates/draw/src/ui/transform/transform_box.rs @@ -508,16 +508,12 @@ pub struct TransformBox<'a> { centre_mark: bool, /// How the frame, the handles and the rotate handle are drawn. #[prop] -<<<<<<< HEAD look: BoxLook, -======= - round_handles: bool, /// The side of the corner and side handles in points, for a host with a handle size preference; `None` uses the /// theme's (`size.handle.md`), as does a side that is zero, negative or not finite. A handle's reach grows with a /// larger side and stays at least the theme's. #[prop(quantity = "points, from the host's handle size preference")] handle_side: Option, ->>>>>>> 07a8c471ed /// Draws the box as a live line's controls (the Line tool's live line as the whole selection). Only the two ends /// take a press and the keys, each as the box handle it points to ([`LineLook`]), so an end drag scales the box as /// that handle does; while it is dragged, the box shows as it scales. No other part is declared. @@ -563,12 +559,8 @@ impl<'a> TransformBox<'a> { overflow: false, session_arrows: true, centre_mark: false, -<<<<<<< HEAD look: BoxLook::Standard, -======= - round_handles: false, handle_side: None, ->>>>>>> 07a8c471ed line: None, reach: TransformReach::Box, color: None, @@ -1122,14 +1114,14 @@ impl TransformBox<'_> { BoxPart::Pivot => (HitShape::circle(pos(screen.pivot), style.hit), handle), other => { let at = self.part_point(state, other).map_or(Pos2::ZERO, |at| view.to_screen(at)); - (HitShape::circle(at, style.handle_reach), handle) + (HitShape::circle(at, self.reach_of_handles(style)), handle) } }; declare(BOX.at(part.index()), Some(part), shape, priority); } if let Some(line) = self.line { for (end, at) in line.free_ends() { - declare(LINE_END.at(end.index()), None, HitShape::circle(view.to_screen(at), style.handle_reach), handle); + declare(LINE_END.at(end.index()), None, HitShape::circle(view.to_screen(at), self.reach_of_handles(style)), handle); } return; } @@ -1454,7 +1446,6 @@ impl Component for TransformBox<'_> { let style = cx.style; let context = if self.own_context_menu { Sense::CONTEXT_CLICK } else { Sense::empty() }; let mut any = false; -<<<<<<< HEAD self.screen_parts(&state, &space.view, rect, style, |reference, part, shape, priority| { let sense = Sense::DRAG | Sense::CLICK | context | part.map_or(Sense::empty(), slop_sense); let builder = cx.part(reference, shape).sense(sense).priority(priority); @@ -1471,39 +1462,6 @@ impl Component for TransformBox<'_> { _ => ROTATE_BY_KEY, }; builder.pointer_only(by_key); -======= - for part in self.keyboard_parts() { - let (shape, sense, priority, focus) = match part { - BoxPart::Inside => { - let sense = Sense::DRAG | Sense::CLICK | Sense::TAKE_FOCUS; - (HitShape::Polygon(quad.to_vec()), sense, HitPriority::new(HitLevel::Body, 0), FocusShape::Rect) - } - BoxPart::Pivot => ( - HitShape::circle(pos(screen.pivot), style.hit), - Sense::DRAG | Sense::CLICK | Sense::TAKE_FOCUS, - HitPriority::new(HitLevel::Handle, HANDLE_SUB), - FocusShape::Circle, - ), - handle => { - let at = self.part_point(&state, handle).map_or(Pos2::ZERO, |at| space.view.to_screen(at)); - ( - HitShape::circle(at, self.reach_of_handles(style)), - Sense::DRAG | Sense::CLICK | Sense::TAKE_FOCUS, - HitPriority::new(HitLevel::Handle, HANDLE_SUB), - FocusShape::Circle, - ) - } - }; - cx.part(BOX.at(part.index()), shape).sense(sense | slop_sense(part) | context).priority(priority).focus_shape(focus).focusable(); - any = true; - } - if let Some(line) = self.line { - for (end, at) in line.free_ends() { - cx.part(LINE_END.at(end.index()), HitShape::circle(space.view.to_screen(at), self.reach_of_handles(style))) - .sense(Sense::DRAG | Sense::CLICK | context) - .priority(HitPriority::new(HitLevel::Handle, HANDLE_SUB)) - .pointer_only(LINE_END_BY_KEY); ->>>>>>> 07a8c471ed } }); if any { diff --git a/crates/draw/tests/it/transform_box.rs b/crates/draw/tests/it/transform_box.rs index c1dd87e28e..0527b247d0 100644 --- a/crates/draw/tests/it/transform_box.rs +++ b/crates/draw/tests/it/transform_box.rs @@ -59,13 +59,9 @@ struct Config { /// The host keeps the box in f32, as a text layer keeps its box, and gives it back with its centre as the pivot. f32_host: bool, centre_mark: bool, -<<<<<<< HEAD look: BoxLook, -======= - round_handles: bool, /// The host's handle side, `None` for the theme's. handle_side: Option, ->>>>>>> 07a8c471ed line: Option, /// Snap targets beside the guides at [`SNAP_XS`]. targets: Vec, @@ -124,12 +120,8 @@ fn defaults() -> Config { rulers: None, f32_host: false, centre_mark: false, -<<<<<<< HEAD look: BoxLook::Standard, -======= - round_handles: false, handle_side: None, ->>>>>>> 07a8c471ed line: None, targets: Vec::new(), suspend: SnapSuspend::Control, diff --git a/crates/platform/src/logs_tests.rs b/crates/platform/src/logs_tests.rs index 4d33636ea0..c6acbb36e4 100644 --- a/crates/platform/src/logs_tests.rs +++ b/crates/platform/src/logs_tests.rs @@ -309,7 +309,6 @@ fn a_sink_keeps_early_lines_bounded_and_stops_at_its_size_cap() { let _ = std::fs::remove_dir_all(&dir); } -<<<<<<< HEAD // An attachment failure must report the path, stop buffering for a file, and leave stderr usable. #[test] fn attaching_to_an_unusable_directory_reports_an_error_and_keeps_logging() { @@ -339,7 +338,8 @@ fn attaching_to_an_unusable_directory_reports_an_error_and_keeps_logging() { assert!(sink.file.is_none() && sink.pending.is_empty(), "no records wait for a file that cannot open"); drop(sink); std::fs::remove_file(blocked).expect("remove the blocked path"); -======= +} + #[test] fn a_poisoned_sink_still_logs() { use log::Log; @@ -357,21 +357,3 @@ fn a_poisoned_sink_still_logs() { assert!(read(&path).contains("photocraft: after the poison")); let _ = std::fs::remove_dir_all(&dir); } - -#[test] -fn attaching_to_an_unusable_directory_reports_an_error_and_keeps_logging() { - use log::Log; - let dir = temp_dir("unusable"); - std::fs::create_dir_all(dir.parent().expect("parent")).expect("tmp"); - std::fs::write(&dir, "not a directory").expect("block"); - let logger = AppLogger::new(NAMES, Filter::parse("info"), false); - logger.log(&log::Record::builder().level(log::Level::Error).target("x").args(format_args!("early")).build()); - assert!(logger.attach_dir(&dir).is_err()); - logger.log(&log::Record::builder().level(log::Level::Error).target("x").args(format_args!("still fine")).build()); - // Nothing waits in memory for a file that won't come. - let sink = logger.sink.lock().expect("sink"); - assert!(sink.pending.is_empty() && sink.file.is_none()); - drop(sink); - let _ = std::fs::remove_file(&dir); ->>>>>>> 07a8c471ed -} diff --git a/crates/settings/src/files.rs b/crates/settings/src/files.rs index 1b9f1c417a..d9e1aa4982 100644 --- a/crates/settings/src/files.rs +++ b/crates/settings/src/files.rs @@ -56,17 +56,9 @@ pub struct DiskFiles; #[cfg(not(target_arch = "wasm32"))] impl SettingsFiles for DiskFiles { -<<<<<<< HEAD - fn read_bytes(&self, path: &Path) -> io::Result>> { - match std::fs::read(path) { - Ok(bytes) => Ok(Some(bytes)), - Err(e) if e.kind() == io::ErrorKind::NotFound => Ok(None), - Err(e) => Err(e), -======= /// A file larger than [`MAX_CONFIG_BYTES`](crate::store::MAX_CONFIG_BYTES) fails with - /// `ErrorKind::FileTooLarge` without being read into memory; text that is not UTF-8 fails with - /// `ErrorKind::InvalidData`, as `std::fs::read_to_string` does. - fn read(&self, path: &Path) -> io::Result> { + /// `ErrorKind::FileTooLarge` without being read into memory. + fn read_bytes(&self, path: &Path) -> io::Result>> { use std::io::Read as _; let file = match std::fs::File::open(path) { Ok(file) => file, @@ -76,7 +68,6 @@ impl SettingsFiles for DiskFiles { let limit = crate::store::MAX_CONFIG_BYTES; if file.metadata()?.len() > limit { return Err(crate::store::too_large()); ->>>>>>> 07a8c471ed } // The length can change after the check, or be unknown (a pipe), so the read is capped too. let mut bytes = Vec::new(); @@ -84,7 +75,7 @@ impl SettingsFiles for DiskFiles { if bytes.len() as u64 > limit { return Err(crate::store::too_large()); } - String::from_utf8(bytes).map(Some).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e)) + Ok(Some(bytes)) } fn write(&self, path: &Path, text: &str) -> io::Result<()> { diff --git a/crates/ui-canvas/src/canvas/mod.rs b/crates/ui-canvas/src/canvas/mod.rs index fe3c04999e..6daa81dfa3 100644 --- a/crates/ui-canvas/src/canvas/mod.rs +++ b/crates/ui-canvas/src/canvas/mod.rs @@ -854,15 +854,10 @@ impl<'a> Canvas<'a> { // A press that stopped an autoscroll is the autoscroll's until its release. let press = if self.settled.is_some_and(|settled| settled.swallowing) { PressState::IDLE } else { self.background_press(cx).0 }; let caps_lock = lock_keys::caps_lock(&cx.response.ctx); -<<<<<<< HEAD let scheme = cx.env.get::(); - let space = self.space(cx.response.id, cx.env.scale().0, BackgroundPress::of(&press, self.context_key), caps_lock, scheme); -======= - let scheme = Env::of_root(&cx.response.ctx).view().get::(); let space = self .space(cx.response.id, cx.env.scale().0, BackgroundPress::of(&press, self.context_key), caps_lock, scheme) .map(|space| space.with_space_held(tool_host::space_held(&cx.response.ctx))); ->>>>>>> 07a8c471ed ToolPass { id: cx.response.id, rect: cx.response.rect, diff --git a/crates/ui-canvas/src/canvas/scrollbars/mod.rs b/crates/ui-canvas/src/canvas/scrollbars/mod.rs index 038e770a54..a41e7fe43d 100644 --- a/crates/ui-canvas/src/canvas/scrollbars/mod.rs +++ b/crates/ui-canvas/src/canvas/scrollbars/mod.rs @@ -34,13 +34,8 @@ use crate::style::{ComponentStyle, ScrollBarKind, ScrollBarLook, Stateful, Style use craft_behavior::kurbo::{Point, Rect as DocRect}; use craft_behavior::overlay::{Align, Side}; use craft_behavior::scroll::ScrollSpan; -<<<<<<< HEAD use craft_behavior::{Axis, CanvasView, Metrics, PartKey, PartRef, PointerButton, PressPhase, PressStart, Sense}; -use egui::{CornerRadius, Pos2, Rect, Response, Vec2, pos2, vec2}; -======= -use craft_behavior::{Axis, CanvasView, Metrics, PartKey, PartRef, PressPhase, PressStart, Sense}; use egui::{CornerRadius, Pos2, Rect, Response, Ui, Vec2, pos2, vec2}; ->>>>>>> 07a8c471ed use std::ops::{Deref, Range}; const HORIZONTAL: PartKey = PartKey::new("horizontal"); @@ -515,7 +510,20 @@ impl<'a> CanvasScrollbars<'a> { changed } -<<<<<<< HEAD + /// `rect`, a canvas's rect the bars are shown in, without the strips they can take: the vertical bar's along the + /// right edge and, unless `bars` is [`ShownBars::Vertical`], the horizontal bar's along the bottom; an overflowing + /// axis keeps its strip, as its bar shows once the view scrolls or zooms past the document. `document_chrome` is the + /// bars' own flag. A canvas control placed in a corner of the view (the Rotate View compass) is placed inside this + /// rect so the bars do not cover it. + pub fn clear_of(ui: &Ui, rect: Rect, document_chrome: bool, bars: ShownBars) -> Rect { + let env = Env::of(ui); + let (thickness, margin) = bar_size(&env.tokens, document_chrome); + let strip = thickness + margin; + let right = (rect.right() - strip).max(rect.left()); + let bottom = if bars == ShownBars::Vertical { rect.bottom() } else { (rect.bottom() - strip).max(rect.top()) }; + Rect::from_min_max(rect.min, pos2(right, bottom)) + } + fn layout(&self, view: &CanvasView, rect: Rect, style: &ScrollbarsStyle, held: Option<&HeldThumb>) -> Bars { let [x, y] = Bars::spans(view, self.document); let shown = |axis, span: Option| { @@ -531,25 +539,6 @@ impl<'a> CanvasScrollbars<'a> { } }; Bars::of([x, y], self.overscroll, shown(Axis::X, x), shown(Axis::Y, y), rect, style, held) -======= - /// `rect`, a canvas's rect the bars are shown in, without the strips they take: the vertical bar's along the right - /// edge and, unless `vertical_only`, the horizontal bar's along the bottom. `document_chrome` is the bars' own flag. - /// A canvas control placed in a corner of the view (the Rotate View compass) is placed inside this rect so the bars - /// do not cover it. - pub fn clear_of(ui: &Ui, rect: Rect, document_chrome: bool, vertical_only: bool) -> Rect { - let env = Env::of(ui); - let (thickness, margin) = bar_size(&env.tokens, document_chrome); - let strip = thickness + margin; - let right = (rect.right() - strip).max(rect.left()); - let bottom = if vertical_only { rect.bottom() } else { (rect.bottom() - strip).max(rect.top()) }; - Rect::from_min_max(rect.min, pos2(right, bottom)) - } - - fn bars(&self, view: &CanvasView, rect: Rect, style: &ScrollbarsStyle, held: Option<&HeldThumb>) -> Bars { - // A horizontal thumb held keeps its bar until the press ends, so its release closes the drag. - let horizontal = !self.vertical_only || held.is_some_and(|held| held.on(Axis::X)); - Bars::of(view, self.document, self.overscroll, horizontal, rect, style, held) ->>>>>>> 07a8c471ed } } diff --git a/crates/ui-canvas/tests/it/canvas/scrollbars.rs b/crates/ui-canvas/tests/it/canvas/scrollbars.rs index 8707064a22..59252beba9 100644 --- a/crates/ui-canvas/tests/it/canvas/scrollbars.rs +++ b/crates/ui-canvas/tests/it/canvas/scrollbars.rs @@ -5,19 +5,13 @@ use std::rc::Rc; use std::sync::Arc; use craft_behavior::kurbo::{Point, Rect as DocRect, Size}; -<<<<<<< HEAD use craft_behavior::{Axis, CancelReason, CanvasView, PartKey, PointerButton}; use craft_ui::canvas::{ - Canvas, CanvasScrollbars, CanvasTool, NavigationOptions, Rulers, ScrollBounds, ShownBars, ToolAction, ToolContext, ToolHost, ToolPath, - ToolPointer, ViewTarget, canvas_space, tool_pass, + Canvas, CanvasScrollbars, CanvasTool, NavigationOptions, RotateView, Rulers, ScrollBounds, ShownBars, ToolAction, ToolContext, ToolHost, + ToolPath, ToolPointer, ViewTarget, canvas_space, tool_pass, }; use craft_ui::contract::{Bind, Show as _, ShowContainer as _, THUMB}; use craft_ui::primitives::Draw; -======= -use craft_behavior::{Axis, CanvasView}; -use craft_ui::canvas::{Canvas, CanvasScrollbars, NavigationOptions, RotateView, Rulers, canvas_space}; -use craft_ui::contract::{Bind, Show as _, ShowContainer as _}; ->>>>>>> 07a8c471ed use craft_ui::runtime::access::Role; use craft_ui::runtime::env::Label; use craft_ui::testing::input::slop; @@ -552,7 +546,6 @@ fn after_a_thumb_drag_the_bars_follow_a_new_zoom() { assert!((first - fresh).abs() < 1.0, "after a thumb drag paging reaches the same end: shows from {first}, without the drag {fresh}"); } -<<<<<<< HEAD #[trial] fn a_fitted_document_shows_no_bar_and_a_zoomed_one_shows_its_overflowing_axes() { let doc = DocRect::new(0.0, 0.0, 800.0, 300.0); @@ -708,7 +701,8 @@ fn a_press_on_a_bar_never_reaches_the_tool_and_only_the_primary_button_drags_a_t fixture.click_at(at); assert!(view.get().center.x > before.center.x, "a primary track press still pages"); assert_eq!(calls.get(), 0, "a track press never reaches the tool"); -======= +} + /// The Rotate View compass of a turned view, placed in `CanvasScrollbars::clear_of` the window, sits clear of the /// vertical bar, and that rect stops above the horizontal bar, with or without the document chrome. #[trial] @@ -721,7 +715,7 @@ fn the_rotate_view_compass_placed_clear_of_the_bars_is_not_covered_by_them() { let mut fixture = Fixture::new(move |ui| { let mut turn = view.rotation; Canvas::new("Document").document(large).view(view).show_at(ui, DOCUMENT_WINDOW, |ui, _| { - let room = CanvasScrollbars::clear_of(ui, DOCUMENT_WINDOW, chrome, false); + let room = CanvasScrollbars::clear_of(ui, DOCUMENT_WINDOW, chrome, ShownBars::Both); seen.set(room); let _ = RotateView::new("Rotation", Bind::bound(&mut turn), false).show_at(ui, RotateView::compass_rect(ui, room)); }); @@ -739,5 +733,4 @@ fn the_rotate_view_compass_placed_clear_of_the_bars_is_not_covered_by_them() { assert!(room.right() <= vertical.left() + TOLERANCE, "chrome {chrome}: {room:?} reaches the vertical bar {vertical:?}"); assert!(room.bottom() <= horizontal.top() + TOLERANCE, "chrome {chrome}: {room:?} reaches the horizontal bar {horizontal:?}"); } ->>>>>>> 07a8c471ed }