Refine ranch tree, growth sync and monitoring policies
This commit is contained in:
@@ -29,7 +29,13 @@ class GuiTests(unittest.TestCase):
|
||||
window.timer.stop()
|
||||
try:
|
||||
self.wait(window)
|
||||
self.assertIn("页面截图配置", [window.tabs.tabText(i) for i in range(window.tabs.count())])
|
||||
labels = [window.tabs.tabText(i) for i in range(window.tabs.count())]
|
||||
self.assertNotIn("页面截图配置", labels)
|
||||
self.assertNotIn("体力刷图", labels)
|
||||
self.assertIn("自动扫荡", labels)
|
||||
self.assertNotIn("地图关卡", labels)
|
||||
self.assertEqual(labels[-1], "收益资料")
|
||||
self.assertLess(labels.index("自动孵蛋"), labels.index("自动扫荡"))
|
||||
self.assertEqual(window.yields.rowCount(), 749)
|
||||
self.assertEqual(window.styleSheet(), "")
|
||||
window.strategy.setCurrentIndex(window.strategy.findData("gold"))
|
||||
@@ -58,57 +64,6 @@ class GuiTests(unittest.TestCase):
|
||||
finally:
|
||||
window.close()
|
||||
|
||||
def test_page_buttons_only_capture_and_restore_profile(self):
|
||||
from PIL import Image
|
||||
from ranch_assistant.capture import PAGES
|
||||
operations = []
|
||||
class FakeAdb:
|
||||
def __init__(self, executable="", serial=""):
|
||||
self.serial = serial
|
||||
def foreground(self):
|
||||
operations.append("foreground")
|
||||
return True
|
||||
def run(self, *args):
|
||||
operations.append(args)
|
||||
if args != ("get-serialno",):
|
||||
raise AssertionError("Screenshot flow attempted another ADB command")
|
||||
return "test-phone"
|
||||
def screenshot(self):
|
||||
operations.append("screenshot")
|
||||
return Image.new("RGB", (320, 640), "green")
|
||||
def tap(self, *args):
|
||||
raise AssertionError("Screenshot flow must never tap")
|
||||
with workspace_temp() as folder, patch.object(gui, "STATE", folder):
|
||||
window = gui.Window()
|
||||
window.timer.stop()
|
||||
try:
|
||||
self.wait(window)
|
||||
window.start_monitor.setChecked(True)
|
||||
with patch.object(gui, "Adb", FakeAdb):
|
||||
for index in range(len(PAGES)):
|
||||
window.capture_rows.cellWidget(index, 2).click()
|
||||
self.wait(window)
|
||||
self.assertFalse(window.monitoring)
|
||||
profile = json.loads(window.capture_profile.read_text(encoding="utf-8"))
|
||||
self.assertEqual(set(profile["captures"]), {p[0] for p in PAGES})
|
||||
self.assertEqual(operations.count("screenshot"), len(PAGES))
|
||||
self.assertFalse(window.capture_preview.selectable)
|
||||
original = window.capture_profile
|
||||
window.stage.setCurrentIndex(1)
|
||||
self.assertIsNone(window.capture_profile)
|
||||
window.stage.setCurrentIndex(0)
|
||||
self.assertEqual(window.capture_profile, original)
|
||||
finally:
|
||||
window.close()
|
||||
restored = gui.Window()
|
||||
restored.timer.stop()
|
||||
try:
|
||||
self.wait(restored)
|
||||
self.assertEqual(restored.capture_profile, original)
|
||||
restored.preview_capture(0, 0)
|
||||
self.assertEqual(restored.capture_preview.image.size, (320, 640))
|
||||
finally:
|
||||
restored.close()
|
||||
|
||||
def test_password_result_accepts_serverId_and_handles_missing_identifier(self):
|
||||
from unittest.mock import Mock
|
||||
|
||||
Reference in New Issue
Block a user