summaryrefslogtreecommitdiff
path: root/tests/test_vba_battle.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-11 00:55:54 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-11 00:55:54 -0600
commit966985411f01b799fa71f4823da7a8cd6d9cc47b (patch)
treebe94d8ec6e86db5e883db5ebe9edffc2bdc951ff /tests/test_vba_battle.py
parent1d9ecfa00f91d602073b56a64f9aa129b95a8c2e (diff)
detect the "mandatory switch" menuvba-automation
This requires a slightly slower text_wait function. There is probably a way to refactor that function in a way that doesn't cause cancer.
Diffstat (limited to 'tests/test_vba_battle.py')
-rw-r--r--tests/test_vba_battle.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_vba_battle.py b/tests/test_vba_battle.py
index e86b53c..61c0297 100644
--- a/tests/test_vba_battle.py
+++ b/tests/test_vba_battle.py
@@ -56,6 +56,25 @@ class BattleTests(unittest.TestCase):
# should not be asking for a switch so soon in the battle
self.assertFalse(self.battle.is_mandatory_switch())
+ def test_is_mandatory_switch(self):
+ self.battle.skip_start_text()
+ self.battle.skip_until_input_required()
+
+ # press "FIGHT"
+ self.vba.press(["a"], after=20)
+
+ # press the first move ("SCRATCH")
+ self.vba.press(["a"], after=20)
+
+ # set partymon1 hp to very low
+ self.vba.write_memory_at(0xc63c, 0)
+ self.vba.write_memory_at(0xc63d, 1)
+
+ # let the enemy attack and kill the pokemon
+ self.battle.skip_until_input_required()
+
+ self.assertTrue(self.battle.is_mandatory_switch())
+
def test_attack_loop(self):
self.battle.skip_start_text()
self.battle.skip_until_input_required()