TestStage
A Stage for tests: a scene on frames the test steps, with no renderer and no page, that is also the Stage the hooks under it find. Its pointer hits objects through three's own raycast. It runs in Node. From @wardic/three/solid, on Solid 2.
import { createHover, TestStage, WardicStage } from "@wardic/three/solid"
import { flush } from "solid-js"
const stage = TestStage.make({ scene, camera, size: { width: 800, height: 600 } })
let hovered!: () => boolean
const Probe = () => {
hovered = createHover(crate)
return null
}
// Mounted as an app mounts it: <WardicStage value={stage}><Probe /></WardicStage>
stage.pointer.over(crate)
stage.frame()
flush()
expect(hovered()).toBe(true)TestStage.make({ scene, camera, size, features })makes one, its canvas a stand-in ofsize.featuresare a Stage's:stageDrag,stageBatches.frame(ms?)runs one frame, 1/60 s on by default: the raycast, Wardic's writes and Frame effects, then the scene's matrices made current, as a render makes them.pointermoves a mouse over the stand-in canvas:over(object)to where it's drawn,at(x, y),down(),up(),cancel()andleave(). The next frame finds what's under it, as on a page.dispose()ends it, landing any exit still in flight.
Without Solid, @wardic/three's TestStage is the same scene for a runtime alone.