Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| TestResult | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\WptHarness; |
| 6 | |
| 7 | /** |
| 8 | * Per-test result row written to the harness ledger |
| 9 | * (`var/wpt/report.json`). One instance per WPT test per harness run. |
| 10 | * |
| 11 | * Phase 4A.5 serialises a collection of these into the published |
| 12 | * dashboard at `docs/site/standards/spec-coverage/wpt-report.md`. |
| 13 | */ |
| 14 | final readonly class TestResult |
| 15 | { |
| 16 | /** |
| 17 | * @param string $testId Stable WPT test identifier — the |
| 18 | * relative path under |
| 19 | * `vendor-data/wpt/`, minus the |
| 20 | * file extension. Example: |
| 21 | * `css/css-transforms/transform-2d-001`. |
| 22 | * @param TestStatus $status Where the test landed in the |
| 23 | * {@see TestStatus} bucket |
| 24 | * hierarchy. |
| 25 | * @param float $diffScore Perceptual diff score in |
| 26 | * `[0.0, 1.0]` — the share of the |
| 27 | * frame that differs. `0.0` is |
| 28 | * byte-identical to the reference; |
| 29 | * `1.0` is "completely |
| 30 | * different". Reported for sorting |
| 31 | * and trending; it is NOT the pass |
| 32 | * criterion, which is an absolute |
| 33 | * differing-pixel budget (see |
| 34 | * {@see Scorer}). |
| 35 | * @param string|null $reason Human-readable explanation when |
| 36 | * the status is `OutOfScope`, |
| 37 | * `PendingSubstrate`, or |
| 38 | * `Skipped`. Null when status is |
| 39 | * `Pass` or `Fail`. |
| 40 | * @param string|null $diffArtefactPath Path under `var/wpt/diffs/` |
| 41 | * where rendered.png + ref.png + |
| 42 | * diff.png live. Null when no |
| 43 | * diff was produced (out-of-scope |
| 44 | * / skipped tests). |
| 45 | * @param float $renderMicros Wall-clock time the renderer |
| 46 | * spent on this test, in |
| 47 | * microseconds. Tracked so the |
| 48 | * dashboard can surface |
| 49 | * performance regressions |
| 50 | * alongside conformance ones. |
| 51 | * @param bool $bothRendersSolid True when the test PASSED and |
| 52 | * both the test render and the |
| 53 | * reference render came out a |
| 54 | * single solid colour — WPT's |
| 55 | * `check_if_solid_color` |
| 56 | * criterion. Because this harness |
| 57 | * renders both sides with its own |
| 58 | * engine, an unimplemented feature |
| 59 | * is missing from both and the two |
| 60 | * blank pages match: a pass with |
| 61 | * no evidence behind it. Reported |
| 62 | * as `blankPass`; never a verdict. |
| 63 | */ |
| 64 | public function __construct( |
| 65 | public string $testId, |
| 66 | public TestStatus $status, |
| 67 | public float $diffScore, |
| 68 | public ?string $reason, |
| 69 | public ?string $diffArtefactPath, |
| 70 | public float $renderMicros, |
| 71 | public bool $bothRendersSolid = false, |
| 72 | ) {} |
| 73 | } |