mitiru::validate

Internal validation utilities used by the engine's test harness and the visual debug overlay.

Internal validation utilities used by the engine's test harness and the visual debug overlay.

NameKindItems
Engineclass41
ScreenshotAnalysisstruct12
AutoScreenshotclass7
ITestableDemostruct3
DemoTestResultstruct8
TestReportstruct5
AutoScreenshotTestclass7
CoverageTrackerclass10
DeadlockInfostruct5
DeadlockDetectorclass8
GameplayAnomalystruct8
MetricRulestruct4
GameplayMetricsclass7
HealthMetricsstruct7
HealthCheckclass11
ValidationResultstruct5
InvariantRegistryclass7
PhysicsAnomalystruct9
PhysicsValidatorConfigstruct3
PhysicsValidatorclass5
DiffResultstruct6
ScreenshotDifferclass3
TemporalRuleTypeenum6
TemporalViolationstruct8
TemporalRulestruct7
TemporalInvariantCheckerclass8
UIElementstruct3
LayoutIssuestruct6
UILayoutValidatorclass6
VisualDebugOverlayclass7
RegressionResultstruct5
VisualRegressionTestclass8

Free functions and typedefs

using CefContext = mitiru::cef::MitiruCefContext;
using CefContext = mitiru::cef::NullCefContext;
class Engine 41
Engine() = default
~Engine()
[[nodiscard]] CefContext* cefContext() noexcept
void run(Game& game, const EngineConfig& configIn = {})
void stepFrames(Game& game, std::uint64_t frameCount, const EngineConfig& config = {})
[[nodiscard]] std::vector<std::uint8_t> capture() const
[[nodiscard]] std::vector<std::uint8_t> runAndCapture( Game& game, int frameCount, const EngineConfig& config = {})
void setWorld(ecs::MitiruWorld* world) noexcept
void setSceneManager(scene::MitiruSceneManager* mgr) noexcept
void setAudioEngine(std::shared_ptr<audio::IAudioEngine> engine) noexcept
[[nodiscard]] audio::IAudioEngine* audioEngine() noexcept
void setMasterVolume(float v) noexcept
void setBgmVolume(float v) noexcept
void setSeVolume(float v) noexcept
void setVoiceVolume(float v) noexcept
[[nodiscard]] float masterVolume() const noexcept
[[nodiscard]] float bgmVolume() const noexcept
[[nodiscard]] float seVolume() const noexcept
[[nodiscard]] float voiceVolume() const noexcept
[[nodiscard]] const EngineConfig& config() const noexcept
[[nodiscard]] EngineConfig& mutableConfig() noexcept
bool saveSettings() noexcept
void setTemporalChecker(validate::TemporalInvariantChecker* checker) noexcept
void setDiffTracker(observe::StructuredDiff* tracker) noexcept
void setCausalChain(observe::CausalChain* chain) noexcept
[[nodiscard]] render::PostProcessManager* postProcess() noexcept
[[nodiscard]] const render::PostProcessManager* postProcess() const noexcept
[[nodiscard]] std::string snapshot() const
void requestStop() noexcept
void setFullscreen(bool enable) noexcept
[[nodiscard]] bool isFullscreen() const noexcept
[[nodiscard]] std::uint64_t frameNumber() const noexcept
[[nodiscard]] InputInjector& inputInjector() noexcept
[[nodiscard]] const InputState& inputState() const noexcept
[[nodiscard]] const Screen* screen() const noexcept
[[nodiscard]] server::EngineHttpServer* httpServer() noexcept
void setCommandSystem(CommandSystem* cmd) noexcept
void setGameFlag(const std::string& key, const std::string& value)
[[nodiscard]] std::string getGameFlag(const std::string& key) const
[[nodiscard]] Screen* screen() noexcept
[[nodiscard]] const Clock* clock() const noexcept
struct ScreenshotAnalysis 12
int width = 0
int height = 0
int totalPixels = 0
int nonBlackPixels = 0
float nonBlackPercent = 0
int uniqueColors = 0
bool valid = false
std::string issues
void analyze(const std::vector<uint8_t>& pixels, int w, int h)
[[nodiscard]] std::string summary() const
[[nodiscard]] bool isHealthy() const noexcept
static bool saveBMP(const char* path, const std::vector<uint8_t>& pixels, int w, int h)
class AutoScreenshot 7
void setOutputDir(const std::string& dir)
void setAutoSave(bool enabled)
CaptureResult captureAndAnalyze( const std::vector<uint8_t>& pixels, int w, int h)
bool validateFrames( std::function<std::vector<uint8_t>()> captureFunc, int w, int h, int frameCount = 3)
[[nodiscard]] const std::vector<ScreenshotAnalysis>& history() const noexcept
void clearHistory()
using DemoFactory = std::function<std::unique_ptr<ITestableDemo>()>;
struct ITestableDemo 3
virtual ~ITestableDemo() = default
virtual void update(float deltaTime) = 0
virtual void draw(Screen& screen) = 0
struct DemoTestResult 8
std::string name
bool passed = true
std::vector<DrawIssue> issues
std::vector<std::string> validationErrors
std::string screenshotPath
int drawCallCount = 0
int framesTested = 0
[[nodiscard]] std::string toJson() const
struct TestReport 5
std::vector<DemoTestResult> results
int totalPassed = 0
int totalFailed = 0
std::string outputDirectory
[[nodiscard]] std::string toJson() const
class AutoScreenshotTest 7
void registerDemo(const std::string& name, DemoFactory factory)
void setGoldenImage(const std::string& name, render::ScreenshotData golden)
void setDiffThreshold(float percent) noexcept
void setFramesPerDemo(int frames) noexcept
void setOutputDirectory(const std::string& dir)
[[nodiscard]] TestReport runAll(int screenW, int screenH, int framesPerDemo = 0) const
[[nodiscard]] std::size_t demoCount() const noexcept
class CoverageTracker 10
void registerPath(const std::string& pathId)
void markVisited(const std::string& pathId)
[[nodiscard]] bool isVisited(const std::string& pathId) const
[[nodiscard]] float coverage() const noexcept
[[nodiscard]] std::vector<std::string> allPaths() const
[[nodiscard]] std::vector<std::string> visitedPaths() const
[[nodiscard]] std::vector<std::string> unvisitedPaths() const
[[nodiscard]] std::string toJson() const
void reset() noexcept
void resetVisited() noexcept
struct DeadlockInfo 5
std::uint64_t detectedAtFrame = 0
std::uint64_t staleForFrames = 0
std::string lastState
std::string description
[[nodiscard]] std::string toJson() const
class DeadlockDetector 8
void setThreshold(std::uint64_t frames)
void recordState(const std::string& key, const std::string& value, std::uint64_t frame)
[[nodiscard]] std::optional<DeadlockInfo> check(std::uint64_t currentFrame) const
[[nodiscard]] std::uint64_t framesSinceLastChange(std::uint64_t currentFrame) const
[[nodiscard]] float changeFrequency(std::uint64_t currentFrame) const
[[nodiscard]] std::size_t trackedKeyCount() const noexcept
void reset()
[[nodiscard]] std::string toJson() const
struct GameplayAnomaly 8
enum `Type` { NoInput, NoMovement, NegativeValue, Stagnation, InvalidState }
Type type
std::uint64_t frame = 0
std::string metricName
float value = 0.0f
float threshold = 0.0f
std::string description
[[nodiscard]] std::string toJson() const
struct MetricRule 4
std::string name
GameplayAnomaly::Type type
float threshold = 0.0f
int windowFrames = 60
class GameplayMetrics 7
void addRule(MetricRule rule)
void recordMetric(const std::string& name, float value, std::uint64_t frame)
void recordInput(std::uint64_t frame)
[[nodiscard]] std::vector<GameplayAnomaly> check(std::uint64_t currentFrame) const
[[nodiscard]] std::size_t ruleCount() const noexcept
void clear()
[[nodiscard]] std::string toJson(const std::vector<GameplayAnomaly>& anomalies) const
struct HealthMetrics 7
float fps = 0.0f
float updateMs = 0.0f
float drawMs = 0.0f
int entityCount = 0
float memoryUsageMB = 0.0f
int drawCallCount = 0
[[nodiscard]] std::string toJson() const
class HealthCheck 11
using SteadyClock = std::chrono::steady_clock;
using TimePoint = SteadyClock::time_point;
void beginFrame()
void endFrame()
void beginDraw()
void endDraw()
void recordEntityCount(int count) noexcept
void recordDrawCalls(int count) noexcept
void recordMemoryUsage(float megabytes) noexcept
[[nodiscard]] const HealthMetrics& metrics() const noexcept
[[nodiscard]] std::string toJson() const
struct ValidationResult 5
bool passed = false
std::string name
std::string message
std::uint64_t frame = 0
[[nodiscard]] std::string toJson() const
class InvariantRegistry 7
using Predicate = std::function<bool()>;
void add(std::string name, Predicate pred)
void remove(const std::string& name)
[[nodiscard]] std::vector<ValidationResult> checkAll(std::uint64_t frame) const
[[nodiscard]] std::string toJson(std::uint64_t frame) const
[[nodiscard]] std::size_t size() const noexcept
void clear() noexcept
struct PhysicsAnomaly 9
enum `Type` { OutOfBounds, WallPenetration, ExcessiveVelocity, NaNPosition, TeleportDetected, OverlapDetected }
Type type
scene::EntityId entityId = 0
std::string entityName
sgc::Vec3f position
float value = 0.0f
float threshold = 0.0f
std::string description
[[nodiscard]] std::string toJson() const
struct PhysicsValidatorConfig 3
float maxVelocity = 1000.0f
float maxTeleportDistance = 100.0f
float overlapThreshold = 0.01f
class PhysicsValidator 5
explicit PhysicsValidator(PhysicsValidatorConfig config = {})
void setConfig(const PhysicsValidatorConfig& config)
std::vector<PhysicsAnomaly> validate(scene::GameWorld& world)
void reset()
[[nodiscard]] std::string toJson(const std::vector<PhysicsAnomaly>& anomalies) const
struct DiffResult 6
bool match = true
int totalPixels = 0
int differentPixels = 0
float diffPercentage = 0.0f
int maxChannelDiff = 0
[[nodiscard]] std::string toJson() const
class ScreenshotDiffer 3
[[nodiscard]] DiffResult compare( const render::ScreenshotData& expected, const render::ScreenshotData& actual, int tolerance = 0) const
[[nodiscard]] bool matches( const render::ScreenshotData& expected, const render::ScreenshotData& actual, float maxDiffPercent = 0.1f, int tolerance = 2) const
[[nodiscard]] render::ScreenshotData generateDiffImage( const render::ScreenshotData& expected, const render::ScreenshotData& actual, int tolerance = 0) const
enum TemporalRuleType : uint8_t 6
MaxDelta
MinDelta
RateOfChange
Monotonic
RangeBound
Timeout
struct TemporalViolation 8
std::string ruleName
TemporalRuleType type
std::uint64_t frame = 0
float previousValue = 0.0f
float currentValue = 0.0f
float threshold = 0.0f
std::string description
[[nodiscard]] std::string toJson() const
struct TemporalRule 7
std::string name
TemporalRuleType type
float threshold = 0.0f
float minBound = 0.0f
float maxBound = 0.0f
int windowFrames = 1
bool increasing = true
class TemporalInvariantChecker 8
void addRule(TemporalRule rule)
void removeRule(std::string_view name)
void recordValue(const std::string& valueName, float value, std::uint64_t frame)
[[nodiscard]] std::vector<TemporalViolation> check(std::uint64_t currentFrame) const
[[nodiscard]] std::vector<TemporalViolation> checkValue( std::string_view valueName, std::uint64_t currentFrame) const
void clear()
[[nodiscard]] std::size_t ruleCount() const noexcept
[[nodiscard]] std::string toJson( const std::vector<TemporalViolation>& violations) const
struct UIElement 3
std::string id
std::string role
sgc::Rectf bounds
struct LayoutIssue 6
enum `Type` { OutOfBounds, Overlap, TooSmall, Clipped }
Type type
std::string elementId
std::string otherElementId
std::string description
[[nodiscard]] std::string toJson() const
class UILayoutValidator 6
UILayoutValidator(float screenW, float screenH)
void setMinElementSize(float size)
[[nodiscard]] std::vector<LayoutIssue> validate( const std::vector<UIElement>& elements) const
[[nodiscard]] std::vector<LayoutIssue> checkBounds(const UIElement& elem) const
[[nodiscard]] std::vector<LayoutIssue> checkOverlaps( const std::vector<UIElement>& elements) const
[[nodiscard]] std::string toJson(const std::vector<LayoutIssue>& issues) const
class VisualDebugOverlay 7
void setEnabled(bool enabled) noexcept
void toggle() noexcept
[[nodiscard]] bool isEnabled() const noexcept
void setFps(float fps) noexcept
void recordDrawCall(const sgc::Rectf& bounds, bool isText = false)
void beginFrame()
void drawOverlay(Screen& screen, const DrawCallValidator& validator) const
struct RegressionResult 5
std::string testName
bool passed = true
float diffPercentage = 0.0f
std::string message
[[nodiscard]] std::string toJson() const
class VisualRegressionTest 8
void setThreshold(float percent)
void setTolerance(int tolerance)
void setGoldenImage(const std::string& name, render::ScreenshotData image)
[[nodiscard]] RegressionResult test( const std::string& name, const render::ScreenshotData& current) const
[[nodiscard]] std::vector<RegressionResult> testAll( const std::map<std::string, render::ScreenshotData>& currentImages) const
[[nodiscard]] bool hasGoldenImage(const std::string& name) const
[[nodiscard]] std::vector<std::string> goldenImageNames() const
[[nodiscard]] std::string toJson( const std::vector<RegressionResult>& results) const

Sourced from docs/API_CATALOG.md, auto-generated by tools/generate_api_catalog.py.