PhotoCraft: An open-source, photo editor written by scratch in pure Rust
docs: README tool count and list match Tool::ALL (#996) (#1710)
MarekSpodBiedry68c2e21da87c
diff --git a/README.md b/README.mdindex 026256bbc..966258d1b 100644--- a/README.md+++ b/README.md@@ -178,8 +178,8 @@ Every screenshot here is the real app at work on public-domain art, rendered off<table><tr><td width="33%" valign="top">- <h4>🧰 34 tools</h4>- Move · Rectangular and Elliptical Marquee · Lasso · Polygonal Lasso · Magnetic Lasso · Magic Wand · Quick Selection · Object Selection · Crop · Eyedropper · Brush · Pencil · Mixer Brush · Color Replacement · Eraser · Clone Stamp · Healing Brush · Spot Healing · History Brush · Gradient · Paint Bucket · Blur · Sharpen · Smudge · Dodge · Burn · Sponge · Pen · Path Selection · Type · five Shape tools · Hand · Zoom+ <h4>🧰 52 tools</h4>+ Move · Rectangular and Elliptical Marquee · Lasso · Polygonal Lasso · Magnetic Lasso · Object Selection · Quick Selection · Magic Wand · Crop · Slice · Slice Select · Eyedropper · Ruler · Note · Count · Spot Healing Brush · Healing Brush · Patch · Content-Aware Move · Red Eye · Brush · Pencil · Mixer Brush · Clone Stamp · Pattern Stamp · History Brush · Eraser · Background Eraser · Magic Eraser · Gradient · Paint Bucket · Blur · Sharpen · Smudge · Dodge · Burn · Sponge · Pen · Horizontal and Vertical Type · Path Selection · Direct Selection · Rectangle · Ellipse · Triangle · Polygon · Line · Custom Shape · Hand · Rotate View · Zoom</td><td width="33%" valign="top"><h4>🖌️ A real brush engine</h4>diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rsindex b34217b33..657a48f1e 100644--- a/crates/ui-egui/src/state.rs+++ b/crates/ui-egui/src/state.rs@@ -1045,6 +1045,29 @@ mod tests {assert_eq!(Tool::from_name("nope"), None);}+ /// The README's "Everything in the box" tool heading and list name exactly the tools a user can+ /// pick, `Tool::ALL` (#996).+ #[test]+ fn readme_tool_list_matches_tool_all() {+ let readme = include_str!("../../../README.md");+ let (_, rest) = readme.split_once("<h4>🧰 ").unwrap();+ let (count, rest) = rest.split_once(" tools</h4>").unwrap();+ assert_eq!(count.parse::<usize>().unwrap(), Tool::ALL.len(), "README.md tool heading");+ let list = rest.trim_start().lines().next().unwrap();+ // "Rectangular and Elliptical Marquee" names two tools: "Rectangular Marquee", "Elliptical Marquee".+ let mut named: Vec<String> = Vec::new();+ for entry in list.split(" · ") {+ match entry.split_once(" and ").and_then(|(first, rest)| Some((first, rest.split_once(' ')?))) {+ Some((first, (second, noun))) => named.extend([format!("{first} {noun}"), format!("{second} {noun}")]),+ None => named.push(entry.to_owned()),+ }+ }+ named.sort();+ let mut labels: Vec<String> = Tool::ALL.iter().map(|tool| tool.label().trim_end_matches(" Tool").to_owned()).collect();+ labels.sort();+ assert_eq!(named, labels, "README.md tool list");+ }+#[test]fn dialogs_open_and_close() {let mut s = UiState::default();