Test Suites
This chapter describes how Slint SC is tested. The Qualification Report holds the evidence from running the suites.
The Suites
Section titled “The Suites”Three suites run together, each verifying a different part of the toolchain.
scripts/slint_sc_test_suite.sh runs all of them and collects their reports.
Compiler Syntax Tests
Section titled “Compiler Syntax Tests”The syntax tests in internal/compiler/tests/syntax/slint-sc/ run the compiler in SC mode and assert its diagnostics.
Each file pins the expected message to the exact source span that produces the message:
import { Button } from "std-widgets.slint";// > <error{Imports are not supported in Slint SC}These tests carry the weight of the subset. Slint SC is defined as much by what it rejects as by what it accepts. So each construct outside the subset has a file asserting that the compiler refuses the construct with a diagnostic the user can act on.
Runtime Test Cases
Section titled “Runtime Test Cases”The cases in api/slint-sc/tests/cases/ are .slint files that get compiled and executed.
For each case, the driver in api/slint-sc/tests/driver.rs:
- Compiles the case with
slint-compiler --slint-scinto Rust. - Extracts the test body from the fenced
rustblocks in the case’s comments. - Compiles the generated code and that body with
rustc. - Runs the resulting binary.
- Compares the screenshots the case took, if the case took any, against the PNG references in
api/slint-sc/tests/references/. - Measures the coverage of the case’s
.slintcode. If the case states its expected coverage in caret lines, the driver compares the measurement with them. Every case that states its coverage tests that reporting. The cases undercoverage/test nothing else, so the cases undercoverage/have to state their coverage; see Coverage Tool Verification.
Step 3 is itself a test.
The runtime is the only --extern passed to rustc,
so generated code that reaches for any other crate fails to compile rather than shipping an undeclared dependency.
A block marked compile_fail inverts the check: the block must fail to compile, with every error named by a //~ ERROR line present in the compiler output.
That’s how the API-level negative cases are written, such as a component that isn’t exported staying unreachable:
let _ = Hidden::new();//~ ERROR undeclared type `Hidden`A case that verifies what the runtime draws calls the screenshot! macro.
The macro renders the component into a fixed 64x64 RGB buffer, and writes the buffer out for the driver to compare.
Other cases assert in Rust alone and take no screenshot.
The driver compares the screenshot byte for byte against the reference, with no tolerance threshold.
The runtime’s determinism makes that possible: no dynamic allocation, no external dependencies, and a caller-provided frame buffer.
A single differing pixel fails the case.
Runtime Unit Tests
Section titled “Runtime Unit Tests”The unit tests in the slint-sc crate cover its own API surface, such as color encoding and error formatting.
The unit tests are no_std, like the crate itself.
Tagging Requirements
Section titled “Tagging Requirements”A test declares the requirements it verifies with //#sls.… comments naming their identifiers:
// A source file with a UTF-8 BOM is well-formed.//#sls.source.encoding.bom//#sls.source.encoding.utf8slint-doc-generator scans cases, syntax tests, and the Rust sources of the runtime and the compiler for these comments.
Where a requirement is enforced by Rust code rather than by a .slint case, the comment sits at that code.
An identifier that matches no requirement paragraph fails the build, so a tag can’t outlive the paragraph it names.
What This Establishes
Section titled “What This Establishes”The evidence runs in two directions, and the build enforces both: every requirement paragraph is traced to a test, and the suites execute all of the runtime. See What Is Verified and Pass Criteria. Together, the two directions show that the specified behavior is tested, and that the runtime has no behavior beyond what the tests reach.
© 2026 SixtyFPS GmbH
Built from commit e69c2a25181702af006ff3af4e084bda20a131c9