mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-20 00:55:43 +00:00
#3779: pin bounded PSD placement fixes and test app boundaries
This commit is contained in:
1 parent
cc5c5cb732
commit
a1c1288b13
3 files changed
+37
-2
No files matched your search
Generated
+1
-1
@@ -1449,7 +1449,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-psd"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=30cad49e958caa58ebd04eb1d459ab616a07c63f#30cad49e958caa58ebd04eb1d459ab616a07c63f"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=f8d869c1e70d1df8109a951c3a30eb2e0aecd54c#f8d869c1e70d1df8109a951c3a30eb2e0aecd54c"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"flate2",
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs"
|
||||
craft-ps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "808730f49b9637b7909fe2ae56f9d63fdb100cae", default-features = false, features = ["read"] }
|
||||
craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" }
|
||||
craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" }
|
||||
craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "30cad49e958caa58ebd04eb1d459ab616a07c63f" }
|
||||
craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "f8d869c1e70d1df8109a951c3a30eb2e0aecd54c" }
|
||||
craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77686f24fe8665c21369f1b593f4d65a973e2a45" }
|
||||
craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" }
|
||||
craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" }
|
||||
|
||||
@@ -716,3 +716,38 @@ fn identifier_and_index_references_preserve_non_null_classes_exactly() {
|
||||
assert_eq!(out, bytes);
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn shared_descriptor_nesting_preserves_the_application_boundary() {
|
||||
use craft_psd::descriptor::{Descriptor as Shared, Value};
|
||||
for count in [33, 64, 65] {
|
||||
let mut value = Value::Integer(1);
|
||||
for _ in 0..count {
|
||||
value = Value::Descriptor(Shared::new("null").with("next", value));
|
||||
}
|
||||
let bytes = Shared::new("null").with("root", value).to_bytes();
|
||||
let result = crate::descriptor::read_descriptor(&mut Reader::new(&bytes));
|
||||
assert_eq!(result.is_ok(), count <= 64, "nested descriptor count {count}: {result:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shared_placed_layer_adapter_normalizes_before_warp_classification() {
|
||||
use craft_psd::descriptor::{Descriptor as Shared, Id, Value};
|
||||
let warp = Shared::new("warp")
|
||||
.with("warpStyle", Value::Enumerated { type_id: Id::new("warpStyle"), value: Id::new("warpArc") })
|
||||
.with("warpValue", Value::Double(f64::NAN))
|
||||
.with("warpPerspective", Value::Double(f64::INFINITY))
|
||||
.with("warpPerspectiveOther", Value::Double(f64::NEG_INFINITY));
|
||||
let quad = [f64::NAN, 0.0, 20.0, 0.0, 20.0, 10.0, 0.0, 10.0];
|
||||
let descriptor = Shared::new("null").with("Trnf", Value::List(quad.into_iter().map(Value::Double).collect())).with("warp", Value::Descriptor(warp));
|
||||
let mut bytes = b"soLD".to_vec();
|
||||
bytes.extend_from_slice(&4u32.to_be_bytes());
|
||||
bytes.extend_from_slice(&16u32.to_be_bytes());
|
||||
bytes.extend_from_slice(&descriptor.to_bytes());
|
||||
let shared = craft_psd::smart::SmartObject::from_placed_layer_data_with_limits(&bytes, crate::descriptor::PARSE_LIMITS).unwrap();
|
||||
let object = crate::placed::from_craft_smart(shared);
|
||||
assert_eq!(object.quad, [[0.0, 0.0], [20.0, 0.0], [20.0, 10.0], [0.0, 10.0]]);
|
||||
assert!(object.warp.is_none(), "normalization must precede identity classification");
|
||||
assert!(!object.needs_bake());
|
||||
assert_eq!(object.map([10.0, 5.0], 20.0, 10.0), [10.0, 5.0]);
|
||||
}
|
||||
Reference in new issue
Block a user