29 lines
847 B
Python
29 lines
847 B
Python
import pytest
|
|
from unittest.mock import patch, MagicMock
|
|
|
|
def test_gui_frosted_background_call():
|
|
# Mock ShaderManager and OpenGL functions
|
|
with patch("src.gui_2.ShaderManager") as mock_sm_class, \
|
|
patch("src.gui_2.gl") as mock_gl, \
|
|
patch("src.gui_2.imgui") as mock_imgui:
|
|
|
|
mock_sm = mock_sm_class.return_value
|
|
mock_sm.fbo_width = 0
|
|
mock_sm.fbo_height = 0
|
|
mock_sm.capture_tex = 1
|
|
mock_sm.blur_tex = 2
|
|
|
|
mock_imgui.get_io().display_size = MagicMock(x=1920, y=1080)
|
|
|
|
from src.gui_2 import App
|
|
app = App()
|
|
|
|
# Simulate frame
|
|
app._render_frosted_background(pos=MagicMock(x=10, y=10), size=MagicMock(x=100, y=100))
|
|
|
|
assert mock_sm.setup_capture_fbo.called
|
|
assert mock_gl.glCopyTexImage2D.called
|
|
assert mock_sm.render_blur.called
|
|
assert mock_sm.capture_begin.called
|
|
assert mock_sm.capture_end.called
|