feat: add pyside6 holdings gui
This commit is contained in:
31
tests/test_ui.py
Normal file
31
tests/test_ui.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
def test_formatters_render_money_percent_and_empty_values():
|
||||
from grid_trading.ui.formatters import format_money, format_percent, format_price, format_quantity
|
||||
|
||||
assert format_money(Decimal("1234.5")) == "1,234.50"
|
||||
assert format_price(Decimal("3.956")) == "3.96"
|
||||
assert format_percent(Decimal("0.1234")) == "12.34%"
|
||||
assert format_quantity(1200) == "1,200"
|
||||
assert format_money(None) == "-"
|
||||
|
||||
|
||||
def test_main_window_can_be_constructed_offscreen(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("QT_QPA_PLATFORM", "offscreen")
|
||||
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from grid_trading.services.trading_service import TradingService
|
||||
from grid_trading.ui.main_window import MainWindow
|
||||
|
||||
app = QApplication.instance() or QApplication([])
|
||||
service = TradingService(tmp_path / "grid.db")
|
||||
window = MainWindow(service)
|
||||
|
||||
assert window.windowTitle() == "Grid Trading Manager"
|
||||
assert window.holdings_table.columnCount() > 0
|
||||
|
||||
window.close()
|
||||
service.close()
|
||||
app.processEvents()
|
||||
Reference in New Issue
Block a user