Retire the obsolete source close event and use current drawer controls in tests
This commit is contained in:
@@ -269,9 +269,6 @@ impl App {
|
||||
.map(|request| request.job);
|
||||
return task;
|
||||
}
|
||||
nav::SymbolEvent::Close => {
|
||||
return self.show_text_drawer(None);
|
||||
}
|
||||
nav::SymbolEvent::Back => {
|
||||
self.source_symbol_back();
|
||||
// A successful Back needs no empty results panel. Retain an
|
||||
|
||||
@@ -85,6 +85,11 @@ fn symbol(app: &mut App, event: nav::SymbolEvent) {
|
||||
send(app, message);
|
||||
}
|
||||
|
||||
fn close_drawer(app: &mut App) {
|
||||
let message = Message::TextWorkspace(TextEvent::HideDrawer(app.text_drawer_context()));
|
||||
send(app, message);
|
||||
}
|
||||
|
||||
fn choice(app: &App, stamp: query::QueryStamp, reference: bool, index: usize) -> Message {
|
||||
app.source_symbol_message(nav::SymbolEvent::Choose {
|
||||
stamp,
|
||||
@@ -414,7 +419,7 @@ fn close_during_busy_retains_hidden_completion_without_reopening_or_navigation()
|
||||
let raw = app.source_workspace.bundle();
|
||||
let cursor = app.source_editor.cursor();
|
||||
assert!(references_visible(&app));
|
||||
symbol(&mut app, nav::SymbolEvent::Close);
|
||||
close_drawer(&mut app);
|
||||
assert!(app.text_workspace.drawer().is_none());
|
||||
assert_eq!(app.source_symbols.in_flight, Some(request.job));
|
||||
assert!(app.source_symbols.request.is_none());
|
||||
@@ -561,7 +566,7 @@ fn closed_results_stay_closed_on_exact_back_and_reopen_only_for_a_return_notice(
|
||||
let origin = app.source_editor.cursor();
|
||||
finish(&mut app, query::Action::Definition);
|
||||
reveal(&mut app);
|
||||
symbol(&mut app, nav::SymbolEvent::Close);
|
||||
close_drawer(&mut app);
|
||||
assert!(app.text_workspace.drawer().is_none() && app.source_symbols.results.is_some());
|
||||
if changed {
|
||||
// Use the workspace edit API to give the origin a new generation.
|
||||
@@ -1433,7 +1438,7 @@ fn stale_envelope_trial(reset: bool) {
|
||||
let old_messages = [
|
||||
app.source_symbol_message(nav::SymbolEvent::Query(query::Action::Definition)),
|
||||
app.source_symbol_message(nav::SymbolEvent::Back),
|
||||
app.source_symbol_message(nav::SymbolEvent::Close),
|
||||
Message::TextWorkspace(TextEvent::HideDrawer(app.text_drawer_context())),
|
||||
choice(&app, old_results.stamp, false, 0),
|
||||
];
|
||||
if reset {
|
||||
@@ -1494,7 +1499,7 @@ fn stale_envelope_trial(reset: bool) {
|
||||
// Replay once more with no busy-slot fallback and visible current results.
|
||||
assert_stale_envelopes_preserve_current(&mut app, &old_messages);
|
||||
let interaction = app.source_symbols.interaction;
|
||||
symbol(&mut app, nav::SymbolEvent::Close);
|
||||
close_drawer(&mut app);
|
||||
assert_ne!(app.source_symbols.interaction, interaction);
|
||||
assert!(app.text_workspace.drawer().is_none() && app.source_symbols.results.is_some());
|
||||
let next = begin(&mut app, query::Action::References);
|
||||
|
||||
@@ -10,7 +10,6 @@ pub enum SymbolEvent {
|
||||
DiagramUsages,
|
||||
Query(query::Action),
|
||||
Back,
|
||||
Close,
|
||||
Choose {
|
||||
stamp: query::QueryStamp,
|
||||
visit: Id,
|
||||
|
||||
@@ -1531,6 +1531,16 @@ fn checks(app: &App) -> View<'_, Message> {
|
||||
scrollable(out.padding(24)).into()
|
||||
}
|
||||
|
||||
#[cfg(all(test, debug_assertions))]
|
||||
pub(crate) fn captured_text_drawer_resize(app: &App) -> Message {
|
||||
text_workspace::capture_drawer_resize(app)
|
||||
}
|
||||
|
||||
#[cfg(all(test, debug_assertions))]
|
||||
pub(crate) fn captured_source_reference_stale_summary(app: &App) -> bool {
|
||||
text_workspace::summary_visibility_tests::rendered_stale(app)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::short;
|
||||
@@ -1584,13 +1594,3 @@ mod tests {
|
||||
assert_eq!(short("e\u{0301}B", 1), "…");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, debug_assertions))]
|
||||
pub(crate) fn captured_text_drawer_resize(app: &App) -> Message {
|
||||
text_workspace::capture_drawer_resize(app)
|
||||
}
|
||||
|
||||
#[cfg(all(test, debug_assertions))]
|
||||
pub(crate) fn captured_source_reference_stale_summary(app: &App) -> bool {
|
||||
text_workspace::summary_visibility_tests::rendered_stale(app)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user