import pytest from typing import Any import sys import os import importlib.util # Ensure project root is in path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) # Load gui_2.py spec = importlib.util.spec_from_file_location("gui_2", "gui_2.py") gui_2 = importlib.util.module_from_spec(spec) sys.modules["gui_2"] = gui_2 spec.loader.exec_module(gui_2) from gui_2 import App def test_new_hubs_defined_in_show_windows() -> None: """ Verifies that the new consolidated Hub windows are defined in the App's show_windows. This ensures they will be available in the 'Windows' menu. """ # We don't need a full App instance with ImGui context for this, # as show_windows is initialized in __init__. from unittest.mock import patch with patch('gui_2.load_config', return_value={}): app = App() expected_hubs = [ "Context Hub", "AI Settings", "Discussion Hub", "Operations Hub", ] for hub in expected_hubs: assert hub in app.show_windows, f"Expected window {hub} not found in show_windows" def test_old_windows_removed_from_gui2(app_instance_simple: Any) -> None: """ Verifies that the old fragmented windows are removed or renamed. """ old_tags = [ "win_projects", "win_files", "win_screenshots", "win_provider", "win_system_prompts", "win_discussion", "win_message", "win_response", "win_comms", "win_tool_log" ] for tag in old_tags: # gui_2 doesn't use these tags at all in show_windows assert tag not in app_instance_simple.show_windows, f"Old window tag {tag} should not be in show_windows" @pytest.fixture def app_instance_simple() -> Any: from unittest.mock import patch from gui_2 import App with patch('gui_2.load_config', return_value={}): app = App() return app def test_hub_windows_exist_in_gui2(app_instance_simple: Any) -> None: """ Verifies that the new Hub windows are present in the show_windows dictionary. """ hubs = ["Context Hub", "AI Settings", "Discussion Hub", "Operations Hub"] for hub in hubs: assert hub in app_instance_simple.show_windows def test_indicators_logic_exists(app_instance_simple: Any) -> None: """ Verifies that the status indicators logic exists in the App. """ assert hasattr(app_instance_simple, 'ai_status') assert hasattr(app_instance_simple, 'mma_status')