Skip to content

Test Suites

This chapter describes how Slint SC is tested. The Qualification Report holds the evidence from running 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.

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}
slint

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.

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:

  1. Compiles the case with slint-compiler --slint-sc into Rust.
  2. Extracts the test body from the fenced rust blocks in the case’s comments.
  3. Compiles the generated code and that body with rustc.
  4. Runs the resulting binary.
  5. Compares the screenshots the case took, if the case took any, against the PNG references in api/slint-sc/tests/references/.
  6. Measures the coverage of the case’s .slint code. 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 under coverage/ test nothing else, so the cases under coverage/ 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`
rust

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.

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.

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.utf8
slint

slint-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.

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 07986dea0ccb8bb10721c83ecba08d9a3e2cc234