mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 10:48:15 +01:00
Default branch is red: test mapped_crates_have_no_findings (#4479)
* Default branch is red: `test mapped_crates_have_no_findings` * All three failures were mistakes in the tests, so only test code changed All three failures were mistakes in the tests, so only test code changed. On macOS, `a_row_announces_the_letter_it_has_among_all_its_siblings` used the host's OS, and Mac menus have no access letters by design; it now sets the fixture to Linux. On macOS, `a_guide_dragged_under_the_centre_readout_...` held Control before pressing, which is a secondary click there; Control now goes down after the press and still turns snapping off during the drag. On Windows, `allows_windows_single_instance_socket_...` bound a socket under a long, canonicalised temp path that exceeded the socket path limit; it now uses a short directory under the temp directory, without canonicalising it. No assertion changed. Both macOS failures reproduced here at the logged lines with the fixture forced to macOS. With the fix, all 14 guides tests passed under that forced setting. On Linux, the tests of craft-ui-widgets, craft-ui-canvas and craft-nightly passed, clippy with -D warnings passed on those three crates, and cargo fmt --check passed. `mapped_crates_have_no_findings` also passes on this tree. Nothing ran on real macOS or Windows. The Windows test and its new directory code were not compiled here, because no Windows target is installed. The logged run stopped at the socket bind, so the log does not show whether the later assertions pass on Windows, including the validator connecting through the `\\?\` form of the path. --------- Co-authored-by: autocraft-bot[bot] <354215646+autocraft-bot[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
a83c3b4e34
commit
d7464f20ed
3 files changed
+12
-5
No files matched your search
@@ -591,10 +591,14 @@ mod tests {
|
||||
Self { path }
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(any(unix, windows))]
|
||||
fn new_short(label: &str) -> Self {
|
||||
// macOS limits Unix socket sun_path to 104 bytes; /tmp stays well under that limit.
|
||||
// A Unix socket's sun_path holds 104 bytes on macOS and 108 on Windows. /tmp stays well under that limit.
|
||||
#[cfg(unix)]
|
||||
let base = fs::canonicalize(Path::new("/tmp")).unwrap_or_else(|_| PathBuf::from("/tmp"));
|
||||
// Not canonicalised: that adds the `\\?\` prefix to the path the test binds.
|
||||
#[cfg(windows)]
|
||||
let base = std::env::temp_dir();
|
||||
let id = TEST_DIR_COUNTER.fetch_add(1, Ordering::Relaxed);
|
||||
let path = base.join(format!("cn-{label}-{}-{id}", std::process::id()));
|
||||
fs::create_dir_all(&path).expect("create short temp test dir");
|
||||
@@ -867,7 +871,7 @@ mod tests {
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn allows_windows_single_instance_socket_live_and_stale_and_rejects_elsewhere() {
|
||||
let tmp = TempDir::new("wsock");
|
||||
let tmp = TempDir::new_short("w");
|
||||
let home = tmp.path().join("h");
|
||||
let profile = tmp.path().join("p");
|
||||
let single_instance = profile.join("single-instance");
|
||||
|
||||
@@ -193,7 +193,6 @@ fn a_guide_dragged_under_the_centre_readout_names_its_side_and_its_distance_from
|
||||
let initial = if along == Axis::Y { 200.0 } else { 180.0 };
|
||||
let guides: Shared<Vec<Guide>> = Rc::new(RefCell::new(if pending { Vec::new() } else { vec![guide(1, along, initial)] }));
|
||||
let (mut fixture, words) = ruled_with(1.0, &guides, mode, bounds, twice);
|
||||
fixture.fixture().hold(Modifiers::CTRL);
|
||||
let before: Vec<String> = fixture.fixture().texts().iter().map(|run| run.text.clone()).collect();
|
||||
let from = if pending {
|
||||
let room = fixture.canvas().rect;
|
||||
@@ -206,6 +205,8 @@ fn a_guide_dragged_under_the_centre_readout_names_its_side_and_its_distance_from
|
||||
let to = if along == Axis::Y { pos2(position, 300.0) } else { pos2(450.0, position) };
|
||||
fixture.fixture().frame(vec![pointer::moved(from)]);
|
||||
fixture.fixture().frame(vec![pointer::press(from)]);
|
||||
// Control turns snapping off. It goes down after the press: on macOS a Control press is a secondary click.
|
||||
fixture.fixture().hold(Modifiers::CTRL);
|
||||
fixture.fixture().frame(vec![pointer::moved(from.lerp(to, 0.5))]);
|
||||
fixture.fixture().frame(vec![pointer::moved(to)]);
|
||||
let painted: Vec<String> =
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! An open menu in a pass with no measuring run, where each row registers with its level as the row runs: the letter
|
||||
//! each row announces, and how often a row's shortcut is measured.
|
||||
|
||||
use craft_host::target::Os;
|
||||
use craft_ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
|
||||
use craft_ui::menu::{Menu, MenuItem};
|
||||
use craft_ui::testing::{Fixture, last_pass_measure_asks, last_pass_measuring_runs, trial};
|
||||
@@ -16,7 +17,8 @@ fn a_row_announces_the_letter_it_has_among_all_its_siblings() {
|
||||
MenuItem::new("&Select All").show(ui);
|
||||
});
|
||||
});
|
||||
fixture.settle();
|
||||
// A Mac menu has no access letters.
|
||||
fixture.os(Os::Linux).settle();
|
||||
for frame in 0..3 {
|
||||
let key = |fixture: &Fixture, label: &str| {
|
||||
let row = fixture.by_label(label).expect("the menu shows the row");
|
||||
|
||||
Reference in new issue
Block a user