Skip to content

Commit

Permalink
Revert API change in 53c603c
Browse files Browse the repository at this point in the history
In the previous version of quick-xml there was an issue that prevented
deserialization of Option<Vec<_>>. We worked around this by changing our
API, but that change was not an improvement, and the issue is fixed in
quick-xml 0.28. Since I intend to yank norad 0.9, we can revert that
change, providing a better upgrade path for our users.
  • Loading branch information
cmyr committed Mar 17, 2023
1 parent 8d7f6a7 commit e351a73
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/designspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ pub struct Axis {
#[serde(rename = "@values")]
pub values: Option<Vec<f32>>,
/// Mapping between user space coordinates and design space coordinates.
#[serde(default)]
pub map: Vec<AxisMapping>,
pub map: Option<Vec<AxisMapping>>,
}

/// Maps one input value (user space coord) to one output value (design space coord).
Expand Down Expand Up @@ -233,7 +232,10 @@ mod tests {
assert_eq!(axis.minimum, Some(400.));
assert_eq!(axis.maximum, Some(600.));
assert_eq!(axis.default, 500.);
assert_eq!(&vec![AxisMapping { input: 400., output: 100. }], &ds.axes[0].map);
assert_eq!(
&vec![AxisMapping { input: 400., output: 100. }],
ds.axes[0].map.as_ref().unwrap()
);
assert_eq!(1, ds.sources.len());
let weight_100 = dim_name_xvalue("Weight", 100.);
assert_eq!(vec![weight_100.clone()], ds.sources[0].location);
Expand All @@ -245,7 +247,7 @@ mod tests {
fn read_wght_variable() {
let ds = DesignSpaceDocument::load("testdata/wght.designspace").unwrap();
assert_eq!(1, ds.axes.len());
assert!(ds.axes[0].map.is_empty());
assert!(ds.axes[0].map.is_none());
assert_eq!(
vec![
("TestFamily-Regular.ufo".to_string(), vec![dim_name_xvalue("Weight", 400.)]),
Expand Down

0 comments on commit e351a73

Please sign in to comment.