Private
Public Access
0
0
Files
manual_slop/tests/test_gui_v2_monolithic_width.py
T
ed 8f6f47d46b fix(gui): Final monolithic stabilization pass
- Restore monolithic architecture in gui_2.py to fix test breakages and circular imports.
- Update Text Viewer stable ID to '###Text_Viewer_Unified' to definitively fix docking conflicts.
- Refactor discussion entry renderer to force full-width horizontal expansion for Markdown.
- Fully restore theme_2.py definitions (palettes, fonts, scale) while retaining role-tint logic.
- Robustify ImGui ID stack in imgui_scopes.py to prevent access violations.
- Verify all fixes with the comprehensive unit and visual test suite.
2026-06-02 17:30:46 -04:00

46 lines
1.6 KiB
Python

import unittest
from unittest.mock import MagicMock, patch
import sys
import os
# Ensure project root is in path
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if project_root not in sys.path:
sys.path.insert(0, project_root)
class TestMonolithicLayout(unittest.TestCase):
def test_render_discussion_entry_full_width_logic(self):
"""Verify that render_discussion_entry uses full width and a newline."""
with patch('src.gui_2.imgui') as mock_imgui, \
patch('src.gui_2.imscope') as mock_imscope, \
patch('src.gui_2.theme') as mock_theme, \
patch('src.gui_2.project_manager') as mock_pm, \
patch('src.gui_2.render_thinking_trace') as mock_rtt, \
patch('src.gui_2.render_discussion_entry_read_mode') as mock_rderm:
expected_width = 850.0
mock_avail = MagicMock()
mock_avail.x = expected_width
mock_imgui.get_content_region_avail.return_value = mock_avail
mock_imgui.ImVec2.side_effect = lambda x, y: (x, y)
mock_app = MagicMock()
mock_app.disc_roles = ["User", "Assistant"]
entry = {"role": "User", "content": "test", "collapsed": False, "read_mode": False}
mock_imgui.begin_combo.return_value = False
mock_imgui.button.return_value = False
mock_imgui.input_text_multiline.return_value = (False, "test")
from src.gui_2 import render_discussion_entry
render_discussion_entry(mock_app, entry, 0)
# 1. Verify group expansion
mock_imgui.dummy.assert_any_call((expected_width, 0.0))
# 2. Verify newline or spacing is called to prevent squashing
assert mock_imgui.new_line.called or mock_imgui.spacing.called
if __name__ == '__main__':
unittest.main()