{"record":{"id":"101cbc0c92c23125","repo":"slint-ui/slint","slug":"platform-not-set-initialize-the-testing-backend-f","errorCode":null,"errorMessage":"platform not set, initialize the testing backend first","messagePattern":"platform not set, initialize the testing backend first","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backends/testing/lib.rs","lineNumber":113,"sourceCode":"        |ctx| ctx.set_accent_color(color),\n    )\n    .unwrap();\n}\n\n/// Replace the font collection with embedded NotoSans fonts for deterministic test results.\n/// Must be called after initializing the testing backend (e.g. after [`init_no_event_loop()`]).\n#[cfg(feature = \"internal\")]\npub fn configure_test_fonts() {\n    use i_slint_common::sharedfontique::{FALLBACK_FAMILIES, fontique};\n    use include_dir::{Dir, include_dir};\n\n    static FONTS_DIR: Dir = include_dir!(\"$CARGO_MANIFEST_DIR/../../../tests/screenshots/fonts\");\n    // Pin the primary by name so its position in the fallback chain doesn't depend on\n    // filesystem iteration order. NotoSans-Regular wins as the default upright face.\n    const PRIMARY: &str = \"NotoSans-Regular.ttf\";\n\n    i_slint_core::with_global_context(\n        || panic!(\"platform not set, initialize the testing backend first\"),\n        |ctx| {\n            let mut font_context = ctx.font_context().borrow_mut();\n            font_context.collection = fontique::Collection::new(fontique::CollectionOptions {\n                shared: true,\n                system_fonts: false,\n            });\n            font_context.source_cache = fontique::SourceCache::new_shared();\n            font_context.clear_registered_static_fonts();\n\n            let primary =\n                FONTS_DIR.get_file(PRIMARY).expect(\"primary test font missing from fonts dir\");\n            let mut fallback_files: Vec<_> = FONTS_DIR\n                .files()\n                .filter(|f| f.path().extension().is_some_and(|ext| ext == \"ttf\"))\n                .filter(|f| f.path().file_name().and_then(|n| n.to_str()) != Some(PRIMARY))\n                .collect();\n            // Sort fallbacks lexicographically so the chain is reproducible across platforms.\n            fallback_files.sort_by_key(|f| f.path().to_owned());","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/internal/backends/testing/lib.rs#L95-L131","documentation":"Error \"platform not set, initialize the testing backend first\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at internal/backends/testing/lib.rs:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Initialize the testing backend with init_integration_test_with_system_testing_service or init_no_mock before this call.","Check the test setup ordering."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}