window

the test suite

whether it still works, plus the mutation pass

mirrored from window/cpp/window.test/tests/README.md, which is the only copy of this text. edits made here are overwritten the next time the site builds

the test exe, window.test, the thing P1.1 asks to build n run. it links both static libs n doubles as the scratch app while phases 1 n 2 land, plus the headless png dump harness from P1.31

links window.core n window.widgets, no third test framework, a main that runs cases n returns non zero on a fail is enough for now

running it

bin\x64_Debug\window.test.exe

walks every check that needs no eyes, one line each n all checks passed at the end, exit 0 clean n 1 on any failure, so a script can read it. covers P1.1 (the four projects link n blend2d is really in there), P1.3 (surface_t owns nothing n behaves like a view), P1.4 (the layered presenter drives a real window through begin, end, resize n a double destroy), P1.35 (the opaque one owns the same store), P1.5 (the blend2d renderer draws, clips, replays a path n measures text), P1.8 (dwrite hands back a real file n face index) n P1.9 (the host owns a window, paints through the renderer n gives every handle back)

two of P1.9s criteria are not things a test can read directly n are checked by their consequence instead. the wndproc being a member is proven by two hosts in one process each keeping their own frame, which is the thing that shape is for n which a free wndproc over global state cannot do. freeing every handle is proven by GetGuiResources, n the counter is checked to actually count (a live host raises it, a destroyed one puts it back) before the twenty cycle loop is allowed to mean anything

the P1.8 block asserts the things the ahk resolver got wrong, not the things it got right. a family name coming back with a path on it was never the hard half, so what is checked is Cambria Math landing past face 0, an unknown family degrading to something drawable instead of throwing, n an unreachable weight producing a capped stroke where a satisfied one produces none

the per-user check round trips rather than naming a font, it asks the per-user set what families it holds n then asks the resolver for one of them back, so it proves the route on any box that has one n skips cleanly on a box that does not

the P1.5 block runs against plain heap memory with no window n no dc anywhere, which is not a convenience, it is the criterion. a renderer that needed a window to draw would have the seam broken n that block would not compile. the load bearing check in there is the re-point, two buffers at different addresses take consecutive frames n each keeps only its own, which is the one thing a renderer that bound its image once at create would fail

bin\x64_Debug\window.test.exe --show

the one criterion a machine cannot sign off, three vertical bands of one blue at 25% n 50% n solid on a real layered window over your desktop. pass is all three visibly different with the desktop showing through the first two, a colour keyed window could only ever show two of them. it closes itself after 30s so it can never sit blocking something that ran it by accident

how a check earns its line

a check asserts something observable or it is not a check. the layered present is the awkward one, it returns a code that means nothing visually (thats G-window-7s whole point), so what gets asserted is that the window ends up the size we presented, bc ULW sizes the window to its psize n nothing else in the test moves it. the partial present path gets exercised n asserted on nowhere, deliberately

On this page