Misc · Export and import: reasons wrap; every way out tested
feedback::InlineMessage lays its words in a block that wraps, so the importer's reason for unread text no longer runs past the dialog. The reader skips a leading byte order mark, names the line an unclosed quote opened on, and logs once per reading. Tests press each Cancel, the scrim, Export with the first format, see focus return to the opener, read new text under an open importer, and see a field with no column come empty.
This commit is contained in:
1 parent
79fe78cefd
commit
385faa0581
4 files changed
+208
-29
No files matched your search
@@ -175,3 +175,28 @@ fn a_wrapped_body_pushes_the_actions_down(cx: &mut TestAppContext) {
|
||||
);
|
||||
assert!(long > short + px(24.0), "{short:?} then {long:?}");
|
||||
}
|
||||
|
||||
/// A message too long for its box.
|
||||
struct Worded;
|
||||
|
||||
impl Render for Worded {
|
||||
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||
div()
|
||||
.w(px(200.0))
|
||||
.child(crate::feedback::InlineMessage::new(
|
||||
crate::primitives::Severity::Danger,
|
||||
"This file does not read as CSV: line 2: a quote inside a field it did not open.",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_long_inline_message_wraps_inside_its_box(cx: &mut TestAppContext) {
|
||||
setup(cx);
|
||||
let (_, cx) = cx.add_window_view(|_, _| Worded);
|
||||
cx.run_until_parked();
|
||||
let text = cx
|
||||
.debug_bounds("inline-message-text")
|
||||
.expect("the words draw");
|
||||
assert!(text.right() <= px(200.0), "{text:?}");
|
||||
}
|
||||
Reference in new issue
Block a user