fix(ci): gate windows test text measurement

This commit is contained in:
Kayshen-X 2026-07-08 02:00:47 +08:00
parent 921a6de4eb
commit 3590663aec
3 changed files with 11 additions and 2 deletions

View file

@ -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'

View file

@ -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'

View file

@ -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<dyn MeasureBackend> {
// 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<dyn MeasureBackend> {
/// 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<dyn MeasureBackend> {
jian_core::layout::measure::default_backend()
}