Unify strategy controls and refresh logged-in accounts automatically

This commit is contained in:
AttilaNet
2026-11-08 12:23:34 +08:00
parent 1eef0f80d1
commit 3c1b3d6af2
19 changed files with 235 additions and 185 deletions
+9 -3
View File
@@ -5,7 +5,7 @@ import json
import unittest
from unittest.mock import patch
from PySide6.QtTest import QTest
from PySide6.QtWidgets import QApplication
from PySide6.QtWidgets import QApplication, QPushButton, QCheckBox
from ranch_assistant import gui
from ranch_assistant.tests.test_core import workspace_temp
@@ -38,17 +38,23 @@ class GuiTests(unittest.TestCase):
self.assertLess(labels.index("自动孵蛋"), labels.index("自动扫荡"))
self.assertEqual(window.yields.rowCount(), 749)
self.assertEqual(window.styleSheet(), "")
buttons = {button.text() for button in window.findChildren(QPushButton)}
self.assertIn("开启策略", buttons)
for removed in ("开始监控", "停止监控", "仅监控", "开始执行勾选功能", "停止执行",
"开始执行勾选策略", "开始扫荡", "停止扫荡", "开始每日事务", "停止每日事务"):
self.assertNotIn(removed, buttons)
self.assertNotIn("自动执行已启用策略", {check.text() for check in window.findChildren(QCheckBox)})
window.strategy.setCurrentIndex(window.strategy.findData("gold"))
window.egg_rules = {str(m["typeId"]): {"enabled": True, "action": "sell"} for m in window.engine.snapshot.raw["monsters"][:2]}
window.protect_star.setValue(6)
window.protect_quality.setCurrentIndex(window.protect_quality.findData(5))
window.fill.setChecked(False)
window.execute.setChecked(True)
window.set_strategy_checked(True)
before = len(window.engine.snapshot.raw["monsters"])
window.refresh()
self.wait(window)
self.assertEqual(len(window.engine.snapshot.raw["monsters"]), before)
window.start_monitor.setChecked(True)
window.monitoring = True
window.refresh(automated=True)
self.wait(window)
self.assertEqual(len(window.engine.snapshot.raw["monsters"]), before - 1)