Build XCUI splitter foundation and test harness
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
#include "EditorValidationScenario.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
#ifndef XCENGINE_EDITOR_UI_TESTS_REPO_ROOT
|
||||
#define XCENGINE_EDITOR_UI_TESTS_REPO_ROOT "."
|
||||
#endif
|
||||
|
||||
namespace XCEngine::Tests::EditorUI {
|
||||
|
||||
namespace {
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
fs::path RepoRootPath() {
|
||||
std::string root = XCENGINE_EDITOR_UI_TESTS_REPO_ROOT;
|
||||
if (root.size() >= 2u && root.front() == '"' && root.back() == '"') {
|
||||
root = root.substr(1u, root.size() - 2u);
|
||||
}
|
||||
return fs::path(root).lexically_normal();
|
||||
}
|
||||
|
||||
fs::path RepoRelative(const char* relativePath) {
|
||||
return (RepoRootPath() / relativePath).lexically_normal();
|
||||
}
|
||||
|
||||
const std::array<EditorValidationScenario, 4>& GetEditorValidationScenarios() {
|
||||
static const std::array<EditorValidationScenario, 4> scenarios = { {
|
||||
{
|
||||
"editor.input.keyboard_focus",
|
||||
UIValidationDomain::Editor,
|
||||
"input",
|
||||
"Editor Input | Keyboard Focus",
|
||||
RepoRelative("tests/UI/Editor/integration/input/keyboard_focus/View.xcui"),
|
||||
RepoRelative("tests/UI/Editor/integration/shared/themes/editor_validation.xctheme"),
|
||||
RepoRelative("tests/UI/Editor/integration/input/keyboard_focus/captures")
|
||||
},
|
||||
{
|
||||
"editor.input.pointer_states",
|
||||
UIValidationDomain::Editor,
|
||||
"input",
|
||||
"Editor Input | Pointer States",
|
||||
RepoRelative("tests/UI/Editor/integration/input/pointer_states/View.xcui"),
|
||||
RepoRelative("tests/UI/Editor/integration/shared/themes/editor_validation.xctheme"),
|
||||
RepoRelative("tests/UI/Editor/integration/input/pointer_states/captures")
|
||||
},
|
||||
{
|
||||
"editor.input.shortcut_scope",
|
||||
UIValidationDomain::Editor,
|
||||
"input",
|
||||
"Editor Input | Shortcut Scope",
|
||||
RepoRelative("tests/UI/Editor/integration/input/shortcut_scope/View.xcui"),
|
||||
RepoRelative("tests/UI/Editor/integration/shared/themes/editor_validation.xctheme"),
|
||||
RepoRelative("tests/UI/Editor/integration/input/shortcut_scope/captures")
|
||||
},
|
||||
{
|
||||
"editor.layout.splitter_resize",
|
||||
UIValidationDomain::Editor,
|
||||
"layout",
|
||||
"Editor Layout | Splitter Resize",
|
||||
RepoRelative("tests/UI/Editor/integration/layout/splitter_resize/View.xcui"),
|
||||
RepoRelative("tests/UI/Editor/integration/shared/themes/editor_validation.xctheme"),
|
||||
RepoRelative("tests/UI/Editor/integration/layout/splitter_resize/captures")
|
||||
}
|
||||
} };
|
||||
return scenarios;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const EditorValidationScenario& GetDefaultEditorValidationScenario() {
|
||||
return GetEditorValidationScenarios().front();
|
||||
}
|
||||
|
||||
const EditorValidationScenario* FindEditorValidationScenario(std::string_view id) {
|
||||
for (const EditorValidationScenario& scenario : GetEditorValidationScenarios()) {
|
||||
if (scenario.id == id) {
|
||||
return &scenario;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace XCEngine::Tests::EditorUI
|
||||
Reference in New Issue
Block a user