2024-10-10 11:56:27 -04:00
|
|
|
/*
|
2025-06-06 20:11:13 -04:00
|
|
|
* Copyright (c) 2024-2025, Tim Flynn <trflynn89@ladybird.org>
|
2025-07-16 11:39:55 +02:00
|
|
|
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
2024-10-10 11:56:27 -04:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-07-16 11:39:55 +02:00
|
|
|
#include "Fuzzy.h"
|
|
|
|
|
|
2024-10-10 11:56:27 -04:00
|
|
|
#include <AK/ByteString.h>
|
|
|
|
|
#include <AK/RefPtr.h>
|
|
|
|
|
#include <AK/String.h>
|
2024-10-13 09:23:27 -04:00
|
|
|
#include <AK/Time.h>
|
2025-07-16 11:39:55 +02:00
|
|
|
#include <AK/Vector.h>
|
2024-10-10 11:56:27 -04:00
|
|
|
#include <LibCore/Promise.h>
|
|
|
|
|
#include <LibGfx/Forward.h>
|
|
|
|
|
|
2025-06-06 20:11:13 -04:00
|
|
|
namespace TestWeb {
|
2024-10-10 11:56:27 -04:00
|
|
|
|
|
|
|
|
enum class TestMode {
|
|
|
|
|
Layout,
|
|
|
|
|
Text,
|
|
|
|
|
Ref,
|
2024-11-22 22:29:21 +00:00
|
|
|
Crash,
|
2024-10-10 11:56:27 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum class TestResult {
|
|
|
|
|
Pass,
|
|
|
|
|
Fail,
|
|
|
|
|
Skipped,
|
|
|
|
|
Timeout,
|
2024-11-12 08:50:54 -05:00
|
|
|
Crashed,
|
2024-10-10 11:56:27 -04:00
|
|
|
};
|
|
|
|
|
|
2024-12-04 11:38:09 +00:00
|
|
|
enum class RefTestExpectationType {
|
|
|
|
|
Match,
|
|
|
|
|
Mismatch,
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-10 11:56:27 -04:00
|
|
|
struct Test {
|
|
|
|
|
TestMode mode;
|
|
|
|
|
|
|
|
|
|
ByteString input_path {};
|
|
|
|
|
ByteString expectation_path {};
|
2024-11-30 08:08:47 -05:00
|
|
|
ByteString relative_path {};
|
2024-10-10 11:56:27 -04:00
|
|
|
|
2024-10-13 09:23:27 -04:00
|
|
|
UnixDateTime start_time {};
|
|
|
|
|
UnixDateTime end_time {};
|
2024-11-30 08:51:59 -05:00
|
|
|
size_t index { 0 };
|
2024-10-13 09:23:27 -04:00
|
|
|
|
2024-10-10 11:56:27 -04:00
|
|
|
String text {};
|
|
|
|
|
bool did_finish_test { false };
|
|
|
|
|
bool did_finish_loading { false };
|
|
|
|
|
|
2024-12-04 11:38:09 +00:00
|
|
|
Optional<RefTestExpectationType> ref_test_expectation_type {};
|
2025-07-16 11:39:55 +02:00
|
|
|
Vector<FuzzyMatch> fuzzy_matches {};
|
2024-12-04 11:38:09 +00:00
|
|
|
|
2025-04-15 15:50:18 -06:00
|
|
|
RefPtr<Gfx::Bitmap const> actual_screenshot {};
|
|
|
|
|
RefPtr<Gfx::Bitmap const> expectation_screenshot {};
|
2024-10-10 11:56:27 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TestCompletion {
|
|
|
|
|
Test& test;
|
|
|
|
|
TestResult result;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using TestPromise = Core::Promise<TestCompletion>;
|
|
|
|
|
|
|
|
|
|
}
|