Add tests to the Ellipse, Artboard, and Fill tools (#2181)

* Add ellipse tests

* Add tests for fill tool and re-enable some other tests

* Code review

* Fix Rust crate advisory

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
James Lindsay
2025-03-07 02:13:15 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent 1190e82322
commit b171eeba84
22 changed files with 1097 additions and 236 deletions
@@ -5622,6 +5622,34 @@ impl NodeNetworkInterface {
self.force_set_upstream_to_chain(node_id, network_path);
}
}
pub fn iter_recursive(&self) -> NodesRecursiveIter<'_> {
NodesRecursiveIter {
stack: vec![&self.network],
current_slice: None,
}
}
}
pub struct NodesRecursiveIter<'a> {
stack: Vec<&'a NodeNetwork>,
current_slice: Option<std::collections::hash_map::Iter<'a, NodeId, DocumentNode>>,
}
impl<'a> Iterator for NodesRecursiveIter<'a> {
type Item = (NodeId, &'a DocumentNode);
fn next(&mut self) -> Option<Self::Item> {
loop {
if let Some((id, node)) = self.current_slice.as_mut().and_then(|iter| iter.next()) {
if let DocumentNodeImplementation::Network(network) = &node.implementation {
self.stack.push(network);
}
return Some((*id, node));
}
let network = self.stack.pop()?;
self.current_slice = Some(network.nodes.iter());
}
}
}
#[derive(PartialEq)]