forked from 1b-agent/opencadstudio-upstream
feat: validate reverse Lookup inputs
Restrict geometry updates to finite UpdatedDistance columns and reject unsupported mappings atomically.
This commit is contained in:
1 parent
86c0e05878
commit
09cb28e5b0
2 files changed
+22
No files matched your search
@@ -226,6 +226,13 @@ fn reference_row(
|
||||
if property.lookup_property {
|
||||
return true;
|
||||
}
|
||||
if property.value_type != 40
|
||||
|| !property
|
||||
.connection_name
|
||||
.eq_ignore_ascii_case("UpdatedDistance")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let Some(parameter) = params.iter().find(|p| p.id == property.node_id) else {
|
||||
return false;
|
||||
};
|
||||
@@ -331,6 +338,13 @@ pub(crate) fn evaluate_reference_value(
|
||||
if property.lookup_property {
|
||||
continue;
|
||||
}
|
||||
if property.value_type != 40
|
||||
|| !property
|
||||
.connection_name
|
||||
.eq_ignore_ascii_case("UpdatedDistance")
|
||||
{
|
||||
return Err("This Lookup input property is unsupported.");
|
||||
}
|
||||
let parameter = parameters
|
||||
.iter()
|
||||
.find(|parameter| parameter.id == property.node_id)
|
||||
|
||||
@@ -291,6 +291,14 @@ fn lookup_reverse_selection_evaluates_saved_reference_geometry() {
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
|
||||
let mut unsupported = document.clone();
|
||||
let (_, mut malformed) = table(&unsupported, definition, lookup).unwrap().unwrap();
|
||||
malformed.columns[0].connection_name = "UpdatedAngle".into();
|
||||
apply_table(&mut unsupported, definition, lookup, malformed).unwrap();
|
||||
let before = unsupported.clone();
|
||||
assert!(evaluate_reference_choice(&unsupported, insert, "Large").is_err());
|
||||
assert_eq!(unsupported, before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user