Ribbon: Insert › Column or Bar offers 100% Stacked Bar

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.
This commit is contained in:
dotCooCoo
2026-10-24 17:45:22 -07:00
parent 3099df934e
commit c44971fcd5
2 changed files with 25 additions and 0 deletions
+1
View File
@@ -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"),
],
),
(
+24
View File
@@ -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();