Files
Roman ChojnackiandClaude Opus 5.5 dffcce22d5 CSS: Reaktor's own engine replaces libcss, and a pass of simplifications
core/css/css.c reads the stylesheets once into typed values and cascades
them as CSS does: !important, then specificity, then source order. It takes
var(), color-mix(in srgb, ...), em and rem, calc() over pixels, the @media
features Reaktor answers, @import at the top of a sheet, :not(), :enabled,
attribute selectors read as classes, descendant and child combinators, and
escapes. Rules are bucketed by the last compound of their selector, so a
query checks only the rules that could match. cssflat.c, LCUI's libcss and
yutil, and the lcui submodule go.

Screenshots of every showcase tab, notepad and simple, light and dark, with
normal and more contrast, are byte-identical to the libcss build, with
Water.css and with Simple.css; --a11y-dump differs only in the a11y struct's
size. Three values change to what CSS says: an unset background is
transparent black, an unset border color is the text's, and Simple.css's
:enabled:hover no longer reaches a disabled button. Against libcss, loading
the sheets takes 0.35 ms instead of 1.24 and a first query 0.32 us instead
of 4.4. csstest covers the cascade, values, @media and hostile sheets: import
loops and fan-out, var() that grows or expands too often, deep calc(), a sheet
left open, a huge file. 200,000 mutated sheets ran clean under AddressSanitizer.

Simplifications: dead state (redraw_always, sw_noaa, the hover-gap pin, a
muted note, an overwritten slider range, the font-baking blocks of the SDL
renderer, the a11y change index); REAKTOR_LAY_FILL for FILL_X | FILL_Y; one
helper each for flag parsing, capture runs, timings, paths from the working
directory, array growth, focus moves, tooltips, button presses, a11y slot
probes, UIA fragments and test strings; launchtest's notef() and last_node();
the output folder set once in CMake and a write-if-changed function; one test
list, tools/ci/tests.txt, for every workflow, so basetest and imagetest run.

The showcase drops its relaunch button, an ask() button is as wide as its
label, and build.sh takes a bare target. The docs follow, and PERFORMANCE.md
and the chart carry a new pass of all seven benchmark arms on one machine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-24 02:37:13 +02:00

51 lines
1.0 KiB
C

#ifndef REAKTOR_TEST_H
#define REAKTOR_TEST_H
#include <stdio.h>
#include <string.h>
static int failures;
static void
test_ok(const char *what, int cond)
{
if (!cond) failures++;
printf(" %-56s %s\n", what, cond ? "ok" : "FAILED");
}
static void
test_eq(const char *what, long got, long want)
{
if (got == want) {
printf(" %-56s ok\n", what);
return;
}
failures++;
printf(" %-56s got %ld, wanted %ld FAILED\n", what, got, want);
}
static void
test_str(const char *what, const char *got, const char *want)
{
if (got && want && strcmp(got, want) == 0) {
printf(" %-56s \"%s\"\n", what, got);
return;
}
failures++;
printf(" %-56s got \"%s\", wanted \"%s\" FAILED\n", what, got ? got : "(null)",
want ? want : "(null)");
}
static int
test_done(const char *name)
{
if (failures) {
printf("\n%d check%s failed\n", failures, failures == 1 ? "" : "s");
return 1;
}
printf("\n%s: all checks passed\n", name);
return 0;
}
#endif