Let the accessibility test see a callback that takes an argument
`sets()` recognised `name:` and `name =>` and not `name(arg) =>`, which is how Slint writes a callback handler with a parameter. There is exactly one of those among the properties asserted — `accessible-action-set-value`, the action a screen reader uses to type a number into a slider — so the test reported `SliderTrack` as missing the action it declares four lines above. A false alarm rather than a false pass, and the less dangerous of the two. It is still worth fixing rather than dropping the assertion: set-value is the action that makes a slider reachable without dragging, which is most of what the actions were added for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -180,7 +180,13 @@ fn line_offsets(source: &str) -> impl Iterator<Item = (usize, &str)> {
|
||||
}
|
||||
|
||||
/// Whether a block sets a property — the name at the start of a line, followed
|
||||
/// by `:` for a property or `=>` for a callback.
|
||||
/// by what Slint puts after a name it is binding to.
|
||||
///
|
||||
/// Three forms, and the third is easy to forget: `name:` for a property,
|
||||
/// `name =>` for a callback, and `name(arg) =>` for a callback that takes one.
|
||||
/// `accessible-action-set-value` is the only member of the third group here and
|
||||
/// leaving it out made this test report the slider as missing the very action
|
||||
/// it declares.
|
||||
///
|
||||
/// Anchored at the start of the trimmed line so that a *mention* in the prose
|
||||
/// above a component does not count. These files carry more comment than code,
|
||||
@@ -191,8 +197,10 @@ fn line_offsets(source: &str) -> impl Iterator<Item = (usize, &str)> {
|
||||
fn sets(block: &str, property: &str) -> bool {
|
||||
block.lines().any(|line| {
|
||||
let line = line.trim_start();
|
||||
line.strip_prefix(property)
|
||||
.is_some_and(|rest| rest.starts_with(':') || rest.trim_start().starts_with("=>"))
|
||||
line.strip_prefix(property).is_some_and(|rest| {
|
||||
let rest = rest.trim_start();
|
||||
rest.starts_with(':') || rest.starts_with("=>") || rest.starts_with('(')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user