Lints: ui-patterns tests, gallery, docx docs link

This commit is contained in:
aiongg
2026-11-14 01:36:21 +00:00
parent 8378864db3
commit bcd543e017
6 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
//! DOCX reader and writer (ECMA-376 / ISO/IEC 29500 WordprocessingML).
//!
//! [`read`] turns a `.docx` package into a [`craft_wordmodel::Document`]; [`write`] does the
//! [`read`] turns a `.docx` package into a [`craft_wordmodel::Document`]; [`fn@write`] does the
//! reverse. Both are written from the public specification. The reader is lenient (unknown
//! markup is skipped, bad numbers fall back to defaults) and bounded (zip entry sizes, total
//! decompressed size, XML depth and element counts are capped), so hostile input yields an
+1 -1
View File
@@ -22,8 +22,8 @@ pub const WINDOW: [f32; 2] = [1280.0, 800.0];
/// the story registrations in them, which a release build for the web would otherwise drop.
type Registered = fn() -> Vec<&'static craft_ui::testing::Registration>;
#[allow(unused_mut, clippy::vec_init_then_push)]
fn crates() -> Vec<(&'static str, Registered)> {
#[allow(unused_mut, clippy::vec_init_then_push)]
let mut crates: Vec<(&'static str, Registered)> = Vec::new();
#[cfg(feature = "automation")]
crates.push(("craft-automation", craft_automation::testing::registered));
+1 -1
View File
@@ -69,7 +69,7 @@ impl Filters {
/// Whether a colour token passes.
fn keeps_token(&self, explained: &Explained, token: ColorToken, pinned: bool, moved: bool) -> bool {
self.matches_path(&token.path())
self.matches_path(token.path())
&& (!self.pinned || pinned)
&& (!self.moved || moved)
&& (!self.failing || explained.pairs_of(token).any(|pair| !pair.pair.passes()))
@@ -22,7 +22,7 @@ fn about() -> HostedAbout {
}
fn canvas_size() -> HostedCanvasSize {
HostedCanvasSize::new(CanvasSizeValues::new(PICTURE), |values| CanvasSize::new(values))
HostedCanvasSize::new(CanvasSizeValues::new(PICTURE), CanvasSize::new)
}
/// A fixture that runs `host` every pass, in a room large enough for every form.
@@ -28,13 +28,15 @@ enum TrialCommand {
Zoom,
}
type PaletteRig = (Fixture, Rc<Cell<bool>>, Rc<RefCell<Option<CommandRef>>>);
/// A palette open over `entries`, inside a modal dialog when `in_dialog`; `picked` holds the last pick.
fn palette(entries: Vec<HelpEntry>, in_dialog: bool) -> (Fixture, Rc<Cell<bool>>, Rc<RefCell<Option<CommandRef>>>) {
fn palette(entries: Vec<HelpEntry>, in_dialog: bool) -> PaletteRig {
let open = Rc::new(Cell::new(true));
let picked = Rc::new(RefCell::new(None::<CommandRef>));
let (shown_open, shown_picked) = (open.clone(), picked.clone());
let fixture = Fixture::new(move |ui| {
let mut show = |ui: &mut Ui| {
let show = |ui: &mut Ui| {
let mut is_open = shown_open.get();
let output = CommandPalette::new("Commands", &entries, Bind::bound(&mut is_open)).show(ui);
shown_open.set(is_open);
@@ -36,7 +36,8 @@ fn rig() -> (Fixture, Rc<RefCell<Vec<PresetEvent<u32>>>>) {
#[trial]
fn a_preset_released_over_the_zone_reports_drop_at_and_nothing_else_does() {
// (row grabbed, release point, the drop reported)
let cases: [(&str, Pos2, Option<(u32, Pos2)>); 4] = [
type Case = (&'static str, Pos2, Option<(u32, Pos2)>);
let cases: [Case; 4] = [
("Alpha", pos2(360.0, 100.0), Some((ALPHA, pos2(360.0, 100.0)))),
("Alpha", pos2(360.0, 240.0), None),
("Alpha", pos2(230.0, 100.0), None),