mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-30 05:37:00 -06:00
UI: merge fallout from the UI kit and the recorder heads
Icon buttons no longer carry an accessible name: the tests that came with main since the branch was written (menu hover, popup dismissal, the File menu, More Colors) find Copy, Save and Cancel by label, and the Quick Access Toolbar and formula bar icons gave those labels twice. The macro tests need the names of large, small and toggle ribbon buttons only. The chart menu test takes the menu's Delete, which is drawn after the ribbon's Home > Cells > Delete. The Trust Scripts row ported into the Macros dialog is formatted.
This commit is contained in:
@@ -352,7 +352,11 @@ pub fn macros_dialog(app: &mut SheetApp, ui: &mut Ui, d: &mut Dialog, open: &mut
|
||||
return;
|
||||
}
|
||||
// Scripts that came with a file stay disabled until the user trusts the workbook (#2178).
|
||||
let untrusted = d.result.as_ref().and_then(Json::as_array).is_some_and(|items| items.iter().any(|it| it.get("trusted").and_then(Json::as_bool) == Some(false)));
|
||||
let untrusted = d
|
||||
.result
|
||||
.as_ref()
|
||||
.and_then(Json::as_array)
|
||||
.is_some_and(|items| items.iter().any(|it| it.get("trusted").and_then(Json::as_bool) == Some(false)));
|
||||
if untrusted {
|
||||
ui.horizontal(|ui| {
|
||||
ui.weak("Scripts in this workbook came from a file and are disabled.");
|
||||
|
||||
@@ -60,9 +60,6 @@ pub fn icon_button(ui: &mut Ui, icon: Icon, color: Color32, tip: &str, size: egu
|
||||
ui.painter().rect_filled(rect, 4.0, t.hover);
|
||||
}
|
||||
icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(16.0, 16.0)), icon, color);
|
||||
let name = tr(ui, tip);
|
||||
let enabled = ui.is_enabled();
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, enabled, name));
|
||||
resp.on_hover_text(tip_text(ui, tip))
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,8 @@ fn right_clicking_a_chart_opens_its_menu_not_the_cells() {
|
||||
let (mut h, id) = fixture();
|
||||
let inside = corner(&h, id) - vec2(100.0, 80.0);
|
||||
right_click(&mut h, inside, vec2(0.0, 0.0));
|
||||
h.get_by_label("Delete").click();
|
||||
// Home › Cells › Delete has the same accessible name; the menu is drawn over the ribbon, last.
|
||||
h.get_all_by_label("Delete").last().unwrap().click();
|
||||
h.run_steps(3);
|
||||
assert!(h.state().session.doc().unwrap().wb.active().unwrap().charts.is_empty());
|
||||
assert!(h.state().grid.object_menu.is_none());
|
||||
|
||||
Reference in New Issue
Block a user