import pytest from PySide6.QtWidgets import QMainWindow, QLineEdit, QPushButton from src.ui.main_window import MainWindow def test_main_window_initialization(qtbot): """ Test if the main window initializes correctly with the expected title and widgets. """ window = MainWindow() qtbot.addWidget(window) # Check title assert window.windowTitle() == "DJI Cloud API Simulator" # Check if key widgets are present (using object traversal or just knowing they were created) # Since we didn't assign object names or make all of them public attributes, # we can check the public ones we did create in _init_left_panel assert isinstance(window.input_broker_ip, QLineEdit) assert window.input_broker_ip.text() == "127.0.0.1" assert isinstance(window.btn_connect, QPushButton) assert window.btn_connect.text() == "Connect" # Check geometry/visibility (optional, but good sanity check) assert window.width() >= 800 assert window.height() >= 600