mirror of
https://github.com/storytold/wordcraft.git
synced 2026-12-06 04:36:56 -06:00
Merge pull request #9568
This commit is contained in:
@@ -471,11 +471,26 @@ fn find_replace_and_go_to_keys_like_word() {
|
||||
assert_eq!(h.state().session.find.results.len(), 2);
|
||||
}
|
||||
|
||||
/// Inline-jobs Navigation pane harness: deterministic page picture renders without background-thread races.
|
||||
fn nav_pane_inline_harness() -> egui_kittest::Harness<'static, WordApp> {
|
||||
let jobs = Arc::new(craft::host::InlineJobs);
|
||||
crate::test_harness::builder_with({
|
||||
let jobs = jobs.clone();
|
||||
move || crate::test_harness::install_spec().jobs(jobs)
|
||||
})
|
||||
.with_size(egui::vec2(800.0, 500.0))
|
||||
.with_max_steps(8)
|
||||
.build_eframe(move |_| {
|
||||
let host = Host::builder(crate::APP).files(Arc::new(ScriptedFiles::new())).jobs(jobs.clone()).build();
|
||||
WordApp::new(Session::new(wordcraft_doc::Document::new()), Services::default()).with_host(Arc::new(host))
|
||||
})
|
||||
}
|
||||
|
||||
/// #8945: clicking a Navigation pane tab shows that view (the tab strip's selection event, not its overflow pick).
|
||||
#[test]
|
||||
fn nav_pane_tabs_switch_on_click() {
|
||||
// A page view that comes to rest draws once more at its exact size, so a switch settles in a few more frames.
|
||||
let mut h = crate::test_harness::builder().with_size(egui::vec2(800.0, 500.0)).with_max_steps(8).build_eframe(|_| app());
|
||||
let mut h = nav_pane_inline_harness();
|
||||
h.state_mut().session.view.nav_pane = true;
|
||||
for _ in 0..2 {
|
||||
h.step();
|
||||
@@ -492,17 +507,7 @@ fn nav_pane_tabs_switch_on_click() {
|
||||
fn nav_pane_switching_tabs_keeps_search_highlights() {
|
||||
// A page view that comes to rest draws once more at its exact size, and inline jobs keep page picture
|
||||
// renders deterministic instead of racing the harness's settle loop on a background thread.
|
||||
let jobs = Arc::new(craft::host::InlineJobs);
|
||||
let mut h = crate::test_harness::builder_with({
|
||||
let jobs = jobs.clone();
|
||||
move || crate::test_harness::install_spec().jobs(jobs)
|
||||
})
|
||||
.with_size(egui::vec2(800.0, 500.0))
|
||||
.with_max_steps(8)
|
||||
.build_eframe(move |_| {
|
||||
let host = Host::builder(crate::APP).files(Arc::new(ScriptedFiles::new())).jobs(jobs.clone()).build();
|
||||
WordApp::new(Session::new(wordcraft_doc::Document::new()), Services::default()).with_host(Arc::new(host))
|
||||
});
|
||||
let mut h = nav_pane_inline_harness();
|
||||
h.state_mut().run("document.setText", json!({"text": "Kilns fire clay. Kilns cool."})).unwrap();
|
||||
h.state_mut().session.view.nav_pane = true;
|
||||
for _ in 0..2 {
|
||||
|
||||
Reference in New Issue
Block a user