fix: apply clang-format and exclude third-party libraries from formatting checks

- Applied clang-format to fix formatting violations in TUI and other source files
- Updated CMakeLists.txt to exclude src/lib/* from format targets to prevent third-party library violations
- Fixes clang-format violations in chat_tui.cc, tui.cc, and unified_layout.cc
- All source files now pass format-check target

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
scawful
2025-11-20 03:30:56 -05:00
parent 43a0e5e314
commit bb5e2002c2
433 changed files with 3092 additions and 4123 deletions

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <chrono>
#include <random>
#include <vector>

View File

@@ -1,5 +1,6 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#include "e2e/canvas_selection_test.h"
#include "app/controller.h"
#include "test_utils.h"
@@ -50,8 +51,8 @@ void E2ETest_CanvasSelectionTest(ImGuiTestContext* ctx) {
uint16_t new_tile3 = overworld->GetTile(75, 38);
uint16_t new_tile4 = overworld->GetTile(76, 38);
// The bug is that the selection wraps around, so the pasted tiles are incorrect.
// We expect the new tiles to be different from the original tiles.
// The bug is that the selection wraps around, so the pasted tiles are
// incorrect. We expect the new tiles to be different from the original tiles.
IM_CHECK_NE(orig_tile1, new_tile1);
IM_CHECK_NE(orig_tile2, new_tile2);
IM_CHECK_NE(orig_tile3, new_tile3);

View File

@@ -1,11 +1,12 @@
#include "e2e/dungeon_editor_smoke_test.h"
#include "app/controller.h"
#include "imgui_test_engine/imgui_te_context.h"
#include "test_utils.h"
/**
* @brief Quick smoke test for DungeonEditorV2
*
*
* Tests the card-based architecture:
* - Independent windows (cards) can be opened/closed
* - Room cards function correctly

View File

@@ -5,7 +5,7 @@
/**
* @brief Quick smoke test for DungeonEditorV2 card-based UI
*
*
* Tests basic functionality:
* - Opening dungeon editor
* - Opening independent cards (Rooms, Matrix, Objects, etc.)

View File

@@ -1,30 +1,32 @@
/**
* @file dungeon_object_rendering_e2e_tests.cc
* @brief End-to-end tests for dungeon object rendering system using imgui test engine
*
* These tests orchestrate complete user workflows for the dungeon editor, validating:
* @brief End-to-end tests for dungeon object rendering system using imgui test
* engine
*
* These tests orchestrate complete user workflows for the dungeon editor,
* validating:
* - Object browser and selection
* - Object placement on canvas
* - Object manipulation (move, delete, edit)
* - Layer management
* - Save/load workflows
* - Rendering quality across different scenarios
*
*
* Created: October 4, 2025
* Related: docs/dungeon_editing_implementation_plan.md
*
*
* ============================================================================
* UPDATE NOTICE (October 2025): Tests need rewrite for DungeonEditorV2
* ============================================================================
*
*
* These tests were written for the old monolithic DungeonEditor but need to be
* updated for the new DungeonEditorV2 card-based architecture:
*
*
* OLD ARCHITECTURE:
* - Single "Dungeon Editor" window with tabs
* - Object Selector, Canvas, Layers all in one window
* - Monolithic UI structure
*
*
* NEW ARCHITECTURE (DungeonEditorV2):
* - Independent EditorCard windows:
* - "Dungeon Controls" - main control panel
@@ -35,14 +37,14 @@
* - Individual room cards (e.g., "Room 0x00###RoomCard0")
* - Per-room layer visibility settings
* - Dockable, closable independent windows
*
*
* REQUIRED UPDATES:
* 1. Change window references from "Dungeon Editor" to appropriate card names
* 2. Update tab navigation to card window focus
* 3. Update object placement workflow for new ObjectEditorCard
* 4. Update layer controls for per-room settings
* 5. Update room selection to work with new room cards
*
*
* Current Status: Tests compile but may fail due to UI structure changes.
* See: test/e2e/dungeon_editor_smoke_test.cc for updated test patterns.
*/
@@ -51,15 +53,14 @@
#include <gtest/gtest.h>
#include "imgui.h"
#include "imgui_test_engine/imgui_te_context.h"
#include "imgui_test_engine/imgui_te_engine.h"
#include "imgui_test_engine/imgui_te_ui.h"
#include "app/controller.h"
#include "app/editor/dungeon/dungeon_editor_v2.h"
#include "app/platform/window.h"
#include "app/rom.h"
#include "imgui.h"
#include "imgui_test_engine/imgui_te_context.h"
#include "imgui_test_engine/imgui_te_engine.h"
#include "imgui_test_engine/imgui_te_ui.h"
#include "test_utils.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/dungeon/room_object.h"
@@ -129,7 +130,7 @@ class DungeonObjectRenderingE2ETests : public TestRomManager::BoundRomTest {
/**
* @brief Test: Navigate object browser categories
*
*
* Validates:
* - Tab navigation works
* - Each category displays objects
@@ -173,7 +174,7 @@ void DungeonObjectRenderingE2ETests::RegisterObjectBrowserTests() {
/**
* @brief Test: Select object from browser
*
*
* Validates:
* - Object can be selected by clicking
* - Preview updates when object selected
@@ -216,7 +217,7 @@ void RegisterObjectBrowserTests_SelectObject(
/**
* @brief Test: Search and filter objects
*
*
* Validates:
* - Search box filters object list
* - Filtering by ID works
@@ -259,7 +260,7 @@ void RegisterObjectBrowserTests_SearchFilter(
/**
* @brief Test: Place object on canvas with mouse click
*
*
* Validates:
* - Object preview follows mouse cursor
* - Click places object at correct position
@@ -314,7 +315,7 @@ void DungeonObjectRenderingE2ETests::RegisterObjectPlacementTests() {
/**
* @brief Test: Place object with snap to grid
*
*
* Validates:
* - Snap to grid option works
* - Object positions align to grid
@@ -359,7 +360,7 @@ void RegisterObjectPlacementTests_SnapToGrid(
/**
* @brief Test: Place multiple objects sequentially
*
*
* Validates:
* - Multiple objects can be placed
* - Each placement is independent
@@ -407,7 +408,7 @@ void RegisterObjectPlacementTests_MultipleObjects(
/**
* @brief Test: Select object by clicking on canvas
*
*
* Validates:
* - Click on object selects it
* - Selection highlight appears
@@ -449,7 +450,7 @@ void DungeonObjectRenderingE2ETests::RegisterObjectSelectionTests() {
/**
* @brief Test: Multi-select objects with Ctrl+drag
*
*
* Validates:
* - Ctrl+drag creates selection box
* - All objects in box are selected
@@ -498,7 +499,7 @@ void RegisterObjectSelectionTests_MultiSelect(
/**
* @brief Test: Move selected object with drag
*
*
* Validates:
* - Selected object can be dragged
* - Object position updates during drag
@@ -545,7 +546,7 @@ void RegisterObjectSelectionTests_MoveObject(
/**
* @brief Test: Delete selected object
*
*
* Validates:
* - Delete key removes selected object
* - Object no longer in room list
@@ -594,7 +595,7 @@ void RegisterObjectSelectionTests_DeleteObject(
/**
* @brief Test: Toggle layer visibility
*
*
* Validates:
* - Layer visibility checkboxes work
* - Hidden layers don't render
@@ -632,7 +633,7 @@ void DungeonObjectRenderingE2ETests::RegisterLayerManagementTests() {
/**
* @brief Test: Place objects on different layers
*
*
* Validates:
* - Active layer can be changed
* - Objects placed on correct layer
@@ -694,7 +695,7 @@ void RegisterLayerManagementTests_PlaceOnLayers(
/**
* @brief Test: Layer rendering order
*
*
* Validates:
* - Layers render in correct order (BG1 < BG2 < BG3)
* - Overlapping objects render correctly
@@ -748,7 +749,7 @@ void RegisterLayerManagementTests_RenderingOrder(
/**
* @brief Test: Save room with objects
*
*
* Validates:
* - Objects can be saved to ROM
* - Save operation succeeds
@@ -789,7 +790,7 @@ void DungeonObjectRenderingE2ETests::RegisterSaveWorkflowTests() {
/**
* @brief Test: Save and reload room (round-trip)
*
*
* Validates:
* - Objects persist after save/reload
* - Object properties are preserved
@@ -844,7 +845,7 @@ void RegisterSaveWorkflowTests_RoundTrip(DungeonObjectRenderingE2ETests* self) {
/**
* @brief Test: Save with multiple object types
*
*
* Validates:
* - Type1, Type2, Type3 objects all save correctly
* - Encoding is correct for each type
@@ -909,7 +910,7 @@ void RegisterSaveWorkflowTests_MultipleTypes(
/**
* @brief Test: Render all object types correctly
*
*
* Validates:
* - Type1 objects render
* - Type2 objects render
@@ -959,7 +960,7 @@ void DungeonObjectRenderingE2ETests::RegisterRenderingQualityTests() {
/**
* @brief Test: Render with different palettes
*
*
* Validates:
* - Palette switching works
* - Objects render with correct colors
@@ -1005,7 +1006,7 @@ void RegisterRenderingQualityTests_Palettes(
/**
* @brief Test: Complex room scenario rendering
*
*
* Validates:
* - Many objects render correctly
* - Performance is acceptable
@@ -1073,7 +1074,7 @@ void RegisterRenderingQualityTests_ComplexRoom(
/**
* @brief Test: Large room with many objects performance
*
*
* Validates:
* - Rendering stays performant with 100+ objects
* - Frame time stays below threshold

View File

@@ -1,4 +1,5 @@
#include "e2e/framework_smoke_test.h"
#include "imgui.h"
#include "imgui_test_engine/imgui_te_context.h"
#include "test_utils.h"

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <filesystem>
#include <memory>
#include <string>
@@ -14,7 +15,7 @@ namespace test {
/**
* @brief Comprehensive End-to-End Overworld Test Suite
*
*
* This test suite validates the complete overworld editing workflow:
* 1. Load vanilla ROM and extract golden data
* 2. Apply ZSCustomOverworld ASM patches
@@ -82,15 +83,12 @@ class OverworldE2ETest : public ::testing::Test {
// For now, we'll do basic validation
// Check basic ROM properties
if (rom.title().empty())
return false;
if (rom.size() < 1024 * 1024)
return false; // At least 1MB
if (rom.title().empty()) return false;
if (rom.size() < 1024 * 1024) return false; // At least 1MB
// Check ASM version
auto asm_version = rom.ReadByte(0x140145);
if (!asm_version.ok())
return false;
if (!asm_version.ok()) return false;
return true;
}
@@ -396,7 +394,8 @@ TEST_F(OverworldE2ETest, RomDependentTestSuiteIntegration) {
EXPECT_LE(map.area_size(), zelda3::AreaSizeEnum::TallArea);
}
// Test that sprite data is accessible (matches RomDependentTestSuite expectations)
// Test that sprite data is accessible (matches RomDependentTestSuite
// expectations)
const auto& sprites = overworld.all_sprites();
EXPECT_EQ(sprites.size(), 3); // Three game states

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <filesystem>
#include <fstream>
#include <memory>
@@ -14,7 +15,7 @@ namespace test {
/**
* @brief Comprehensive End-to-End ROM testing suite
*
*
* This test suite validates the complete ROM editing workflow:
* 1. Load vanilla ROM
* 2. Apply various edits (ROM data, graphics, etc.)

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <filesystem>
#include <map>
#include <memory>
@@ -13,7 +14,7 @@ namespace test {
/**
* @brief ZSCustomOverworld upgrade testing suite
*
*
* This test suite validates ZSCustomOverworld version upgrades:
* 1. Vanilla -> v2 upgrade with proper address changes
* 2. v2 -> v3 upgrade with expanded features

View File

@@ -1,9 +1,8 @@
#include "gtest/gtest.h"
#include "absl/strings/str_format.h"
#include "cli/service/ai/ai_action_parser.h"
#include "cli/service/ai/ai_gui_controller.h"
#include "cli/service/ai/vision_action_refiner.h"
#include "gtest/gtest.h"
#ifdef YAZE_WITH_GRPC
#include "cli/service/ai/gemini_ai_service.h"
@@ -15,7 +14,7 @@ namespace test {
/**
* @brief Integration tests for AI-controlled tile placement
*
*
* These tests verify the complete pipeline:
* 1. Parse natural language commands
* 2. Execute actions via gRPC

View File

@@ -1,4 +1,6 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <filesystem>
#include <fstream>
@@ -7,9 +9,6 @@
#include "core/asar_wrapper.h"
#include "testing.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
namespace yaze {
namespace test {
namespace integration {

View File

@@ -4,6 +4,7 @@
#endif
#include <gtest/gtest.h>
#include <filesystem>
#include <fstream>
@@ -330,7 +331,8 @@ TEST_F(AsarRomIntegrationTest, GameplayModificationPatch) {
// Check health modification at 0x7EF36C -> ROM offset would need calculation
// For a proper test, we'd need to convert SNES addresses to ROM offsets
// Check if custom routine was inserted at 0xC000 -> ROM offset 0x18000 (in LoROM)
// Check if custom routine was inserted at 0xC000 -> ROM offset 0x18000 (in
// LoROM)
const uint32_t rom_offset = 0x18000; // Bank $00:C000 in LoROM
if (rom_offset < rom_copy.size()) {
// Check for SEP #$20 instruction (0xE2 0x20)

View File

@@ -14,7 +14,7 @@ namespace test {
/**
* @brief Integration test framework using real ROM data
*
*
* Updated for DungeonEditorV2 with card-based architecture
*/
class DungeonEditorIntegrationTest : public ::testing::Test {

View File

@@ -13,7 +13,7 @@ namespace test {
/**
* @brief Integration test framework for DungeonEditorV2
*
*
* Tests the simplified component delegation architecture
*/
class DungeonEditorV2IntegrationTest : public ::testing::Test {

View File

@@ -21,12 +21,14 @@ namespace test {
/**
* @class EditorIntegrationTest
* @brief Base class for editor integration tests
*
* This class provides common functionality for testing editors in the application.
* It sets up the test environment and provides helper methods for ROM operations.
*
* For UI interaction testing, use the ImGui test engine API directly within your test functions:
*
*
* This class provides common functionality for testing editors in the
* application. It sets up the test environment and provides helper methods for
* ROM operations.
*
* For UI interaction testing, use the ImGui test engine API directly within
* your test functions:
*
* ImGuiTest* test = IM_REGISTER_TEST(engine, "test_suite", "test_name");
* test->TestFunc = [](ImGuiTestContext* ctx) {
* ctx->SetRef("Window Name");

View File

@@ -1,10 +1,11 @@
#include "app/editor/overworld/tile16_editor.h"
#include <gtest/gtest.h>
#include <iostream>
#include <memory>
#include <vector>
#include <gtest/gtest.h>
#include "app/gfx/backend/sdl2_renderer.h"
#include "app/gfx/core/bitmap.h"
#include "app/gfx/render/tilemap.h"

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <chrono>
#include <map>
#include <memory>

View File

@@ -1,16 +1,13 @@
// Integration tests for dungeon object rendering using ObjectDrawer
// Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production system)
// instead of the obsolete ObjectRenderer
// Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production
// system) instead of the obsolete ObjectRenderer
#ifndef IMGUI_DEFINE_MATH_OPERATORS
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include "zelda3/dungeon/object_drawer.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/dungeon/room_object.h"
#include <gtest/gtest.h>
#include <chrono>
#include <memory>
#include <vector>
@@ -20,13 +17,16 @@
#include "app/rom.h"
#include "test_utils.h"
#include "testing.h"
#include "zelda3/dungeon/object_drawer.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/dungeon/room_object.h"
namespace yaze {
namespace test {
/**
* @brief Tests for ObjectDrawer with realistic dungeon scenarios
*
*
* These tests validate that ObjectDrawer correctly renders dungeon objects
* to BackgroundBuffers using pattern-based drawing routines.
*/

View File

@@ -1,12 +1,9 @@
// Integration tests for dungeon object rendering using ObjectDrawer
// Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production system)
// instead of the obsolete ObjectRenderer
#include "zelda3/dungeon/object_drawer.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/dungeon/room_object.h"
// Updated for DungeonEditorV2 architecture - uses ObjectDrawer (production
// system) instead of the obsolete ObjectRenderer
#include <gtest/gtest.h>
#include <chrono>
#include <memory>
#include <vector>
@@ -16,13 +13,16 @@
#include "app/rom.h"
#include "test_utils.h"
#include "testing.h"
#include "zelda3/dungeon/object_drawer.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/dungeon/room_object.h"
namespace yaze {
namespace test {
/**
* @brief Tests for ObjectDrawer with realistic dungeon scenarios
*
*
* These tests validate that ObjectDrawer correctly renders dungeon objects
* to BackgroundBuffers using pattern-based drawing routines.
*/

View File

@@ -1,9 +1,8 @@
#include "gtest/gtest.h"
#include "absl/status/status.h"
#include "app/gfx/background_buffer.h"
#include "app/gfx/snes_palette.h"
#include "app/rom.h"
#include "gtest/gtest.h"
#include "zelda3/dungeon/object_drawer.h"
#include "zelda3/dungeon/object_parser.h"
#include "zelda3/dungeon/room.h"

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <filesystem>
#include "app/editor/message/message_data.h"
@@ -211,7 +212,8 @@ TEST_F(MessageRomTest, BuildDictionaryEntries_CorrectSize) {
TEST_F(MessageRomTest, ParseMessageData_CommandWithArgument_NoExtraCharacters) {
// This test specifically checks for the bug where command arguments
// were being incorrectly parsed as characters (e.g., capital 'A' after [W])
// The bug was caused by using a range-based for loop while also tracking position
// The bug was caused by using a range-based for loop while also tracking
// position
// Message: [W:01]ABC
// Bytes: 0x6B (W command), 0x01 (argument), 0x00 (A), 0x01 (B), 0x02 (C)

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <filesystem>
#include <memory>
#include <string>
@@ -13,9 +14,10 @@ namespace yaze {
namespace zelda3 {
/**
* @brief Comprehensive overworld integration test that validates YAZE C++
* implementation against ZScream C# logic and existing test infrastructure
*
* @brief Comprehensive overworld integration test that validates YAZE C++
* implementation against ZScream C# logic and existing test
* infrastructure
*
* This test suite:
* 1. Validates overworld loading logic matches ZScream behavior
* 2. Tests integration with ZSCustomOverworld versions (vanilla, v2, v3)
@@ -78,7 +80,8 @@ class OverworldIntegrationTest : public ::testing::Test {
mock_rom_data_[0x012844 + i] = 0x00; // Small areas
}
// Setup entrance data (matches ZScream Constants.OWEntranceMap/Pos/EntranceId)
// Setup entrance data (matches ZScream
// Constants.OWEntranceMap/Pos/EntranceId)
for (int i = 0; i < 129; i++) {
mock_rom_data_[0x0DB96F + (i * 2)] = i & 0xFF; // Map ID
mock_rom_data_[0x0DB96F + (i * 2) + 1] = (i >> 8) & 0xFF;
@@ -267,7 +270,8 @@ TEST_F(OverworldIntegrationTest, RomDependentTestSuiteCompatibility) {
<< "Real ROM required for RomDependentTestSuite compatibility testing";
}
// Test that our overworld loading works with the same patterns as RomDependentTestSuite
// Test that our overworld loading works with the same patterns as
// RomDependentTestSuite
auto status = overworld_->Load(rom_.get());
ASSERT_TRUE(status.ok());
@@ -288,7 +292,8 @@ TEST_F(OverworldIntegrationTest, RomDependentTestSuiteCompatibility) {
EXPECT_LE(map.area_size(), AreaSizeEnum::TallArea);
}
// Test that sprite data is accessible (matches RomDependentTestSuite expectations)
// Test that sprite data is accessible (matches RomDependentTestSuite
// expectations)
const auto& sprites = overworld_->sprites(0);
EXPECT_EQ(sprites.size(), 3); // Three game states
@@ -359,8 +364,8 @@ TEST_F(OverworldIntegrationTest, ZScreamCoordinateCompatibility) {
// int p = mapPos >> 1;
// int x = p % 64;
// int y = p >> 6;
// int real_x = (x * 16) + (((mapId % 64) - (((mapId % 64) / 8) * 8)) * 512);
// int real_y = (y * 16) + (((mapId % 64) / 8) * 512);
// int real_x = (x * 16) + (((mapId % 64) - (((mapId % 64) / 8) * 8)) *
// 512); int real_y = (y * 16) + (((mapId % 64) / 8) * 512);
uint16_t map_pos = entrance.map_pos_;
uint16_t map_id = entrance.map_id_;
@@ -387,8 +392,8 @@ TEST_F(OverworldIntegrationTest, ZScreamCoordinateCompatibility) {
// int p = (mapPos + 0x400) >> 1;
// int x = p % 64;
// int y = p >> 6;
// int real_x = (x * 16) + (((mapId % 64) - (((mapId % 64) / 8) * 8)) * 512);
// int real_y = (y * 16) + (((mapId % 64) / 8) * 512);
// int real_x = (x * 16) + (((mapId % 64) - (((mapId % 64) / 8) * 8)) *
// 512); int real_y = (y * 16) + (((mapId % 64) / 8) * 512);
uint16_t map_pos = hole.map_pos_;
uint16_t map_id = hole.map_id_;

View File

@@ -277,8 +277,7 @@ TEST_F(RoomIntegrationTest, BinaryDataExactMatch) {
break;
}
}
if (might_be_final)
break;
if (might_be_final) break;
}
}
@@ -319,12 +318,9 @@ TEST_F(RoomIntegrationTest, KnownRoomData) {
bool found_layer1 = false;
for (const auto& obj : objects) {
if (obj.id_ < 0x100)
found_type1 = true;
if (obj.GetLayerValue() == 0)
found_layer0 = true;
if (obj.GetLayerValue() == 1)
found_layer1 = true;
if (obj.id_ < 0x100) found_type1 = true;
if (obj.GetLayerValue() == 0) found_layer0 = true;
if (obj.GetLayerValue() == 1) found_layer1 = true;
}
EXPECT_TRUE(found_type1) << "Should have Type 1 objects";

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <fstream>
#include <iomanip>
#include <iostream>
@@ -125,7 +126,6 @@ TEST_F(SpritePositionTest, MapCoordinateCalculations) {
if (!sprite.deleted() &&
sprite.map_id() < 0x40 + (current_world * 0x40) &&
sprite.map_id() >= (current_world * 0x40)) {
// Calculate map position
int sprite_map_id = sprite.map_id();
int local_map_index = sprite_map_id - (current_world * 0x40);

View File

@@ -4,16 +4,16 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "testing.h"
#include "app/rom.h"
#include "testing.h"
namespace yaze {
namespace test {
/**
* @brief Enhanced ROM for testing that behaves like a real ROM but with test data
*
* @brief Enhanced ROM for testing that behaves like a real ROM but with test
* data
*
* This class extends Rom to provide testing utilities while maintaining
* all the real ROM functionality. Instead of mocking methods, it loads
* real test data into the ROM.

View File

@@ -1,4 +1,5 @@
#include <iostream>
#include "app/rom.h"
#include "cli/service/agent/conversational_agent_service.h"
#include "cli/service/ai/service_factory.h"

View File

@@ -1,4 +1,5 @@
#include "test_utils.h"
#include "app/controller.h"
namespace yaze {

View File

@@ -5,15 +5,15 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#endif
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "absl/strings/str_format.h"
#include "app/rom.h"
#include "imgui_test_engine/imgui_te_context.h"

View File

@@ -23,9 +23,7 @@ namespace test {
// StatusIs is a matcher that matches a status that has the same code and
// message as the expected status.
MATCHER_P(StatusIs, status, "") {
return arg.code() == status;
}
MATCHER_P(StatusIs, status, "") { return arg.code() == status; }
// Support for testing absl::StatusOr.
template <typename T>
@@ -42,9 +40,7 @@ template <typename T>
return ::testing::AssertionSuccess();
}
MATCHER_P(IsOkAndHolds, value, "") {
return IsOkAndHolds(arg, value);
}
MATCHER_P(IsOkAndHolds, value, "") { return IsOkAndHolds(arg, value); }
// Helper to test if a StatusOr contains an error with a specific message
MATCHER_P(StatusIsWithMessage, message, "") {

View File

@@ -1,11 +1,13 @@
#include "core/asar_wrapper.h"
#include "test_utils.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <filesystem>
#include <fstream>
#include "test_utils.h"
namespace yaze {
namespace core {
namespace {

View File

@@ -1,7 +1,7 @@
#include "testing.h"
#include "util/hex.h"
#include "testing.h"
namespace yaze {
namespace test {

View File

@@ -43,8 +43,9 @@ TEST(SnesTileTest, UnpackBppTile) {
EXPECT_EQ(tile2bpp.data[63], 3); // Last pixel: 1|1<<1 = 3
// Test 4bpp tile unpacking
// According to SnesLab: First planes 1&2 intertwined, then planes 3&4 intertwined
// 32 bytes total: 16 bytes for planes 1&2, then 16 bytes for planes 3&4
// According to SnesLab: First planes 1&2 intertwined, then planes 3&4
// intertwined 32 bytes total: 16 bytes for planes 1&2, then 16 bytes for
// planes 3&4
std::vector<uint8_t> data4bpp = {
// Planes 1&2 intertwined (rows 0-7)
0x81, 0x80, // Row 0: bp1=10000001, bp2=10000000

View File

@@ -316,7 +316,8 @@ TEST_F(CanvasAutomationAPITest, CenterOn_ValidTile) {
api_->CenterOn(0, 0);
api_->CenterOn(20, 20);
// Verify scroll position changed (should be non-zero after centering on non-origin)
// Verify scroll position changed (should be non-zero after centering on
// non-origin)
ImVec2 scroll = canvas_->scrolling();
// Scroll values will depend on canvas size, just verify they're set
}

View File

@@ -1,8 +1,7 @@
#include "app/gui/canvas/canvas.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "app/gui/canvas/canvas.h"
#include "testing.h"
namespace yaze {
@@ -150,8 +149,8 @@ TEST_F(CanvasCoordinateSyncTest, MapCalculation_LargeMaps) {
// ============================================================================
TEST_F(CanvasCoordinateSyncTest, HoverPosition_ScaleInvariant) {
// REGRESSION TEST: Hover position should be in world space regardless of scale
// The bug was scale-dependent because it used screen coordinates
// REGRESSION TEST: Hover position should be in world space regardless of
// scale The bug was scale-dependent because it used screen coordinates
auto test_hover_at_scale = [&](float scale) {
canvas_->set_global_scale(scale);
@@ -184,7 +183,8 @@ TEST_F(CanvasCoordinateSyncTest, OverworldMapHighlight_UsesHoverNotDrawn) {
// The pattern used in DrawOverworldEdits (line 664) for painting:
auto drawn_pos = canvas_->drawn_tile_position();
// The pattern that SHOULD be used in CheckForCurrentMap (line 1041) for highlighting:
// The pattern that SHOULD be used in CheckForCurrentMap (line 1041) for
// highlighting:
auto hover_pos = canvas_->hover_mouse_pos();
// These are different methods for different purposes:

View File

@@ -196,7 +196,8 @@ TEST_F(RomTest, SaveTruncatesExistingFile) {
#if defined(__linux__)
GTEST_SKIP();
#endif
// Prepare ROM data and save to a temp file twice; second save should overwrite, not append
// Prepare ROM data and save to a temp file twice; second save should
// overwrite, not append
EXPECT_OK(rom_.LoadFromData(kMockRomData, /*z3_load=*/false));
const char* tmp_name = "test_temp_rom.sfc";
@@ -211,7 +212,8 @@ TEST_F(RomTest, SaveTruncatesExistingFile) {
EXPECT_OK(rom_.WriteByte(0, 0xEE));
EXPECT_OK(rom_.SaveToFile(settings));
// Load the saved file and verify size equals original data size and first byte matches
// Load the saved file and verify size equals original data size and first
// byte matches
Rom verify;
EXPECT_OK(verify.LoadFromFile(tmp_name, /*z3_load=*/false));
EXPECT_EQ(verify.size(), kMockRomData.size());

View File

@@ -1,9 +1,8 @@
#include "gtest/gtest.h"
#include "absl/status/status.h"
#include "app/gfx/background_buffer.h"
#include "app/gfx/snes_palette.h"
#include "app/rom.h"
#include "gtest/gtest.h"
#include "zelda3/dungeon/object_drawer.h"
#include "zelda3/dungeon/object_parser.h"
#include "zelda3/dungeon/room_object.h"

View File

@@ -1,6 +1,7 @@
// Tests for Room object manipulation methods (Phase 3)
#include <gtest/gtest.h>
#include "app/rom.h"
#include "zelda3/dungeon/room.h"
#include "zelda3/dungeon/room_object.h"

View File

@@ -5,10 +5,10 @@
// correctly for all three object types (Type1, Type2, Type3) based on
// ZScream's proven implementation.
#include "zelda3/dungeon/room_object.h"
#include <gtest/gtest.h>
#include "zelda3/dungeon/room_object.h"
namespace yaze {
namespace zelda3 {
namespace {

View File

@@ -1,4 +1,5 @@
#include <gtest/gtest.h>
#include <memory>
// Test the individual components independently
@@ -10,7 +11,7 @@ namespace test {
/**
* @brief Unit tests for individual dungeon components
*
*
* These tests validate component behavior without requiring ROM files
* or complex graphics initialization.
*/

View File

@@ -1,6 +1,5 @@
#include "zelda3/dungeon/object_parser.h"
#include "gtest/gtest.h"
#include "zelda3/dungeon/object_parser.h"
namespace yaze {
namespace test {

View File

@@ -1,8 +1,10 @@
#include "zelda3/overworld/overworld.h"
#include <gtest/gtest.h>
#include <memory>
#include "app/rom.h"
#include "zelda3/overworld/overworld.h"
#include "zelda3/overworld/overworld_map.h"
namespace yaze {

View File

@@ -14,7 +14,7 @@ namespace test {
/**
* @brief Simplified test framework for dungeon object rendering
*
*
* This provides a clean, focused testing environment for dungeon object
* functionality without the complexity of full integration tests.
*/

View File

@@ -7,6 +7,7 @@
#include <SDL.h>
#include <gtest/gtest.h>
#include <cstdlib>
#include <iostream>
#include <string>
@@ -219,8 +220,7 @@ void ConfigureTestFilters(const TestConfig& config) {
if (!filters.empty()) {
std::string filter_string;
for (size_t i = 0; i < filters.size(); i++) {
if (i > 0)
filter_string += ":";
if (i > 0) filter_string += ":";
filter_string += filters[i];
}
@@ -284,12 +284,14 @@ int main(int argc, char* argv[]) {
ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
io.ConfigFlags |=
ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform
// Windows
// Setup Dear ImGui style
ImGui::StyleColorsDark();
// When viewports are enabled we tweak WindowRounding/WindowBg so platform windows can look identical to regular ones.
// When viewports are enabled we tweak WindowRounding/WindowBg so platform
// windows can look identical to regular ones.
ImGuiStyle& style = ImGui::GetStyle();
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
style.WindowRounding = 0.0f;

View File

@@ -3,6 +3,7 @@
// to ensure reliable test discovery and execution in automated environments
#include <gtest/gtest.h>
#include <iostream>
#include "absl/debugging/failure_signal_handler.h"