Refine ranch tree, growth sync and monitoring policies

This commit is contained in:
AttilaNet
2026-11-08 09:53:02 +08:00
parent a37627b490
commit 9611a3413f
24 changed files with 640 additions and 1227 deletions
+8 -8
View File
@@ -150,17 +150,16 @@ class GrowthTests(unittest.TestCase):
self.assertEqual(sum(name == "growth" for name, _ in client.calls), 1)
self.assertFalse(any(name == "monsterService/monsterSell" for name, _ in client.calls))
def test_monitor_is_read_only_and_explicit_sync_does_not_dispatch(self):
def test_monitor_automatically_syncs_growth_without_dispatch(self):
client = GrowthClient(self.catalog, age=610)
engine = self.engine(client)
engine.auto = False
snapshot, _, message = engine.poll()
self.assertFalse(any(name == "growth" for name, _ in client.calls))
self.assertIn("仅监控", message)
snapshot, plans, _ = engine.sync_growth()
self.assertTrue(any(name == "growth" for name, _ in client.calls))
self.assertIn("成长结算", message)
self.assertEqual(snapshot.monsters[501]["mode"], 2)
self.assertEqual(self.catalog.quality_text(snapshot.monsters[501]), "C/C/C/C")
self.assertTrue(any(action.kind == "sell" for action in plans))
self.assertTrue(any(action.kind == "sell" for action in engine.plans()))
self.assertFalse(any(name == "monsterService/monsterSell" for name, _ in client.calls))
def test_mature_protected_monster_with_null_room_id_can_be_collected(self):
@@ -203,8 +202,9 @@ class GrowthGuiTests(unittest.TestCase):
row = next(i for i in range(window.slots.rowCount()) if window.slots.item(i, 1).text() == "1")
self.assertIn("待同步", window.slots.item(row, 5).text())
self.assertIn("待成熟", window.slots.item(row, 7).text())
self.assertNotEqual(window.monsters.item(0, 4).text(), "C/C/C/C")
window.sync_growth_button.click()
self.assertNotEqual(window.monsters.monster_items[501].text(4), "C/C/C/C")
window.engine.last_heartbeat = __import__("time").monotonic()
window.schedule()
for _ in range(200):
self.app.processEvents()
QTest.qWait(5)
@@ -213,7 +213,7 @@ class GrowthGuiTests(unittest.TestCase):
row = next(i for i in range(window.slots.rowCount()) if window.slots.item(i, 1).text() == "1")
self.assertEqual(window.slots.item(row, 7).text(), "S/S/S/S")
self.assertIn("资质", window.slots.item(row, 8).text())
self.assertIn("S/S/S/S", window.monsters.item(0, 4).text())
self.assertIn("S/S/S/S", window.monsters.monster_items[501].text(4))
self.assertFalse(window.execute.isChecked())
self.assertFalse(any(name == "monsterService/monsterSell" for name, _ in client.calls))
finally: