- Top bar switching between Deck, Match, Turn and History views - Match view: life, player counters, commanders, emblems, zone counts, turn timer and timeouts, land drops used/allowed, play/draw and Bo3 draw counts, with the deck view below - Turn view: per-player and total stats per turn with history, plus whole-game totals and land drops - History: every finished game (colours, winner, who was on the play); click to reopen it in the other views; imports Player-prev.log - Customize menu to show/hide items and an Arrange dialog to reorder deck sections and turn stats, remembered across sessions - Static dark theme with mint accent, rounded corners, larger text - Commanders tracked separately from emblems, with location and tax - Quieter, non-sticky warning for cards lost to MTGA log gaps - Correct Scryfall images for tokens Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
import pytest
|
|
from PySide6.QtCore import QSettings
|
|
|
|
from mtga_assistant.ui.toggles import Toggles
|
|
|
|
ITEMS = [("a", "A"), ("b", "B"), ("c", "C")]
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def isolated_settings(tmp_path):
|
|
QSettings.setPath(QSettings.Format.NativeFormat, QSettings.Scope.UserScope, str(tmp_path))
|
|
yield
|
|
|
|
|
|
def test_default_order_and_visibility():
|
|
t = Toggles("g1", ITEMS, defaults_off={"b"})
|
|
assert t.order() == ["a", "b", "c"]
|
|
assert not t.on("b") and t.on("a")
|
|
|
|
|
|
def test_order_and_visibility_persist():
|
|
t = Toggles("g2", ITEMS)
|
|
t.apply(["c", "a", "b"], {"a": False})
|
|
again = Toggles("g2", ITEMS)
|
|
assert again.order() == ["c", "a", "b"]
|
|
assert not again.on("a") and again.on("c")
|
|
assert [k for k, _ in again.ordered_items()] == ["c", "a", "b"]
|
|
|
|
|
|
def test_new_items_slot_in_after_their_default_neighbour():
|
|
Toggles("g3", ITEMS).apply(["c", "a", "b"], {})
|
|
grown = Toggles("g3", [("a", "A"), ("new", "New"), ("b", "B"), ("c", "C")])
|
|
assert grown.order() == ["c", "a", "new", "b"]
|
|
|
|
|
|
def test_unknown_saved_keys_are_dropped_and_reset_restores_defaults():
|
|
t = Toggles("g4", ITEMS)
|
|
t.apply(["gone", "b", "a", "c"], {"b": False})
|
|
assert t.order() == ["b", "a", "c"]
|
|
t.reset()
|
|
assert t.order() == ["a", "b", "c"] and t.on("b")
|