mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-28 08:45:52 -06:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
920cdb1edf |
@@ -25,6 +25,7 @@ use craft::ui::list::{List, ListRow, ToggleCell, ToggleState};
|
||||
use craft::ui::notices::Notice;
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::sections::{DialogRole, FooterButton};
|
||||
use craft::ui::style::SurfaceKind;
|
||||
use craft::ui::tabs::{Tab, TabKind, TabStrip};
|
||||
use craft::ui::text::TextField;
|
||||
use egui::{Context, Ui};
|
||||
@@ -260,6 +261,7 @@ impl RibbonDialog {
|
||||
let rows = &self.tree;
|
||||
let out = List::new(word("Ribbon tabs"))
|
||||
.id(self.tree_id(ui))
|
||||
.surface(SurfaceKind::Frame)
|
||||
.tree(true)
|
||||
.select(SelectMode::Single)
|
||||
.columns(columns)
|
||||
@@ -403,6 +405,7 @@ fn pick(ui: &mut Ui, salt: &'static str, label: &str, rows: &[(String, String)],
|
||||
let mut selection = at.map_or_else(Selection::default, Selection::single);
|
||||
List::new(word(label))
|
||||
.id(ui.scope_id().with(salt))
|
||||
.surface(SurfaceKind::Frame)
|
||||
.select(SelectMode::Single)
|
||||
// The list scrolls its own rows, as main's fixed-height boxes did, so the dialog's body does not scroll it too.
|
||||
.max_rows(12)
|
||||
|
||||
@@ -2283,3 +2283,37 @@ fn modal_dialog_with_open_popup_does_not_shake_on_inside_click_but_shakes_on_out
|
||||
let key2 = chrome::nudge_id(&h.ctx, id2);
|
||||
assert!(h.ctx.data(|d| d.get_temp::<f64>(key2)).is_none(), "reopened dialog starts still");
|
||||
}
|
||||
|
||||
/// Part of #7981 and #7980: the lists of Customize Ribbon and its Quick Access Toolbar page have a visible
|
||||
/// frame, as before the port; without it an empty list is a blank patch.
|
||||
#[test]
|
||||
fn the_ribbon_customizer_lists_are_framed() {
|
||||
use egui::accesskit::Role;
|
||||
fn rects<'a>(shape: &'a egui::Shape, out: &mut Vec<&'a egui::epaint::RectShape>) {
|
||||
match shape {
|
||||
egui::Shape::Vec(inner) => inner.iter().for_each(|s| rects(s, out)),
|
||||
egui::Shape::Rect(r) => out.push(r),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
fn assert_framed(h: &egui_kittest::Harness<'_, WordApp>, label: &str) {
|
||||
let list = h.get_by_role_and_label(Role::List, label).rect();
|
||||
let mut seen = Vec::new();
|
||||
h.output().shapes.iter().for_each(|c| rects(&c.shape, &mut seen));
|
||||
assert!(
|
||||
seen.iter().any(|r| r.stroke.width > 0.0
|
||||
&& r.stroke.color.a() > 0
|
||||
&& r.rect.contains_rect(list.shrink(2.0))
|
||||
&& list.expand(2.0).contains_rect(r.rect)),
|
||||
"the list {label:?} {list:?} has a border"
|
||||
);
|
||||
}
|
||||
let mut h = app_harness(app_with(""));
|
||||
open_named(&mut h, "customizeRibbon", json!({}));
|
||||
assert_framed(&h, "Categories:");
|
||||
assert_framed(&h, "Commands:");
|
||||
assert_framed(&h, "Ribbon tabs");
|
||||
h.get_by_role_and_label(Role::Tab, "Quick Access Toolbar").click();
|
||||
h.run_steps(3);
|
||||
assert_framed(&h, "Quick Access Toolbar");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user