import pytest
from unittest.mock import patch, MagicMock
from src import gui_2
from src.gui_2 import App

def test_shader_live_editor_renders():
 app = App()
 app.show_windows["Shader Editor"] = True
 
 with patch("src.gui_2.imgui") as mock_imgui, \
      patch("src.gui_2.imscope") as mock_imscope:
  mock_imgui.begin.return_value = (True, True)
  mock_imgui.slider_float.return_value = (False, 1.0)
  
  # Setup imscope mocks
  mock_imscope.window.return_value.__enter__.return_value = (True, True)
  mock_imscope.child.return_value.__enter__.return_value = True
  mock_imscope.table.return_value.__enter__.return_value = True
  mock_imscope.tree_node_ex.return_value.__enter__.return_value = True
  mock_imscope.tab_item.return_value.__enter__.return_value = (True, True)
  mock_imscope.style_color.return_value.__enter__.return_value = None
  mock_imscope.style_var.return_value.__enter__.return_value = None

  gui_2.render_shader_live_editor(app)
  assert mock_imscope.window.called
