mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-27 06:58:35 +00:00
This commit is contained in:
@@ -8,7 +8,7 @@ use craft::ui::dialog::{DialogId, DialogResult, DialogStack, HeldAnswer, HeldOk,
|
||||
use craft::ui::display::{Kbd, Text};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Stack;
|
||||
use craft::ui::list::{ListRow, ThumbAspect};
|
||||
use craft::ui::list::{ListRow, ThumbAspect, ThumbSize};
|
||||
use craft::ui::patterns::form_dialogs::{FormCx, FormDialog};
|
||||
use craft::ui::primitives::ContentPainterCx;
|
||||
use craft::ui::runtime::env::Label;
|
||||
@@ -639,6 +639,7 @@ fn recent_row(ui: &mut Ui, form: &mut SymbolForm, dark: bool) {
|
||||
let events = {
|
||||
let recent = &form.recent;
|
||||
TileGrid::new(word("Recently used symbols:"))
|
||||
.thumb_size(ThumbSize::Medium)
|
||||
.select(SelectMode::Single)
|
||||
.caption(CaptionPlace::None)
|
||||
.card_columns(RECENT_SYMBOLS)
|
||||
@@ -681,8 +682,12 @@ fn glyph_grid(ui: &mut Ui, form: &mut SymbolForm, dark: bool) -> bool {
|
||||
let font = form.shown_font().to_string();
|
||||
let events = {
|
||||
let chars = &form.chars;
|
||||
let mut grid =
|
||||
TileGrid::new(word("Symbols")).select(SelectMode::Single).max_rows(8).caption(CaptionPlace::None).selection(Bind::bound(&mut selection));
|
||||
let mut grid = TileGrid::new(word("Symbols"))
|
||||
.thumb_size(ThumbSize::Medium)
|
||||
.select(SelectMode::Single)
|
||||
.max_rows(8)
|
||||
.caption(CaptionPlace::None)
|
||||
.selection(Bind::bound(&mut selection));
|
||||
if let Some(at) = reveal {
|
||||
grid = grid.reveal(at);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
@@ -118,6 +119,25 @@ fn symbol_dialog_inserts_with_its_font() {
|
||||
assert_eq!(f.params().unwrap(), json!({"char": "\u{2665}"}));
|
||||
}
|
||||
|
||||
/// #7326: Recently used symbols and Symbols map use compact tile sizing so the dialog
|
||||
/// fits comfortably within default window bounds without vertical overflow.
|
||||
#[test]
|
||||
fn symbol_dialog_uses_compact_tile_grids() {
|
||||
let mut a = app();
|
||||
remember_symbol(&mut a, "©", "DejaVu Sans");
|
||||
let mut h = testing::harness(a);
|
||||
let id = crate::dialogs::open(h.state_mut(), "symbol", &json!({})).expect("symbol dialog opens");
|
||||
h.run_steps(3);
|
||||
assert!(h.state().dialog_host.get_dyn(id).is_some(), "the symbol dialog is open");
|
||||
let dialog = h.get_by_role_and_label(egui::accesskit::Role::Dialog, "Symbol").rect();
|
||||
assert!(dialog.height() <= 900.0, "complete dialog should fit within default desktop viewport: {}", dialog.height());
|
||||
assert!(dialog.max.y <= 900.0, "complete dialog should not overflow viewport bottom: {}", dialog.max.y);
|
||||
let symbols = h.get_by_role_and_label(egui::accesskit::Role::ListBox, "Symbols").rect();
|
||||
assert!(symbols.height() < 500.0, "symbols grid should be compact: {}", symbols.height());
|
||||
let recent = h.get_by_role_and_label(egui::accesskit::Role::ListBox, "Recently used symbols:").rect();
|
||||
assert!(recent.height() < 80.0, "recently used symbols row should be compact: {}", recent.height());
|
||||
}
|
||||
|
||||
/// The Field dialog builds the field code from its options.
|
||||
#[test]
|
||||
fn field_dialog_builds_the_instruction() {
|
||||
|
||||
Reference in New Issue
Block a user