Compare commits

...
2 changed files with 15 additions and 3 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ use std::borrow::Cow;
use craft::behavior::{Mixed, SelectionChange, keyed};
use craft::color_ui::ui::ColorPickerTab;
use craft::pages::ui::table::{BorderEdges, EdgeKey, EdgeLook, EdgePicker, SampleArea};
use craft::pages::ui::table::{BorderEdges, EdgeKey, EdgeLook, EdgePicker, EdgeSize, SampleArea};
use craft::text::ui::DocUnit;
use craft::text::ui::ruler::{TabAlign as UiAlign, TabLeader as UiLeader, TabStop as UiStop};
use craft::text::ui::tabs_dialog::{MAX_STOPS, TabStopsDialog, TabStopsResult};
@@ -518,7 +518,7 @@ fn lines(ui: &mut Ui, key: &'static str, l: &mut LineForm, area: SampleArea, fil
Stack::new().show(ui, |ui, _| {
let mut edges = l.edges(between);
let sample = EdgeLook::sample(area, fill.map(srgba));
let picker = EdgePicker::new(word(tl!("Preview")), Bind::bound(&mut edges)).look(sample);
let picker = EdgePicker::new(word(tl!("Preview")), Bind::bound(&mut edges)).look(sample).preview(EdgeSize::Sample);
let picker = if between { picker.paragraph() } else { picker };
picker.show(ui);
l.take_edges(edges, between);
@@ -572,7 +572,7 @@ impl WordForm for BordersForm {
let mut none = BorderEdges::default();
let area = if self.fill_to_text { SampleArea::Text } else { SampleArea::Paragraph };
let sample = EdgeLook::sample(area, Rgb::parse(&self.fill).map(srgba));
EdgePicker::new(word(tl!("Preview")), Bind::bound(&mut none)).look(sample).enabled(false).show(ui);
EdgePicker::new(word(tl!("Preview")), Bind::bound(&mut none)).look(sample).preview(EdgeSize::Sample).enabled(false).show(ui);
Self::apply_to(ui, &mut self.fill_to_text, word(tl!("Paragraph")), word(tl!("Text")));
}
}
+12
View File
@@ -2340,6 +2340,18 @@ fn dialog_previews_are_drawn_larger_than_a_control() {
);
}
}
/// #7977: Borders and Shading draws its edge preview at sample size, not as a thumbnail.
#[test]
fn borders_preview_is_larger_than_a_thumbnail() {
use egui::accesskit::Role;
let mut h = app_harness(app_with("Lanterns"));
h.state_mut().run("ui.dialog", json!({"name": "borders"})).unwrap();
h.run_steps(6);
let preview = h.get_by_role_and_label(Role::Group, "Preview").rect();
let button = h.get_by_role_and_label(Role::Button, "Cancel").rect();
assert!(preview.height() > 2.0 * button.height(), "the preview is {}pt high beside a {}pt button", preview.height(), button.height());
}
/// #7982: Custom Properties' hint wraps inside the dialog instead of running under the Cancel button.
#[test]
fn custom_properties_hint_does_not_run_under_the_buttons() {