mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 17:56:50 -06:00
G8: regression test for art style filter cap
## Summary Illustrator `%AI9` art styles already stop reading filters after 4096 entries so hostile styles cannot grow without bound. This adds a regression test that importing a style with more than `MAX_FILTERS` basic filters finishes with a bounded effect list, matching the existing hardening behaviour. ## Tests - `art_styles_ignore_filters_beyond_the_cap` in `crates/eps/src/import/ai/style.rs` Part of gap G8 Co-authored-by: nrq6993-a11y <nrq6993-a11y@users.noreply.github.com>
This commit is contained in:
committed by
bflatastic
co-authored by
nrq6993-a11y
parent
0490ca0788
commit
00f557e02e
@@ -764,6 +764,19 @@ mod tests {
|
||||
assert_eq!(feather.params["radius"].as_f64(), Some(5.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn art_styles_ignore_filters_beyond_the_cap() {
|
||||
const UNIT: &[u8] = b"/BasicFilter :\n(Adobe Feather) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n; /Dict ;\n /Part ,\n";
|
||||
let mut data =
|
||||
Vec::from(b"/KnownStyle :\n(Capped) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n");
|
||||
for _ in 0..MAX_FILTERS + 16 {
|
||||
data.extend_from_slice(UNIT);
|
||||
}
|
||||
data.extend_from_slice(b";\n");
|
||||
let style = art_styles(&data).remove("Capped").unwrap_or_default();
|
||||
assert!(style.effects.len() <= MAX_FILTERS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hostile_dash_offsets_and_width_profiles_are_tamed() {
|
||||
let mut f = Filter::default();
|
||||
|
||||
Reference in New Issue
Block a user