Enhance testing framework and UI integration for YAZE
- Added a comprehensive testing framework with support for unit, integration, and UI tests, improving overall test coverage and reliability. - Integrated ImGui Test Engine for UI testing, allowing for real-time feedback and visualization of test results. - Updated CMake configuration to conditionally include testing components based on build options, enhancing flexibility for developers. - Introduced a new command in the CLI for running asset loading tests on ROMs, providing a straightforward way to validate functionality. - Enhanced error handling and resource management during testing, ensuring stability and clarity in test execution. - Improved user interface with a dedicated test dashboard for monitoring test progress and results, enhancing developer experience.
This commit is contained in:
@@ -24,4 +24,5 @@ set(
|
||||
app/editor/system/extension_manager.cc
|
||||
app/editor/system/shortcut_manager.cc
|
||||
app/editor/system/popup_manager.cc
|
||||
app/test/test_manager.cc
|
||||
)
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/rom.h"
|
||||
#include "test/test_manager.h"
|
||||
#include "test/unit_test_suite.h"
|
||||
#include "editor/editor.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/misc/cpp/imgui_stdlib.h"
|
||||
@@ -105,6 +107,17 @@ void EditorManager::LoadWorkspacePreset(const std::string &name) {
|
||||
last_workspace_preset_ = name;
|
||||
}
|
||||
|
||||
void EditorManager::InitializeTestSuites() {
|
||||
auto& test_manager = test::TestManager::Get();
|
||||
|
||||
// Register unit test suites
|
||||
test_manager.RegisterTestSuite(std::make_unique<test::UnitTestSuite>());
|
||||
test_manager.RegisterTestSuite(std::make_unique<test::ArenaTestSuite>());
|
||||
|
||||
// Update resource monitoring to track Arena state
|
||||
test_manager.UpdateResourceStats();
|
||||
}
|
||||
|
||||
constexpr const char *kOverworldEditorName = ICON_MD_LAYERS " Overworld Editor";
|
||||
constexpr const char *kGraphicsEditorName = ICON_MD_PHOTO " Graphics Editor";
|
||||
constexpr const char *kPaletteEditorName = ICON_MD_PALETTE " Palette Editor";
|
||||
@@ -134,6 +147,9 @@ void EditorManager::Initialize(const std::string &filename) {
|
||||
// Load user settings and workspace presets
|
||||
LoadUserSettings();
|
||||
RefreshWorkspacePresets();
|
||||
|
||||
// Initialize testing system
|
||||
InitializeTestSuites();
|
||||
|
||||
context_.shortcut_manager.RegisterShortcut(
|
||||
"Open", {ImGuiKey_O, ImGuiMod_Ctrl}, [this]() { status_ = LoadRom(); });
|
||||
@@ -360,18 +376,55 @@ void EditorManager::Initialize(const std::string &filename) {
|
||||
{absl::StrCat(ICON_MD_SPACE_DASHBOARD, " Layout"), "",
|
||||
[&]() { show_workspace_layout = true; }},
|
||||
}},
|
||||
{"Testing",
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{
|
||||
{absl::StrCat(ICON_MD_SCIENCE, " Test Dashboard"), "",
|
||||
[&]() { show_test_dashboard_ = true; }},
|
||||
{gui::kSeparator, "", nullptr, []() { return true; }},
|
||||
{absl::StrCat(ICON_MD_PLAY_ARROW, " Run All Tests"), "",
|
||||
[&]() { [[maybe_unused]] auto status = test::TestManager::Get().RunAllTests(); }},
|
||||
{absl::StrCat(ICON_MD_INTEGRATION_INSTRUCTIONS, " Run Unit Tests"), "",
|
||||
[&]() { [[maybe_unused]] auto status = test::TestManager::Get().RunTestsByCategory(test::TestCategory::kUnit); }},
|
||||
{absl::StrCat(ICON_MD_MEMORY, " Run Integration Tests"), "",
|
||||
[&]() { [[maybe_unused]] auto status = test::TestManager::Get().RunTestsByCategory(test::TestCategory::kIntegration); }},
|
||||
{absl::StrCat(ICON_MD_MOUSE, " Run UI Tests"), "",
|
||||
[&]() { [[maybe_unused]] auto status = test::TestManager::Get().RunTestsByCategory(test::TestCategory::kUI); }},
|
||||
{gui::kSeparator, "", nullptr, []() { return true; }},
|
||||
{absl::StrCat(ICON_MD_CLEAR_ALL, " Clear Results"), "",
|
||||
[&]() { test::TestManager::Get().ClearResults(); }},
|
||||
}},
|
||||
{"Help",
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{
|
||||
{absl::StrCat(ICON_MD_HELP, " How to open a ROM"), "",
|
||||
{absl::StrCat(ICON_MD_HELP, " Getting Started"), "",
|
||||
[&]() { popup_manager_->Show("Getting Started"); }},
|
||||
{absl::StrCat(ICON_MD_INTEGRATION_INSTRUCTIONS, " Asar Integration Guide"), "",
|
||||
[&]() { popup_manager_->Show("Asar Integration"); }},
|
||||
{absl::StrCat(ICON_MD_BUILD, " Build Instructions"), "",
|
||||
[&]() { popup_manager_->Show("Build Instructions"); }},
|
||||
{gui::kSeparator, "", nullptr, []() { return true; }},
|
||||
{absl::StrCat(ICON_MD_FILE_OPEN, " How to open a ROM"), "",
|
||||
[&]() { popup_manager_->Show("Open a ROM"); }},
|
||||
{absl::StrCat(ICON_MD_HELP, " Supported Features"), "",
|
||||
{absl::StrCat(ICON_MD_LIST, " Supported Features"), "",
|
||||
[&]() { popup_manager_->Show("Supported Features"); }},
|
||||
{absl::StrCat(ICON_MD_HELP, " How to manage a project"), "",
|
||||
{absl::StrCat(ICON_MD_FOLDER_OPEN, " How to manage a project"), "",
|
||||
[&]() { popup_manager_->Show("Manage Project"); }},
|
||||
{absl::StrCat(ICON_MD_HELP, " About"), "F1",
|
||||
{gui::kSeparator, "", nullptr, []() { return true; }},
|
||||
{absl::StrCat(ICON_MD_TERMINAL, " CLI Tool Usage"), "",
|
||||
[&]() { popup_manager_->Show("CLI Usage"); }},
|
||||
{absl::StrCat(ICON_MD_BUG_REPORT, " Troubleshooting"), "",
|
||||
[&]() { popup_manager_->Show("Troubleshooting"); }},
|
||||
{absl::StrCat(ICON_MD_CODE, " Contributing"), "",
|
||||
[&]() { popup_manager_->Show("Contributing"); }},
|
||||
{gui::kSeparator, "", nullptr, []() { return true; }},
|
||||
{absl::StrCat(ICON_MD_ANNOUNCEMENT, " What's New in v0.3"), "",
|
||||
[&]() { popup_manager_->Show("Whats New v03"); }},
|
||||
{absl::StrCat(ICON_MD_INFO, " About"), "F1",
|
||||
[&]() { popup_manager_->Show("About"); }},
|
||||
}}};
|
||||
}
|
||||
@@ -577,6 +630,13 @@ void EditorManager::DrawMenuBar() {
|
||||
if (show_asm_editor_ && current_editor_set_) {
|
||||
current_editor_set_->assembly_editor_.Update(show_asm_editor_);
|
||||
}
|
||||
|
||||
// Testing interface
|
||||
if (show_test_dashboard_) {
|
||||
auto& test_manager = test::TestManager::Get();
|
||||
test_manager.UpdateResourceStats(); // Update monitoring data
|
||||
test_manager.DrawTestDashboard();
|
||||
}
|
||||
|
||||
if (show_emulator_) {
|
||||
Begin("Emulator", &show_emulator_, ImGuiWindowFlags_MenuBar);
|
||||
|
||||
@@ -109,6 +109,9 @@ class EditorManager {
|
||||
absl::Status OpenRomOrProject(const std::string& filename);
|
||||
absl::Status OpenProject();
|
||||
absl::Status SaveProject();
|
||||
|
||||
// Testing system
|
||||
void InitializeTestSuites();
|
||||
|
||||
bool quit_ = false;
|
||||
bool backup_rom_ = false;
|
||||
@@ -131,6 +134,9 @@ class EditorManager {
|
||||
bool show_homepage_ = true;
|
||||
bool show_command_palette_ = false;
|
||||
bool show_global_search_ = false;
|
||||
|
||||
// Testing interface
|
||||
bool show_test_dashboard_ = false;
|
||||
|
||||
std::string version_ = "";
|
||||
std::string settings_filename_ = "settings.ini";
|
||||
|
||||
@@ -23,6 +23,15 @@ void PopupManager::Initialize() {
|
||||
popups_["Supported Features"] = {"Supported Features", false, [this]() { DrawSupportedFeaturesPopup(); }};
|
||||
popups_["Open a ROM"] = {"Open a ROM", false, [this]() { DrawOpenRomHelpPopup(); }};
|
||||
popups_["Manage Project"] = {"Manage Project", false, [this]() { DrawManageProjectPopup(); }};
|
||||
|
||||
// v0.3 Help Documentation popups
|
||||
popups_["Getting Started"] = {"Getting Started", false, [this]() { DrawGettingStartedPopup(); }};
|
||||
popups_["Asar Integration"] = {"Asar Integration", false, [this]() { DrawAsarIntegrationPopup(); }};
|
||||
popups_["Build Instructions"] = {"Build Instructions", false, [this]() { DrawBuildInstructionsPopup(); }};
|
||||
popups_["CLI Usage"] = {"CLI Usage", false, [this]() { DrawCLIUsagePopup(); }};
|
||||
popups_["Troubleshooting"] = {"Troubleshooting", false, [this]() { DrawTroubleshootingPopup(); }};
|
||||
popups_["Contributing"] = {"Contributing", false, [this]() { DrawContributingPopup(); }};
|
||||
popups_["Whats New v03"] = {"What's New in v0.3", false, [this]() { DrawWhatsNewPopup(); }};
|
||||
}
|
||||
|
||||
void PopupManager::DrawPopups() {
|
||||
@@ -239,5 +248,112 @@ void PopupManager::DrawManageProjectPopup() {
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawGettingStartedPopup() {
|
||||
TextWrapped("Welcome to YAZE v0.3!");
|
||||
TextWrapped("This software allows you to modify 'The Legend of Zelda: A Link to the Past' (US or JP) ROMs.");
|
||||
Spacing();
|
||||
TextWrapped("General Tips:");
|
||||
BulletText("Experiment flags determine whether certain features are enabled");
|
||||
BulletText("Backup files are enabled by default for safety");
|
||||
BulletText("Use File > Options to configure settings");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("Getting Started");
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawAsarIntegrationPopup() {
|
||||
TextWrapped("Asar 65816 Assembly Integration");
|
||||
TextWrapped("YAZE v0.3 includes full Asar assembler support for ROM patching.");
|
||||
Spacing();
|
||||
TextWrapped("Features:");
|
||||
BulletText("Cross-platform ROM patching with assembly code");
|
||||
BulletText("Symbol extraction with addresses and opcodes");
|
||||
BulletText("Assembly validation with error reporting");
|
||||
BulletText("Memory-safe operations with automatic ROM size management");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("Asar Integration");
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawBuildInstructionsPopup() {
|
||||
TextWrapped("Build Instructions");
|
||||
TextWrapped("YAZE uses modern CMake for cross-platform builds.");
|
||||
Spacing();
|
||||
TextWrapped("Quick Start:");
|
||||
BulletText("cmake -B build");
|
||||
BulletText("cmake --build build --target yaze");
|
||||
Spacing();
|
||||
TextWrapped("Development:");
|
||||
BulletText("cmake --preset dev");
|
||||
BulletText("cmake --build --preset dev");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("Build Instructions");
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawCLIUsagePopup() {
|
||||
TextWrapped("Command Line Interface (z3ed)");
|
||||
TextWrapped("Enhanced CLI tool with Asar integration.");
|
||||
Spacing();
|
||||
TextWrapped("Commands:");
|
||||
BulletText("z3ed asar patch.asm --rom=file.sfc");
|
||||
BulletText("z3ed extract symbols.asm");
|
||||
BulletText("z3ed validate assembly.asm");
|
||||
BulletText("z3ed patch file.bps --rom=file.sfc");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("CLI Usage");
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawTroubleshootingPopup() {
|
||||
TextWrapped("Troubleshooting");
|
||||
TextWrapped("Common issues and solutions:");
|
||||
Spacing();
|
||||
BulletText("ROM won't load: Check file format (SFC/SMC supported)");
|
||||
BulletText("Graphics issues: Try disabling experimental features");
|
||||
BulletText("Performance: Enable hardware acceleration in display settings");
|
||||
BulletText("Crashes: Check ROM file integrity and available memory");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("Troubleshooting");
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawContributingPopup() {
|
||||
TextWrapped("Contributing to YAZE");
|
||||
TextWrapped("YAZE is open source and welcomes contributions!");
|
||||
Spacing();
|
||||
TextWrapped("How to contribute:");
|
||||
BulletText("Fork the repository on GitHub");
|
||||
BulletText("Create feature branches for new work");
|
||||
BulletText("Follow C++ coding standards");
|
||||
BulletText("Include tests for new features");
|
||||
BulletText("Submit pull requests for review");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("Contributing");
|
||||
}
|
||||
}
|
||||
|
||||
void PopupManager::DrawWhatsNewPopup() {
|
||||
TextWrapped("What's New in YAZE v0.3");
|
||||
Spacing();
|
||||
TextWrapped("New Features:");
|
||||
BulletText("Asar 65816 assembler integration");
|
||||
BulletText("Enhanced CLI tools with TUI interface");
|
||||
BulletText("Modernized build system with CMake presets");
|
||||
BulletText("Optimized CI/CD pipeline");
|
||||
BulletText("Integrated testing framework");
|
||||
BulletText("Professional packaging for all platforms");
|
||||
|
||||
if (Button("Close", gui::kDefaultModalSize)) {
|
||||
Hide("Whats New v03");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace yaze
|
||||
|
||||
@@ -73,6 +73,15 @@ class PopupManager {
|
||||
// Draw the manage project popup
|
||||
void DrawManageProjectPopup();
|
||||
|
||||
// v0.3 Help Documentation popups
|
||||
void DrawGettingStartedPopup();
|
||||
void DrawAsarIntegrationPopup();
|
||||
void DrawBuildInstructionsPopup();
|
||||
void DrawCLIUsagePopup();
|
||||
void DrawTroubleshootingPopup();
|
||||
void DrawContributingPopup();
|
||||
void DrawWhatsNewPopup();
|
||||
|
||||
EditorManager* editor_manager_;
|
||||
std::unordered_map<std::string, PopupParams> popups_;
|
||||
absl::Status status_;
|
||||
|
||||
Reference in New Issue
Block a user