import pytest
from unittest.mock import MagicMock, patch

def test_gui_has_kill_button_method():
 from src.gui_2 import App
 assert hasattr(App, '_cb_kill_ticket'), "App must have _cb_kill_ticket method"

def test_render_ticket_queue_table_columns():
 with patch("src.gui_2.imgui") as mock_imgui, \
      patch("src.gui_2.imscope") as mock_imscope:
  mock_imgui.begin_table.return_value = True
  mock_imgui.table_setup_column = MagicMock()
  mock_imgui.table_headers_row = MagicMock()
  mock_imgui.table_next_row = MagicMock()
  mock_imgui.table_next_column = MagicMock()
  mock_imgui.button.return_value = False
  mock_imgui.checkbox = MagicMock(return_value=(False, False))
  mock_imgui.selectable = MagicMock(return_value=(False, False))
  mock_imgui.begin_drag_drop_source = MagicMock(return_value=False)
  mock_imgui.begin_drag_drop_target = MagicMock(return_value=False)
  mock_imgui.text = MagicMock()
  mock_imgui.end_table = MagicMock()
  mock_imgui.begin_combo.return_value = False
  mock_imgui.ComboFlags_.height_small = 0
  mock_imgui.push_style_color = MagicMock()
  mock_imgui.pop_style_color = MagicMock()
  mock_imgui.same_line = MagicMock()
  
  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
  from src.gui_2 import App, render_ticket_queue
  app = App.__new__(App)
  app.active_track = MagicMock()
  app.active_tickets = [{"id": "T-001", "priority": "medium", "status": "in_progress", "description": "Test task"}]
  app.ui_selected_tickets = set()
  app.ui_selected_ticket_id = None
  app.controller = MagicMock()
  app._push_mma_state_update = MagicMock()
  app._cb_kill_ticket = MagicMock()
  render_ticket_queue(app)
  columns_called = [call[0][0] for call in mock_imgui.table_setup_column.call_args_list]
  assert "Actions" in columns_called, f"Expected Actions column, got: {columns_called}"