Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ where
break;
}
}
Event::Comment(_) => {}
Event::Comment(_) | Event::Empty(_) => {}
_ => break,
}
}
Expand Down Expand Up @@ -1772,6 +1772,44 @@ mod tests {
);
}

#[test]
fn test_parse_placemark_children_with_empty_field() {
let kml_str = r#"
<Placemark>
<name>Test Placemark</name>
<ExtendedData>
<CustomField>CustomValue</CustomField>
<EmptyField/>
<AnotherCustomField>CustomValue2</AnotherCustomField>
</ExtendedData>
</Placemark>
"#;
let f: Kml = kml_str.parse().unwrap();
assert_eq!(
f,
Kml::Placemark(Placemark {
name: Some("Test Placemark".to_string()),
children: vec![Element {
name: "ExtendedData".to_string(),
children: vec![
Element {
name: "CustomField".to_string(),
content: Some("CustomValue".to_string()),
..Default::default()
},
Element {
name: "AnotherCustomField".to_string(),
content: Some("CustomValue2".to_string()),
..Default::default()
}
],
..Default::default()
}],
..Default::default()
})
);
}

#[test]
fn test_parse_doc_with_sibling_folders() {
let kml_str = r#"
Expand Down
9 changes: 2 additions & 7 deletions src/types/vec2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,14 @@ impl Default for Vec2 {
}
}

#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub enum Units {
#[default]
Fraction,
Pixels,
InsetPixels,
}

impl Default for Units {
fn default() -> Self {
Self::Fraction
}
}

impl FromStr for Units {
type Err = Error;

Expand Down
Loading