mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 14:51:15 +00:00
Fix spurious test failures
The accepted child element types are stored in a hash map, so sort them as part of the error message.
This commit is contained in:
parent
89a05245f9
commit
f03ba40d50
2 changed files with 6 additions and 5 deletions
|
@ -6,7 +6,7 @@ TestCase := Rectangle {
|
|||
LineTo { x: 100; y: 0; }
|
||||
LineTo { x: 100; y: 0; }
|
||||
Rectangle {}
|
||||
// ^error{Rectangle is not allowed within Path. Only LineTo ArcTo are valid children}
|
||||
// ^error{Rectangle is not allowed within Path. Only ArcTo LineTo are valid children}
|
||||
}
|
||||
|
||||
LineTo { x: 100; y: 0; }
|
||||
|
|
|
@ -117,14 +117,15 @@ impl Type {
|
|||
return Ok(child_type.clone());
|
||||
}
|
||||
if builtin.disallow_global_types_as_child_elements {
|
||||
let mut valid_children: Vec<_> =
|
||||
builtin.additional_accepted_child_types.keys().cloned().collect();
|
||||
valid_children.sort();
|
||||
|
||||
return Err(format!(
|
||||
"{} is not allowed within {}. Only {} are valid children",
|
||||
name,
|
||||
builtin.class_name,
|
||||
builtin
|
||||
.additional_accepted_child_types
|
||||
.keys()
|
||||
.fold(String::new(), |children, ty| children + ty + " ")
|
||||
valid_children.join(" ")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue