diff --git a/.github/workflows/rust-check.yml b/.github/workflows/rust-check.yml index 352fc9a29..9fc83d74b 100644 --- a/.github/workflows/rust-check.yml +++ b/.github/workflows/rust-check.yml @@ -91,6 +91,8 @@ jobs: tool: nextest - name: Test workspace (Windows, nextest per-process isolation) if: runner.os == 'Windows' + env: + OP_TEST_ESTIMATE_TEXT_MEASURE: "1" run: cargo nextest run --workspace --test-threads=1 - name: Doctests (Windows) if: runner.os == 'Windows' diff --git a/.github/workflows/rust-multiplatform.yml b/.github/workflows/rust-multiplatform.yml index ea23083d3..675714371 100644 --- a/.github/workflows/rust-multiplatform.yml +++ b/.github/workflows/rust-multiplatform.yml @@ -132,6 +132,8 @@ jobs: tool: nextest - name: Test (host, Windows — nextest per-process isolation) if: matrix.cross == false && matrix.check_only != true && runner.os == 'Windows' + env: + OP_TEST_ESTIMATE_TEXT_MEASURE: "1" run: cargo nextest run --workspace --target ${{ matrix.target }} --test-threads=1 - name: Doctests (host, Windows) if: matrix.cross == false && matrix.check_only != true && runner.os == 'Windows' diff --git a/crates/op-pen-loader/src/adapter.rs b/crates/op-pen-loader/src/adapter.rs index 37ab5a21d..304906484 100644 --- a/crates/op-pen-loader/src/adapter.rs +++ b/crates/op-pen-loader/src/adapter.rs @@ -60,8 +60,13 @@ thread_local! { /// and repeat reconversions (drag / resize / colour edits) re-measure identical /// text, so the cache turns those into hash lookups. (The estimate backend below /// is already cheap, so it is left unwrapped.) -#[cfg(all(feature = "skia-measure", not(all(test, target_os = "windows"))))] +#[cfg(feature = "skia-measure")] fn make_measure_backend() -> Rc { + // Windows CI sets this for tests that load op-pen-loader as a dependency. + if cfg!(target_os = "windows") && std::env::var_os("OP_TEST_ESTIMATE_TEXT_MEASURE").is_some() { + return jian_core::layout::measure::default_backend(); + } + Rc::new(crate::measure_cache::CachingMeasureBackend::new(Rc::new( jian_skia::SkiaMeasure::new(), ))) @@ -71,7 +76,7 @@ fn make_measure_backend() -> Rc { /// skia-safe. It is a character-count heuristic (~10% width error); the /// CanvasKit backend re-measures glyphs exactly at paint time, so layout drift /// is bounded to flex sizing of unconstrained text. -#[cfg(any(not(feature = "skia-measure"), all(test, target_os = "windows")))] +#[cfg(not(feature = "skia-measure"))] fn make_measure_backend() -> Rc { jian_core::layout::measure::default_backend() }