mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 02:07:10 +01:00
Merge pull request #10061 from dotCooCoo/fix/panel-menu-command-names
Panels: menu rows show their names instead of command ids
This commit is contained in:
25 files changed
+297
-113
No files matched your search
@@ -80,11 +80,14 @@ pub(crate) fn rows() -> Vec<PanelRow> {
|
||||
}
|
||||
|
||||
/// Dims the Select row of each status no image or placed document has ([`enabled`]), in the states of
|
||||
/// the commands the Links panel's menu shows.
|
||||
/// the commands the Links panel's menu shows, and names each row and its Shift alternate for its status: the
|
||||
/// catalog's label for the command is Select by Link Status's.
|
||||
pub(crate) fn states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
for &(status, ..) in &STATUSES {
|
||||
for &(status, label, _) in &STATUSES {
|
||||
let params = json!({ "status": status });
|
||||
states.set(CommandRef::with_params(COMMAND, params.clone()), CommandState::new().enabled(enabled(app, ¶ms)));
|
||||
let state = CommandState::new().enabled(enabled(app, ¶ms)).title(crate::i18n::t(label));
|
||||
states.set(CommandRef::with_params(COMMAND, with_shift(params.clone())), state.clone());
|
||||
states.set(CommandRef::with_params(COMMAND, params), state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,14 +178,20 @@ fn menu_items_are_on_for_the_statuses_present_and_shift_adds() {
|
||||
{
|
||||
assert_eq!(item(label).enabled, on, "{label}");
|
||||
}
|
||||
// The Links panel's rows follow the statuses present, per status.
|
||||
let enabled_of = |app: &VectorcraftApp| {
|
||||
// The Links panel's rows follow the statuses present, per status, and each row and its Shift alternate is named
|
||||
// for its status.
|
||||
let enabled_of = |app: &VectorcraftApp, shift: bool| {
|
||||
let mut all = CommandStates::new();
|
||||
states(app, &mut all);
|
||||
STATUSES.map(|(status, ..)| all.get(&CommandRef::with_params(COMMAND, json!({ "status": status }))).cloned())
|
||||
STATUSES.map(|(status, ..)| {
|
||||
let p = json!({ "status": status });
|
||||
all.get(&CommandRef::with_params(COMMAND, if shift { with_shift(p) } else { p })).cloned()
|
||||
})
|
||||
};
|
||||
let on = Some(CommandState::new().enabled(true));
|
||||
assert_eq!(enabled_of(&app), [on.clone(), on.clone(), on.clone(), Some(CommandState::new().enabled(false))]);
|
||||
let named = |on: bool, label: &str| Some(CommandState::new().enabled(on).title(label));
|
||||
let want = [named(true, "Select Linked"), named(true, "Select Embedded"), named(true, "Select Missing"), named(false, "Select Modified")];
|
||||
assert_eq!(enabled_of(&app, false), want);
|
||||
assert_eq!(enabled_of(&app, true), want, "the Shift alternates");
|
||||
// The item's params run as the menu runs them: Shift's alternate is `with_shift` of them.
|
||||
let run = |app: &mut VectorcraftApp, status: &str, shift: bool| {
|
||||
let p = json!({ "status": status });
|
||||
@@ -207,9 +213,9 @@ fn menu_items_are_on_for_the_statuses_present_and_shift_adds() {
|
||||
app.run("select.set", json!({"ids": [harbour]})).unwrap();
|
||||
app.run("edit.clear", json!({})).unwrap();
|
||||
refresh(&mut app, 1.0);
|
||||
let after = enabled_of(&app);
|
||||
assert_eq!(after[2], Some(CommandState::new().enabled(false)), "no missing image is left");
|
||||
assert_eq!(after[1], on, "the embedded one stays");
|
||||
let after = enabled_of(&app, false);
|
||||
assert_eq!(after[2], named(false, "Select Missing"), "no missing image is left");
|
||||
assert_eq!(after[1], named(true, "Select Embedded"), "the embedded one stays");
|
||||
}
|
||||
|
||||
/// A missing link kept only in a symbol's art can't be selected: Select Missing stays off and
|
||||
|
||||
@@ -614,6 +614,16 @@ pub(crate) fn panel_menu_states(app: &VectorcraftApp, states: &mut CommandStates
|
||||
crate::canvas::task_bar::menu_states(app, states);
|
||||
}
|
||||
|
||||
/// Names the panel menu rows `rows` in `states`, each by its English label shown in the UI language: a row the menu bar
|
||||
/// and the keymap do not list has no catalog label, and shows its command id without one. The state set for a row
|
||||
/// keeps its enabled and checked flags.
|
||||
pub(crate) fn name_rows<'a>(states: &mut CommandStates, rows: impl IntoIterator<Item = (CommandRef, &'a str)>) {
|
||||
for (command, label) in rows {
|
||||
let state = states.get(&command).cloned().unwrap_or_default();
|
||||
states.set(command, state.title(crate::i18n::t(label)));
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs panel menu command `id` when a panel runs it itself; `None` otherwise.
|
||||
pub(crate) fn run_menu_command(app: &mut VectorcraftApp, id: &str, params: &Value) -> Option<Result<Value, String>> {
|
||||
if id == "ui.libraryPanel.add" {
|
||||
@@ -1318,6 +1328,8 @@ mod tests_links;
|
||||
#[cfg(test)]
|
||||
mod tests_maskview;
|
||||
#[cfg(test)]
|
||||
mod tests_menu_names;
|
||||
#[cfg(test)]
|
||||
mod tests_panel_rows;
|
||||
#[cfg(test)]
|
||||
mod tests_panel_spacing;
|
||||
|
||||
@@ -145,17 +145,17 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
set(Row::Panel(C::InsertStop), recording || has);
|
||||
set(Row::Panel(C::InsertMenuItem), recording || has);
|
||||
set(Row::Panel(C::InsertPath), (recording || has) && f.path);
|
||||
set(Row::SelectObject, recording || has);
|
||||
set(Row::Options, has);
|
||||
set(Row::Panel(C::PlaybackOptions), true);
|
||||
set(Row::Panel(C::Save), f.current.is_some());
|
||||
set(Row::Panel(C::Load), can_load(app));
|
||||
set(Row::Panel(C::Replace), can_load(app) && f.idle);
|
||||
set(Row::Panel(C::ClearAll), f.idle && f.sets > 0);
|
||||
set(Row::Panel(C::Reset), f.idle);
|
||||
// The framework's labels differ from the panel's own words on these rows.
|
||||
let titled = |row: Row, title: &str, enabled: bool| (row.command(), CommandState::new().enabled(enabled).title(title.to_string()));
|
||||
// The framework's labels differ from the panel's own words on these rows, and the panel's own rows have none.
|
||||
let titled = |row: Row, title: &str, enabled: bool| (row.command(), CommandState::new().enabled(enabled).title(crate::i18n::t(title)));
|
||||
for (command, state) in [
|
||||
titled(Row::SelectObject, "Select Object…", recording || has),
|
||||
titled(Row::Options, "Action Options…", has),
|
||||
titled(Row::Panel(C::Play), "Play Current Selection", has || f.waiting),
|
||||
titled(Row::Panel(C::InsertPath), "Insert Select Path", (recording || has) && f.path),
|
||||
titled(Row::Panel(C::ClearAll), "Clear Actions", f.idle && f.sets > 0),
|
||||
|
||||
@@ -604,13 +604,14 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let hidden = part_hidden(app, HIDE_OPTIONS);
|
||||
let prefs = &app.session.prefs;
|
||||
states.set(CommandRef::new("ui.align.hideOptions"), CommandState::new().title(if hidden { tl!("Show Options") } else { tl!("Hide Options") }));
|
||||
states.set(CommandRef::new("ui.align.usePreviewBounds"), CommandState::new().checked(prefs.use_preview_bounds));
|
||||
states.set(CommandRef::new("ui.align.cancelKeyObject"), CommandState::new().enabled(align_to(app) == AlignTo::Key));
|
||||
states.set(CommandRef::new("ui.align.usePreviewBounds"), CommandState::new().checked(prefs.use_preview_bounds).title(tl!("Use Preview Bounds")));
|
||||
let cancel = CommandState::new().enabled(align_to(app) == AlignTo::Key).title(tl!("Cancel Key Object"));
|
||||
states.set(CommandRef::new("ui.align.cancelKeyObject"), cancel);
|
||||
// The key choice is named for what the key is: Align to Key Anchor while it is an anchor point.
|
||||
let key = CommandState::new().enabled(can_choose(app, AlignTo::Key)).checked(shown_align_to(app) == AlignTo::Key);
|
||||
states.set(CommandRef::new("align.toKeyObject"), key.title(align_to_icon_name(AlignTo::Key, key_is_anchor(app)).1));
|
||||
states.set(CommandRef::new("ui.align.glyphBoundsPoint"), CommandState::new().checked(prefs.align_glyph_bounds_point));
|
||||
states.set(CommandRef::new("ui.align.glyphBoundsArea"), CommandState::new().checked(prefs.align_glyph_bounds_area));
|
||||
states.set(CommandRef::new("ui.align.glyphBoundsPoint"), CommandState::new().checked(prefs.align_glyph_bounds_point).title(tl!("Point Text")));
|
||||
states.set(CommandRef::new("ui.align.glyphBoundsArea"), CommandState::new().checked(prefs.align_glyph_bounds_area).title(tl!("Area Text")));
|
||||
}
|
||||
|
||||
/// Runs the Align panel menu command `id`; `None` when `id` is not one of them. The glyph-bounds
|
||||
|
||||
@@ -1898,8 +1898,8 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let enabled = |on: bool| CommandState::new().enabled(on);
|
||||
states.set("appearance.addFill", enabled(has));
|
||||
states.set("appearance.addStroke", enabled(has));
|
||||
states.set(DUPLICATE_ITEM, enabled(has && sel.editable()));
|
||||
states.set(REMOVE_ITEM, enabled(has && sel.deletable()));
|
||||
states.set(DUPLICATE_ITEM, enabled(has && sel.editable()).title(tl!("Duplicate Item")));
|
||||
states.set(REMOVE_ITEM, enabled(has && sel.deletable()).title(tl!("Remove Item")));
|
||||
states.set("appearance.clear", enabled(has));
|
||||
states.set("appearance.reduceToBasic", enabled(any_subject_needs_reduction(app)));
|
||||
states.set(new_art_basic(app), enabled(true).checked(app.session.prefs.new_art_basic));
|
||||
|
||||
@@ -824,25 +824,46 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let facts = Facts::of(app);
|
||||
for panel_row in menu_rows(app) {
|
||||
let PanelRow::Command(command) = panel_row else { continue };
|
||||
let Some(f) = &facts else {
|
||||
states.set(command, CommandState::new().enabled(false));
|
||||
continue;
|
||||
let row = command.id.strip_prefix(PREFIX).unwrap_or_default();
|
||||
let state = match (&facts, row) {
|
||||
(None, _) => CommandState::new().enabled(false),
|
||||
(Some(f), "add" | "add3D") => CommandState::new().enabled(f.has_art),
|
||||
(Some(f), "selectAll") => CommandState::new().enabled(!f.all.is_empty()),
|
||||
(Some(f), "remove") => CommandState::new().enabled(!f.sel.is_empty()),
|
||||
(Some(f), "subfolders") => CommandState::new().checked(f.subfolders),
|
||||
(Some(f), "openLocation") => CommandState::new().checked(f.open_location),
|
||||
(Some(f), "applyPreset") => CommandState::new().checked(f.applied == command.params["name"].as_str().unwrap_or_default()),
|
||||
(Some(f), "saveChanges" | "deletePreset") => CommandState::new().enabled(f.saved),
|
||||
(Some(f), "exportPreset") => CommandState::new().enabled(f.known),
|
||||
_ => CommandState::new(),
|
||||
};
|
||||
let state = match command.id.strip_prefix(PREFIX).unwrap_or_default() {
|
||||
"add" | "add3D" => CommandState::new().enabled(f.has_art),
|
||||
"selectAll" => CommandState::new().enabled(!f.all.is_empty()),
|
||||
"remove" => CommandState::new().enabled(!f.sel.is_empty()),
|
||||
"subfolders" => CommandState::new().checked(f.subfolders),
|
||||
"openLocation" => CommandState::new().checked(f.open_location),
|
||||
"applyPreset" => {
|
||||
let name = command.params["name"].as_str().unwrap_or_default().to_string();
|
||||
CommandState::new().checked(f.applied == name).title(name)
|
||||
}
|
||||
"saveChanges" | "deletePreset" => CommandState::new().enabled(f.saved),
|
||||
"exportPreset" => CommandState::new().enabled(f.known),
|
||||
_ => continue,
|
||||
let title = match row {
|
||||
"applyPreset" => command.params["name"].as_str().unwrap_or_default().to_string(),
|
||||
"add" if command.params["multiple"] == true => tl!("Add Selected Artwork as Multiple Assets").to_string(),
|
||||
row => tl!(menu_label(row)).to_string(),
|
||||
};
|
||||
states.set(command, state);
|
||||
states.set(command, state.title(title));
|
||||
}
|
||||
}
|
||||
|
||||
/// The English label of the panel menu's row `row` (`ui.assetExport.<row>`); Add Selected Artwork as Multiple Assets
|
||||
/// and the presets' rows are named by [`menu_states`].
|
||||
fn menu_label(row: &str) -> &'static str {
|
||||
match row {
|
||||
"add" => "Add Selected Artwork as One Asset",
|
||||
"add3D" => "Export 3D Object",
|
||||
"selectAll" => "Select All Assets",
|
||||
"remove" => "Remove Selected Assets",
|
||||
"exportForScreens" => "Export for Screens…",
|
||||
"formatSettings" => "Format Settings…",
|
||||
"subfolders" => "Create Sub-folders",
|
||||
"openLocation" => "Open Location after Export",
|
||||
"savePresetAs" => "Save As Preset…",
|
||||
"saveChanges" => "Save Changes",
|
||||
"deletePreset" => "Delete Preset",
|
||||
"importPreset" => "Import Preset…",
|
||||
"exportPreset" => "Export Preset…",
|
||||
_ => "",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -767,6 +767,25 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
states.set(CommandRef::new(THUMBNAIL_VIEW), on(true).checked(!view.list));
|
||||
states.set(CommandRef::new(LIST_VIEW), on(true).checked(view.list));
|
||||
states.set(CommandRef::new(SAVE_LIBRARY), on(!list.is_empty()));
|
||||
let names = [
|
||||
(new_brush("calligraphic"), "New Calligraphic Brush"),
|
||||
(new_brush("bristle"), "New Bristle Brush"),
|
||||
(new_brush("art"), "New Art Brush from Selection"),
|
||||
(new_brush("scatter"), "New Scatter Brush from Selection"),
|
||||
(new_brush("pattern"), "New Pattern Brush from Selection"),
|
||||
(CommandRef::new(DUPLICATE), "Duplicate Brush"),
|
||||
(CommandRef::new(DELETE_BRUSH), "Delete Brush"),
|
||||
(CommandRef::new(SELECT_UNUSED), "Select All Unused"),
|
||||
(CommandRef::new(THUMBNAIL_VIEW), "Thumbnail View"),
|
||||
(CommandRef::new(LIST_VIEW), "List View"),
|
||||
(CommandRef::new(SAVE_LIBRARY), "Save Brush Library…"),
|
||||
];
|
||||
super::name_rows(states, names);
|
||||
for (ty, label) in KINDS {
|
||||
let title = crate::i18n::fmt(tl!("Show {kind} Brushes"), &[("kind", tl!(label))]);
|
||||
let state = states.get(&show_kind(ty)).cloned().unwrap_or_default();
|
||||
states.set(show_kind(ty), state.title(title));
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs the panel menu's own row `id`; `None` for an id that is not one of them.
|
||||
|
||||
@@ -412,6 +412,7 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
for id in [SAVE, ADD_TO_SWATCHES, EDIT, DELETE] {
|
||||
states.set(CommandRef::new(id), CommandState::new().enabled(enabled(app, id)));
|
||||
}
|
||||
super::name_rows(states, [(CommandRef::new(SAVE), "Save Theme"), (CommandRef::new(ADD_TO_SWATCHES), "Add to Swatches")]);
|
||||
states.set(CommandRef::new(SHOW_FIND), CommandState::new().checked(app.ui.color_themes_panel.show_find));
|
||||
}
|
||||
|
||||
|
||||
@@ -285,17 +285,18 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let panel = &app.ui.css_properties_panel;
|
||||
let selection = app.session.active().map(|st| !st.selection.is_empty());
|
||||
let (has_doc, selected) = (selection.is_some(), selection == Some(true));
|
||||
states.set(CommandRef::new(COPY_SELECTED), CommandState::new().enabled(selected));
|
||||
states.set(CommandRef::new(EXPORT_SELECTED), CommandState::new().enabled(selected));
|
||||
states.set(CommandRef::new(EXPORT_ALL), CommandState::new().enabled(has_doc));
|
||||
states.set(CommandRef::new(GENERATE), CommandState::new().enabled(has_doc).checked(panel.all));
|
||||
states.set(CommandRef::new(COPY_SELECTED), CommandState::new().enabled(selected).title(tl!("Copy Selected Style")));
|
||||
states.set(CommandRef::new(EXPORT_SELECTED), CommandState::new().enabled(selected).title(tl!("Export Selected CSS…")));
|
||||
states.set(CommandRef::new(EXPORT_ALL), CommandState::new().enabled(has_doc).title(tl!("Export All…")));
|
||||
states.set(CommandRef::new(GENERATE), CommandState::new().enabled(has_doc).checked(panel.all).title(tl!("Generate CSS")));
|
||||
for units in CssUnits::ALL {
|
||||
states.set(units_ref(units), CommandState::new().checked(panel.options.units == units));
|
||||
states.set(units_ref(units), CommandState::new().checked(panel.options.units == units).title(units.name()));
|
||||
}
|
||||
let mut options = panel.options.clone();
|
||||
for name in FLAGS {
|
||||
let labels = [tl!("Absolute Position"), tl!("Width and Height"), tl!("Unnamed Objects"), tl!("Rasterize Unsupported Art")];
|
||||
for (name, label) in FLAGS.into_iter().zip(labels) {
|
||||
let on = flag_mut(&mut options, name).is_some_and(|on| *on);
|
||||
states.set(option_ref(name), CommandState::new().checked(on));
|
||||
states.set(option_ref(name), CommandState::new().checked(on).title(label));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -397,8 +397,10 @@ pub(crate) fn menu_rows(_app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
|
||||
/// The states of the menu's rows: Refresh needs a document, Show Options is checked while the options show.
|
||||
pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
states.set(CommandRef::new(REFRESH), CommandState::new().enabled(app.session.active().is_some()));
|
||||
states.set(CommandRef::new(SHOW_OPTIONS), CommandState::new().checked(app.ui.flattener_preview.show_options));
|
||||
states.set(CommandRef::new(REFRESH), CommandState::new().enabled(app.session.active().is_some()).title(tl!("Refresh")));
|
||||
states.set(CommandRef::new(SHOW_OPTIONS), CommandState::new().checked(app.ui.flattener_preview.show_options).title(tl!("Show Options")));
|
||||
states.set(CommandRef::new(FIT_IN_WINDOW), CommandState::new().title(tl!("Fit in Window")));
|
||||
states.set(CommandRef::new(SAVE_PRESET), CommandState::new().title(tl!("Save Transparency Flattener Preset…")));
|
||||
}
|
||||
|
||||
/// Runs a menu row; `None` for an id that is not this panel's.
|
||||
|
||||
@@ -1395,6 +1395,7 @@ pub(crate) fn menu_rows(app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
/// The row titles of a category, which are the panel's words, with the check on the shown one. A
|
||||
/// form no face of the selection has a feature for is disabled ([`form_faces`]).
|
||||
pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
states.set(CommandRef::new("ui.glyphs.useTextFont"), CommandState::new().title(tl!("Use the Selected Text's Font")));
|
||||
let (_, _, face) = browsed_face(app);
|
||||
let cats = categories(face.as_deref());
|
||||
let current = current_category(app, &cats);
|
||||
|
||||
@@ -872,6 +872,19 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
for (v, _) in View::ALL {
|
||||
states.set(view_ref(v), CommandState::new().checked(app.ui.graphic_styles_view == v));
|
||||
}
|
||||
let names = [
|
||||
("new", "New Graphic Style…"),
|
||||
("duplicate", "Duplicate Graphic Style"),
|
||||
("merge", "Merge Graphic Styles"),
|
||||
("delete", "Delete Graphic Style"),
|
||||
("selectUnused", "Select All Unused"),
|
||||
("square", "Use Square for Previews"),
|
||||
("text", "Use Text for Previews"),
|
||||
("options", "Graphic Style Options…"),
|
||||
];
|
||||
let rows = names.into_iter().map(|(row, label)| (CommandRef::new(id(row)), label));
|
||||
let views = View::ALL.into_iter().map(|(v, label)| (view_ref(v), label));
|
||||
crate::panels::name_rows(states, rows.chain(views).chain([(override_ref(app), "Override Character Color")]));
|
||||
}
|
||||
|
||||
/// Run the panel-menu row `id` (an id under `ui.graphicStyles`).
|
||||
|
||||
@@ -1086,6 +1086,7 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let state = states.get(&command).cloned().unwrap_or_else(CommandState::new).enabled(enabled);
|
||||
states.set(command, state);
|
||||
}
|
||||
states.set(CommandRef::new("ui.imageTrace.reset"), CommandState::new().title(tl!("Reset to Default")));
|
||||
}
|
||||
|
||||
/// The panel's own menu commands.
|
||||
|
||||
@@ -1054,14 +1054,14 @@ fn link_info(ui: &mut Ui, app: &VectorcraftApp, info: Option<(u64, &Value)>, uni
|
||||
reveal
|
||||
}
|
||||
|
||||
/// A command row with the state its panel-menu row shows.
|
||||
fn entry(app: &VectorcraftApp, f: &Facts, id: &str, params: Value, a: Act) -> (CommandRef, CommandState) {
|
||||
(CommandRef::with_params(id, params), CommandState::new().enabled(can(app, a, f, None)))
|
||||
/// A command row named `label` with the state its panel-menu row shows.
|
||||
fn entry(app: &VectorcraftApp, f: &Facts, id: &str, params: Value, a: Act, label: &str) -> (CommandRef, CommandState) {
|
||||
(CommandRef::with_params(id, params), CommandState::new().enabled(can(app, a, f, None)).title(tl!(label)))
|
||||
}
|
||||
|
||||
/// A command row that is always enabled and checked or not.
|
||||
fn option_entry(id: &str, params: Value, checked: bool) -> (CommandRef, CommandState) {
|
||||
(CommandRef::with_params(id, params), CommandState::new().enabled(true).checked(checked))
|
||||
/// A command row named `label` that is always enabled and checked or not.
|
||||
fn option_entry(id: &str, params: Value, checked: bool, label: &str) -> (CommandRef, CommandState) {
|
||||
(CommandRef::with_params(id, params), CommandState::new().enabled(true).checked(checked).title(tl!(label)))
|
||||
}
|
||||
|
||||
/// The panel menu's command rows with their states, in the groups the menu separates: the link
|
||||
@@ -1072,29 +1072,32 @@ fn groups(app: &VectorcraftApp) -> [Vec<(CommandRef, CommandState)>; 6] {
|
||||
let selected = selected_links(app);
|
||||
let f = Facts::of(&cache.list, &selected);
|
||||
let o = &app.ui.links.options;
|
||||
let e = |id: &str, params: Value, a: Act| entry(app, &f, id, params, a);
|
||||
let e = |id: &str, params: Value, a: Act, label: &str| entry(app, &f, id, params, a, label);
|
||||
[
|
||||
vec![
|
||||
e("ui.relinkDialog", json!({ "ids": f.all() }), Act::Relink),
|
||||
e("ui.links.relinkToFolder", Value::Null, Act::RelinkToFolder),
|
||||
e("ui.findLinksInFolder", json!({ "ids": f.linked() }), Act::FindInFolder),
|
||||
e("ui.links.goTo", Value::Null, Act::GoTo),
|
||||
e("ui.links.update", Value::Null, Act::Update),
|
||||
e("links.editOriginal", f.file_row(), Act::Edit),
|
||||
e("ui.relinkDialog", json!({ "ids": f.all() }), Act::Relink, "Relink…"),
|
||||
e("ui.links.relinkToFolder", Value::Null, Act::RelinkToFolder, "Relink to Folder…"),
|
||||
e("ui.findLinksInFolder", json!({ "ids": f.linked() }), Act::FindInFolder, "Find in Folder…"),
|
||||
e("ui.links.goTo", Value::Null, Act::GoTo, "Go To Link"),
|
||||
e("ui.links.update", Value::Null, Act::Update, "Update Link"),
|
||||
e("links.editOriginal", f.file_row(), Act::Edit, "Edit Original"),
|
||||
],
|
||||
vec![
|
||||
e("ui.links.embed", Value::Null, Act::Embed),
|
||||
e("ui.links.unembed", Value::Null, Act::Unembed),
|
||||
e("ui.placementOptionsDialog", json!({ "ids": f.all() }), Act::Placement),
|
||||
e("links.reveal", f.file_row(), Act::Reveal),
|
||||
e("ui.links.embed", Value::Null, Act::Embed, "Embed Image(s)"),
|
||||
e("ui.links.unembed", Value::Null, Act::Unembed, "Unembed…"),
|
||||
e("ui.placementOptionsDialog", json!({ "ids": f.all() }), Act::Placement, "Placement Options…"),
|
||||
e("links.reveal", f.file_row(), Act::Reveal, "Show in Folder"),
|
||||
],
|
||||
SHOW.iter().map(|(k, _)| option_entry("ui.links.show", json!({ "show": k }), o.show == *k)).collect(),
|
||||
SORT.iter().map(|(k, _)| option_entry("ui.links.sort", json!({ "sort": k }), o.sort == Some(*k))).collect(),
|
||||
vec![e("links.copyInfo", json!({ "ids": f.all() }), Act::CopyInfo)],
|
||||
SHOW.iter().map(|(k, label)| option_entry("ui.links.show", json!({ "show": k }), o.show == *k, label)).collect(),
|
||||
SORT.iter().map(|(k, label)| option_entry("ui.links.sort", json!({ "sort": k }), o.sort == Some(*k), label)).collect(),
|
||||
vec![e("links.copyInfo", json!({ "ids": f.all() }), Act::CopyInfo, "Copy Info")],
|
||||
THUMBS
|
||||
.iter()
|
||||
.map(|(k, size, _)| option_entry("ui.links.thumbnails", json!({ "size": k }), o.thumb == *size))
|
||||
.chain([option_entry("ui.links.linkInfo", Value::Null, o.info), option_entry("ui.links.dcs", Value::Null, o.dcs)])
|
||||
.map(|(k, size, label)| option_entry("ui.links.thumbnails", json!({ "size": k }), o.thumb == *size, label))
|
||||
.chain([
|
||||
option_entry("ui.links.linkInfo", Value::Null, o.info, "Show Link Info"),
|
||||
option_entry("ui.links.dcs", Value::Null, o.dcs, "Show DCS Transparency Interactions"),
|
||||
])
|
||||
.collect(),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ pub(crate) fn menu_rows(app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let style = text_style(app);
|
||||
let has = style.is_some();
|
||||
states.set(CommandRef::new(RESET), CommandState::new().enabled(has));
|
||||
states.set(CommandRef::new(RESET), CommandState::new().enabled(has).title(tl!("Reset OpenType Features")));
|
||||
let sets = style.map(|(st, _)| set_entries(app, &st)).unwrap_or_default();
|
||||
for (set, flag, on) in &sets {
|
||||
if let Some(tag) = flag.tag() {
|
||||
@@ -872,7 +872,7 @@ mod tests {
|
||||
assert_eq!(text_style(&app).unwrap().0.features, ["smcp"]);
|
||||
app.session.execute("select.set", &json!({"ids": []})).unwrap();
|
||||
assert!(!menu_rows(&app).iter().any(|row| matches!(row, PanelRow::Submenu(..))), "the submenu is left out with no text selected");
|
||||
assert_eq!(state_of(&app, &CommandRef::new(RESET)), Some(CommandState::new().enabled(false)));
|
||||
assert_eq!(state_of(&app, &CommandRef::new(RESET)), Some(CommandState::new().enabled(false).title("Reset OpenType Features")));
|
||||
assert_eq!(run(&mut app, "ui.openType.nothing", &json!({})), None);
|
||||
}
|
||||
|
||||
|
||||
@@ -923,7 +923,7 @@ fn composers() -> [(&'static str, Composer); 4] {
|
||||
]
|
||||
}
|
||||
|
||||
/// The Paragraph panel menu's rows; the labels and chords come from the commands' catalogue entries.
|
||||
/// The Paragraph panel menu's rows; [`menu_states`] names them, and the chords come from the commands' catalogue entries.
|
||||
pub(crate) fn menu_rows(app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
let cmd = |r: CommandRef| PanelRow::Command(r);
|
||||
let mut rows = vec![
|
||||
@@ -965,34 +965,38 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
let has = style.is_some();
|
||||
let title = if app.ui.paragraph_hide_options { tl!("Show Options") } else { tl!("Hide Options") };
|
||||
states.set(show_ref(), CommandState::new().title(title));
|
||||
let mut put = |r: CommandRef, enabled: bool, checked: Option<bool>| states.set(r, state(enabled, checked));
|
||||
// Each row is named here: the rows take params the catalog's rows do not list. `title` is shown as given.
|
||||
let mut put = |r: CommandRef, enabled: bool, checked: Option<bool>, title: &str| states.set(r, state(enabled, checked).title(title));
|
||||
// Quotation marks, hyphens, full stops and commas at a line's ends hang outside the margin.
|
||||
put(toggle_ref("romanHangingPunctuation"), has, Some(style.as_ref().is_some_and(|(_, p)| p.roman_hanging)));
|
||||
put(CommandRef::new("ui.justification"), has, None);
|
||||
put(CommandRef::new("ui.hyphenation"), has, None);
|
||||
let hanging = Some(style.as_ref().is_some_and(|(_, p)| p.roman_hanging));
|
||||
put(toggle_ref("romanHangingPunctuation"), has, hanging, tl!("Roman Hanging Punctuation"));
|
||||
put(CommandRef::new("ui.justification"), has, None, tl!("Justification…"));
|
||||
put(CommandRef::new("ui.hyphenation"), has, None, tl!("Hyphenation…"));
|
||||
if app.session.prefs.show_east_asian_options {
|
||||
let top_to_top = style.as_ref().is_some_and(|(_, p)| p.leading_model == LeadingModel::EmBoxTop);
|
||||
put(set_ref("leadingModel", "emBoxTop"), has, Some(top_to_top));
|
||||
put(set_ref("leadingModel", "romanBaseline"), has, Some(has && !top_to_top));
|
||||
put(set_ref("leadingModel", "emBoxTop"), has, Some(top_to_top), tl!("Top-to-Top Leading"));
|
||||
put(set_ref("leadingModel", "romanBaseline"), has, Some(has && !top_to_top), tl!("Bottom-to-Bottom Leading"));
|
||||
let hang = style.as_ref().map(|(_, p)| p.burasagari);
|
||||
for (_, b, key) in burasagari_rows() {
|
||||
put(set_ref("burasagari", key), has, Some(hang == Some(b)));
|
||||
for (label, b, key) in burasagari_rows() {
|
||||
put(set_ref("burasagari", key), has, Some(hang == Some(b)), label);
|
||||
}
|
||||
put(toggle_ref("kurikaeshiMojiShori"), has, Some(shared_para(app, |p| p.kurikaeshi_moji_shori) == Some(true)));
|
||||
let repeat = Some(shared_para(app, |p| p.kurikaeshi_moji_shori) == Some(true));
|
||||
put(toggle_ref("kurikaeshiMojiShori"), has, repeat, tl!("Kurikaeshi Moji Shori"));
|
||||
let kinsoku_type = shared_para(app, |p| p.kinsoku_type);
|
||||
for (_, t, key) in kinsoku_types() {
|
||||
put(set_ref("kinsokuType", key), has, Some(kinsoku_type == Some(t)));
|
||||
for (label, t, key) in kinsoku_types() {
|
||||
put(set_ref("kinsokuType", key), has, Some(kinsoku_type == Some(t)), label);
|
||||
}
|
||||
// Inseparable pairs stay on one line; only with a kinsoku set.
|
||||
let (kinsoku_on, bunri) = bunri_kinshi_item(app);
|
||||
put(toggle_ref("bunriKinshi"), has && kinsoku_on, Some(bunri));
|
||||
put(toggle_ref("koreanLineBreakAnywhere"), has, Some(shared_para(app, |p| p.korean_line_break_anywhere) == Some(true)));
|
||||
put(toggle_ref("bunriKinshi"), has && kinsoku_on, Some(bunri), tl!("Bunri-Kinshi"));
|
||||
let anywhere = Some(shared_para(app, |p| p.korean_line_break_anywhere) == Some(true));
|
||||
put(toggle_ref("koreanLineBreakAnywhere"), has, anywhere, tl!("Korean Line Break Anywhere"));
|
||||
}
|
||||
let composer = shared_composer(app);
|
||||
for (_, c) in composers() {
|
||||
put(set_ref("composer", composer_id(c)), has, Some(composer == Some(c)));
|
||||
for (label, c) in composers() {
|
||||
put(set_ref("composer", composer_id(c)), has, Some(composer == Some(c)), label);
|
||||
}
|
||||
put(reset_ref(), has, None);
|
||||
put(reset_ref(), has, None, tl!("Reset Panel"));
|
||||
}
|
||||
|
||||
/// Runs a `ui.paragraph.*` command; `None` for any other id.
|
||||
|
||||
@@ -10,9 +10,11 @@ fn selected(app: &VectorcraftApp) -> Vec<Justify> {
|
||||
row.map(|r| r.0).into_iter().collect()
|
||||
}
|
||||
|
||||
/// Whether `states` holds `r` with exactly the state `state(enabled, checked)` makes.
|
||||
/// Whether `states` holds `r` with the enabled and checked flags `state(enabled, checked)` makes. The row's name is
|
||||
/// checked in `tests_menu_names`.
|
||||
fn has_state(states: &CommandStates, r: &CommandRef, enabled: bool, checked: Option<bool>) -> bool {
|
||||
format!("{:?}", states.get(r)) == format!("{:?}", Some(&state(enabled, checked)))
|
||||
let want = state(enabled, checked);
|
||||
states.get(r).is_some_and(|s| s.is_enabled() == want.is_enabled() && s.is_checked() == want.is_checked())
|
||||
}
|
||||
|
||||
fn editing_text(text: &str) -> (VectorcraftApp, Value) {
|
||||
|
||||
@@ -190,7 +190,7 @@ pub(crate) fn menu_rows(_app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
|
||||
/// The states of the panel's own menu commands; the others read the commands' own rules.
|
||||
pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
states.set(CommandRef::new("ui.pathfinder.trap"), CommandState::new().enabled(operands(app) >= 2));
|
||||
states.set(CommandRef::new("ui.pathfinder.trap"), CommandState::new().enabled(operands(app) >= 2).title(tl!("Trap…")));
|
||||
}
|
||||
|
||||
/// Runs the panel's own menu commands; `None` for any other id.
|
||||
|
||||
@@ -446,7 +446,7 @@ pub(crate) fn menu_rows(_app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
|
||||
/// Show All Plates is available while the separations preview is on.
|
||||
pub(crate) fn menu_states(_app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
states.set(SHOW_ALL_PLATES, CommandState::new().enabled(proof::view().separations.is_some()));
|
||||
states.set(SHOW_ALL_PLATES, CommandState::new().enabled(proof::view().separations.is_some()).title(tl!("Show All Plates")));
|
||||
}
|
||||
|
||||
/// Runs the panel's own menu command `id`; `None` for any other id. Show All Plates turns the
|
||||
|
||||
@@ -197,6 +197,27 @@ pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
for (v, _) in View::ALL {
|
||||
states.set(view_ref(v), CommandState::new().checked(v == app.ui.swatches_view));
|
||||
}
|
||||
let names = [
|
||||
("newSwatch", "New Swatch…"),
|
||||
("newColorGroup", "New Color Group…"),
|
||||
("duplicate", "Duplicate Swatch"),
|
||||
("merge", "Merge Swatches"),
|
||||
("delete", "Delete Swatch"),
|
||||
("editGroup", "Edit or Apply Color Group…"),
|
||||
("ungroup", "Ungroup Color Group"),
|
||||
("groupOptions", "Color Group Options…"),
|
||||
("selectUnused", "Select All Unused"),
|
||||
("addUsedColors", "Add Used Colors"),
|
||||
("addSelectedColors", "Add Selected Colors"),
|
||||
("sortByName", "Sort by Name"),
|
||||
("sortByKind", "Sort by Kind"),
|
||||
("showFind", "Show Find Field"),
|
||||
("showRecent", "Show Recent Colors"),
|
||||
("options", "Swatch Options…"),
|
||||
("spotColors", "Spot Colors…"),
|
||||
];
|
||||
let views = View::ALL.into_iter().map(|(v, label)| (view_ref(v), label));
|
||||
crate::panels::name_rows(states, names.into_iter().map(|(row, label)| (CommandRef::new(id(row)), label)).chain(views));
|
||||
}
|
||||
|
||||
/// Runs panel menu row `id` (`ui.swatches.<row>`); `None` for another panel's id.
|
||||
|
||||
@@ -774,39 +774,43 @@ fn menu_lines(app: &VectorcraftApp) -> Vec<MenuLine> {
|
||||
let picked = !marked(app).is_empty();
|
||||
let inst = instance_flags(app);
|
||||
let name = json!({ "name": sel });
|
||||
let row = |id: &str, params: Value, enabled: bool| MenuLine::Command(CommandRef::with_params(id, params), CommandState::new().enabled(enabled));
|
||||
// Each row is named here: several share a command (New Symbol… and Symbol Options…), and most take params that
|
||||
// the catalog's rows do not list.
|
||||
let row = |id: &str, params: Value, enabled: bool, label: &str| {
|
||||
MenuLine::Command(CommandRef::with_params(id, params), CommandState::new().enabled(enabled).title(tl!(label)))
|
||||
};
|
||||
let view = app.ui.symbols_view;
|
||||
let views = View::ALL.iter().map(|&(v, _)| {
|
||||
let views = View::ALL.iter().map(|&(v, label)| {
|
||||
let params = json!({ "panel": "symbols", "view": v });
|
||||
MenuLine::Command(CommandRef::with_params("ui.panelView", params), CommandState::new().checked(view == v))
|
||||
MenuLine::Command(CommandRef::with_params("ui.panelView", params), CommandState::new().checked(view == v).title(tl!(label)))
|
||||
});
|
||||
let mut lines = vec![
|
||||
// Shift on New Symbol… and Redefine Symbol keeps the selected art as ordinary art
|
||||
// ([`fired_params`]).
|
||||
row("ui.symbolOptions", json!({}), has_sel),
|
||||
row("symbol.update", name.clone(), has_sel && sel.is_some()),
|
||||
row("symbol.duplicate", name.clone(), sel.is_some()),
|
||||
row("ui.symbolOptions", json!({}), has_sel, "New Symbol…"),
|
||||
row("symbol.update", name.clone(), has_sel && sel.is_some(), "Redefine Symbol"),
|
||||
row("symbol.duplicate", name.clone(), sel.is_some(), "Duplicate Symbol"),
|
||||
// Asks first, as the panel's button does; the menu row has no Alt shortcut.
|
||||
row(ROW_DELETE, Value::Null, sel.is_some() || picked),
|
||||
row("ui.symbolOptions", json!({ "edit": true, "name": sel }), sel.is_some()),
|
||||
row(ROW_DELETE, Value::Null, sel.is_some() || picked, "Delete Symbol"),
|
||||
row("ui.symbolOptions", json!({ "edit": true, "name": sel }), sel.is_some(), "Symbol Options…"),
|
||||
// The selected instance's symbol, else the symbol selected in the panel.
|
||||
row("symbol.edit", if inst.any { json!({}) } else { name.clone() }, inst.any || sel.is_some()),
|
||||
row("symbol.place", name.clone(), sel.is_some()),
|
||||
row("symbol.replace", name.clone(), inst.any && sel.is_some()),
|
||||
row("symbol.breakLink", json!({}), inst.any),
|
||||
row("symbol.instance.reset", json!({}), inst.changed),
|
||||
row("symbol.instance.resetTransform", json!({}), inst.transformed),
|
||||
row("symbol.selectInstances", name, sel.is_some()),
|
||||
row("symbol.edit", if inst.any { json!({}) } else { name.clone() }, inst.any || sel.is_some(), "Edit Symbol"),
|
||||
row("symbol.place", name.clone(), sel.is_some(), "Place Symbol Instance"),
|
||||
row("symbol.replace", name.clone(), inst.any && sel.is_some(), "Replace Symbol"),
|
||||
row("symbol.breakLink", json!({}), inst.any, "Break Link to Symbol"),
|
||||
row("symbol.instance.reset", json!({}), inst.changed, "Reset Symbol Instance"),
|
||||
row("symbol.instance.resetTransform", json!({}), inst.transformed, "Reset Transformation"),
|
||||
row("symbol.selectInstances", name, sel.is_some(), "Select All Instances"),
|
||||
MenuLine::Separator,
|
||||
// Select All Unused (#4918): the symbols nothing places show selected, and Delete Symbol
|
||||
// deletes them all.
|
||||
row(ROW_SELECT_UNUSED, Value::Null, symbols > 0),
|
||||
row(ROW_SELECT_UNUSED, Value::Null, symbols > 0, "Select All Unused"),
|
||||
// The document's symbols in name order, as one undo step.
|
||||
row("symbol.sortByName", json!({}), symbols > 1),
|
||||
row("symbol.sortByName", json!({}), symbols > 1, "Sort by Name"),
|
||||
MenuLine::Separator,
|
||||
];
|
||||
lines.extend(views);
|
||||
lines.extend([MenuLine::Separator, MenuLine::Libraries, row(ROW_SAVE_LIBRARY, Value::Null, symbols > 0)]);
|
||||
lines.extend([MenuLine::Separator, MenuLine::Libraries, row(ROW_SAVE_LIBRARY, Value::Null, symbols > 0, "Save Symbol Library…")]);
|
||||
lines
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ fn checked_view(app: &VectorcraftApp) -> Vec<&'static str> {
|
||||
menu_states(app, &mut states);
|
||||
let checked = |view: &str| {
|
||||
let row = CommandRef::with_params("ui.panelView", json!({"panel": "symbols", "view": view}));
|
||||
states.get(&row) == Some(&CommandState::new().checked(true))
|
||||
states.get(&row).is_some_and(|s| s.is_enabled() && s.is_checked() == Some(true))
|
||||
};
|
||||
["thumbnail", "smallList", "largeList"].into_iter().filter(|&view| checked(view)).collect()
|
||||
}
|
||||
|
||||
@@ -840,8 +840,8 @@ pub(crate) fn menu_rows(_app: &VectorcraftApp) -> Vec<PanelRow> {
|
||||
|
||||
/// Enable or disable the panel menu's commands as [`can`] says.
|
||||
pub(crate) fn menu_states(app: &VectorcraftApp, states: &mut CommandStates) {
|
||||
for id in COMMANDS {
|
||||
states.set(CommandRef::new(id), CommandState::new().enabled(can(app, id)));
|
||||
for (id, label) in COMMANDS.into_iter().zip([tl!("Clear All Tabs"), tl!("Delete Tab"), tl!("Repeat Tab")]) {
|
||||
states.set(CommandRef::new(id), CommandState::new().enabled(can(app, id)).title(label));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//! Panel menus: every command row shows a name of its own, never its command id.
|
||||
|
||||
use craft::ui::runtime::commands;
|
||||
|
||||
use super::tests_appearance::app_with_rect;
|
||||
use super::*;
|
||||
|
||||
/// The command rows of `rows`, each with the level it is on (0 for the menu, then one number per submenu), submenus'
|
||||
/// rows included. A row with a Shift alternate brings the alternate's command too.
|
||||
fn command_rows(rows: &[PanelRow], level: usize, next: &mut usize, out: &mut Vec<(usize, CommandRef)>) {
|
||||
for row in rows {
|
||||
match row {
|
||||
PanelRow::Command(command) => out.push((level, command.clone())),
|
||||
PanelRow::Alternated(command, alternate) => {
|
||||
out.push((level, command.clone()));
|
||||
*next += 1;
|
||||
out.push((*next, alternate.command.clone()));
|
||||
}
|
||||
PanelRow::Submenu(_, rows) => {
|
||||
*next += 1;
|
||||
command_rows(rows, *next, next, out);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// What is wrong with the rows of every panel menu in a frame of the whole app: a row whose label is empty or is its
|
||||
/// command id, and two rows of one menu that show the same label.
|
||||
fn unnamed_rows(app: &mut VectorcraftApp) -> Vec<String> {
|
||||
let ctx = app.ui_ctx.clone().expect("the app has a window");
|
||||
let screen_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0)));
|
||||
for k in 0..2 {
|
||||
crate::testing::app_frame(app, &ctx, egui::RawInput { time: Some(f64::from(k)), screen_rect, ..Default::default() });
|
||||
}
|
||||
let mut wrong = Vec::new();
|
||||
for menu in PANEL_MENUS {
|
||||
let mut rows = Vec::new();
|
||||
command_rows(&(menu.rows)(app), 0, &mut 0, &mut rows);
|
||||
let mut seen: Vec<(usize, String, String)> = Vec::new();
|
||||
for (level, command) in rows {
|
||||
let label = commands::resolve(&ctx, command.clone()).label.to_string();
|
||||
if label.trim().is_empty() || label == command.id {
|
||||
wrong.push(format!("{}: {} shows its id", menu.id, command.key()));
|
||||
} else if let Some((_, other, _)) = seen.iter().find(|(at, key, shown)| *at == level && *shown == label && *key != command.key()) {
|
||||
wrong.push(format!("{}: {} and {other} both show {label:?}", menu.id, command.key()));
|
||||
}
|
||||
seen.push((level, command.key(), label));
|
||||
}
|
||||
}
|
||||
wrong
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn panel_menu_rows_show_names_not_command_ids() {
|
||||
let mut app = app_with_rect();
|
||||
let wrong = unnamed_rows(&mut app);
|
||||
assert!(wrong.is_empty(), "{} rows:\n{}", wrong.len(), wrong.join("\n"));
|
||||
}
|
||||
|
||||
/// The rows the East Asian and Indic options add to the Paragraph, OpenType and Glyphs menus are named too.
|
||||
#[test]
|
||||
fn panel_menu_rows_with_the_east_asian_options_show_names() {
|
||||
let mut app = app_with_rect();
|
||||
app.session.prefs.show_east_asian_options = true;
|
||||
app.session.prefs.show_indic_options = true;
|
||||
let wrong = unnamed_rows(&mut app);
|
||||
assert!(wrong.is_empty(), "{} rows:\n{}", wrong.len(), wrong.join("\n"));
|
||||
}
|
||||
Reference in new issue
Block a user