From c44971fcd5bbe3bde6c2d4f26841c95cfd82a5b2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 24 Oct 2026 17:45:22 -0700 Subject: [PATCH] =?UTF-8?q?Ribbon:=20Insert=20=E2=80=BA=20Column=20or=20Ba?= =?UTF-8?q?r=20offers=20100%=20Stacked=20Bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Column or Bar menu on the Insert tab listed every column and bar type of the All Charts list except 100% Stacked Bar. It now lists it after Stacked Bar, and choosing it runs insert.chart with type bar and subtype stacked100. --- crates/ui-egui/src/ribbon.rs | 1 + crates/ui-egui/tests/it/interaction.rs | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index ab9cc311d..9c4aab45e 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -1599,6 +1599,7 @@ fn insert(app: &mut SheetApp, ui: &mut Ui) { ("100% Stacked Column", "column", "stacked100"), ("Clustered Bar", "bar", ""), ("Stacked Bar", "bar", "stacked"), + ("100% Stacked Bar", "bar", "stacked100"), ], ), ( diff --git a/crates/ui-egui/tests/it/interaction.rs b/crates/ui-egui/tests/it/interaction.rs index 10841c7bd..191276ad5 100644 --- a/crates/ui-egui/tests/it/interaction.rs +++ b/crates/ui-egui/tests/it/interaction.rs @@ -387,6 +387,30 @@ fn inserted_chart_is_selected_so_delete_removes_it() { assert_eq!(value(&h, "A1"), Value::Number(1.0)); } +#[test] +fn insert_column_or_bar_menu_inserts_a_hundred_percent_stacked_bar() { + // Insert › Column or Bar (keytip N, C1) lists the column and bar types of the All Charts list. + let mut s = blank(); + s.execute("range.setValues", json!({"range": "A1", "values": [["Quarter", "North", "South"], ["Q1", 10, 30], ["Q2", 30, 10]]})).unwrap(); + s.execute("selection.set", json!({"range": "A1:C3"})).unwrap(); + let mut h = harness(s); + key(&mut h, Key::F10, Modifiers::NONE); + for (k, t) in [(Key::N, "n"), (Key::C, "c"), (Key::Num1, "1")] { + h.input_mut().events.push(Event::Key { key: k, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }); + h.input_mut().events.push(Event::Text(t.into())); + h.input_mut().events.push(Event::Key { key: k, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::NONE }); + h.run_steps(2); + } + h.run_steps(2); + for label in ["Clustered Column", "Stacked Column", "100% Stacked Column", "Clustered Bar", "Stacked Bar", "100% Stacked Bar"] { + assert!(h.query_by_role_and_label(egui::accesskit::Role::Button, label).is_some(), "the menu lists {label}"); + } + h.get_by_role_and_label(egui::accesskit::Role::Button, "100% Stacked Bar").click(); + h.run_steps(2); + let kinds: Vec<_> = h.state().session.active().unwrap().wb.active().unwrap().charts.iter().map(|c| c.kind).collect(); + assert_eq!(kinds, [gridcraft_engine::model::ChartKind::BarStacked100]); +} + #[test] fn renders_every_ribbon_tab_without_panicking() { let mut s = Session::new();