forked from bitcoinafterlife/bal-electrum-plugin
Bump plugin version to 0.3.4 (manifest, __init__, plugin_base, VERSION). GROUP A - A1: remove block-height locktimes; the plugin now uses UNIX timestamps only. The NLOCKTIME_BLOCKHEIGHT_MAX guard is kept on purpose (it forces every locktime to be a timestamp). chk_locktime is now 2-arg; int_locktime and anticipate_locktime no longer accept blocks; RAW input only accepts d/y. Two now-dormant configs (LOCKTIME_BLOCKS, LOCKTIMEDELTA_BLOCKS) are kept with comments to avoid touching persisted keys. - A2: rename PENDING -> MEMPOOL everywhere (label 'Mempool', yellow #ffce30); add new UPDATED status; ANTICIPATED & UPDATED keep VALID; documented set_status rules; backward-compat migration (old PENDING -> MEMPOOL). - A3: clarify that anticipating to a future date only rebuilds (never invalidates), while only a past locktime invalidates (WillExpired). Code was already correct; only the comment and docs were fixed. Colour follow-up: UPDATED lightened from #800080 to #b266b2 (more readable), updated in theme.py, docs and the theme test. GROUP B - B1: verified the 'Create your will' button already opens the guided wizard (no code change needed). - B2: new persisted AUTO_SIGN setting (default ON) with an 'Auto-sign on Check' checkbox in the settings dialog. When enabled, Check signs and broadcasts automatically; the wallet password is requested only for encrypted wallets. B2 follow-up (fixes reported after testing): - Remove the duplicate sign/broadcast cycle in lists.check(); build_will_task() already signs and broadcasts. - Suppress the manual 'press Sign/Broadcast' hint and its popup when AUTO_SIGN is ON (kept when OFF). - Make broadcast one-shot: removed the retry flag and the Exception('retry'); failed will-executors stay PUSH_FAIL and are skipped (no endless retry). PUSHED transactions are already excluded from re-collection. Docs: inheritance-options.md/.html and inheritance-flow.svg updated to v0.3.4. Tests: 206 passing (new test_anticipate_manual_locktime, test_anticipate_past_locktime, test_group_b_auto_sign; updated core/util, core/will_extra, gui/theme, gui/widgets). CHANGELOG.md added with one numbered entry per task.
110 lines
3.1 KiB
Python
110 lines
3.1 KiB
Python
"""
|
|
Tests for ``bal.gui.qt.theme``.
|
|
|
|
Covers ``status_color`` priority logic.
|
|
|
|
Run:
|
|
QT_QPA_PLATFORM=offscreen python3 tests/test_gui_theme.py
|
|
"""
|
|
|
|
import sys
|
|
sys.path.insert(0, __file__.rsplit("/", 2)[0])
|
|
|
|
from bal.gui.qt.theme import status_color
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
# Helpers
|
|
# ------------------------------------------------------------------ #
|
|
|
|
class FakeWillItem:
|
|
def __init__(self, **status_flags):
|
|
self._status = dict(status_flags)
|
|
def get_status(self, name):
|
|
return self._status.get(name, False)
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
# Priority-ordered statuses
|
|
# ------------------------------------------------------------------ #
|
|
|
|
def test_color_invalidated():
|
|
assert status_color(FakeWillItem(INVALIDATED=True)) == "#f87838"
|
|
|
|
|
|
def test_color_invalidated_overrides_lower():
|
|
# PENDING was renamed to MEMPOOL (A2).
|
|
item = FakeWillItem(INVALIDATED=True, MEMPOOL=True, COMPLETE=True)
|
|
assert status_color(item) == "#f87838"
|
|
|
|
|
|
def test_color_replaced():
|
|
assert status_color(FakeWillItem(REPLACED=True)) == "#ff97e9"
|
|
|
|
|
|
def test_color_updated():
|
|
# UPDATED is a new status (A2): light violet. It is checked after REPLACED
|
|
# but before CONFIRMED/MEMPOOL in the priority list. The original violet
|
|
# (#800080) was too dark to read, so it was lightened to #b266b2.
|
|
assert status_color(FakeWillItem(UPDATED=True)) == "#b266b2"
|
|
|
|
|
|
def test_color_confirmed():
|
|
assert status_color(FakeWillItem(CONFIRMED=True)) == "#bfbfbf"
|
|
|
|
|
|
def test_color_mempool():
|
|
# PENDING was renamed to MEMPOOL (A2); the colour (yellow) is unchanged.
|
|
assert status_color(FakeWillItem(MEMPOOL=True)) == "#ffce30"
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
# Branching statuses (CHECK_FAIL / CHECKED / PUSH_FAIL / PUSHED / COMPLETE)
|
|
# ------------------------------------------------------------------ #
|
|
|
|
def test_color_check_fail_not_checked():
|
|
item = FakeWillItem(CHECK_FAIL=True)
|
|
assert status_color(item) == "#e83845"
|
|
|
|
|
|
def test_color_check_fail_ignored_if_checked():
|
|
item = FakeWillItem(CHECK_FAIL=True, CHECKED=True)
|
|
assert status_color(item) == "#8afa6c"
|
|
|
|
|
|
def test_color_checked():
|
|
assert status_color(FakeWillItem(CHECKED=True)) == "#8afa6c"
|
|
|
|
|
|
def test_color_push_fail():
|
|
assert status_color(FakeWillItem(PUSH_FAIL=True)) == "#e83845"
|
|
|
|
|
|
def test_color_pushed():
|
|
assert status_color(FakeWillItem(PUSHED=True)) == "#73f3c8"
|
|
|
|
|
|
def test_color_complete():
|
|
assert status_color(FakeWillItem(COMPLETE=True)) == "#2bc8ed"
|
|
|
|
|
|
def test_color_default():
|
|
assert status_color(FakeWillItem()) == "#ffffff"
|
|
|
|
|
|
def test_color_check_fail_overrides_push_fail():
|
|
item = FakeWillItem(CHECK_FAIL=True, PUSH_FAIL=True)
|
|
assert status_color(item) == "#e83845"
|
|
|
|
|
|
# ------------------------------------------------------------------ #
|
|
# Main
|
|
# ------------------------------------------------------------------ #
|
|
|
|
if __name__ == "__main__":
|
|
for name in sorted(dir()):
|
|
if name.startswith("test_"):
|
|
globals()[name]()
|
|
print(f" [OK] {name}")
|
|
print("[OK] All theme tests passed")
|