/* * Copyright (c) 2024-2025, Tim Flynn * Copyright (c) 2025, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "Fuzzy.h" #include #include #include #include #include #include #include #include namespace TestWeb { enum class TestMode { Layout, Text, Ref, Screenshot, Crash, }; enum class TestResult { Pass, Fail, Skipped, Timeout, Crashed, Expanded, }; enum class RefTestExpectationType { Match, Mismatch, }; struct Test { TestMode mode; ByteString input_path {}; ByteString expectation_path {}; ByteString relative_path {}; ByteString safe_relative_path {}; Optional variant {}; UnixDateTime start_time {}; UnixDateTime end_time {}; size_t index { 0 }; size_t run_index { 1 }; size_t total_runs { 1 }; String text {}; bool did_finish_test { false }; bool did_finish_loading { false }; bool did_check_variants { false }; Optional ref_test_expectation_type {}; Vector fuzzy_matches {}; RefPtr actual_screenshot {}; RefPtr expectation_screenshot {}; u64 diff_pixel_error_count { 0 }; u8 diff_maximum_error { 0 }; RefPtr timeout_timer {}; }; struct TestCompletion { size_t test_index; TestResult result; }; using TestPromise = Core::Promise; // Deferred warning system - buffers warnings during live display mode void add_deferred_warning(ByteString message); void print_deferred_warnings(); }