Files
dockipelago/worlds/portal2/test/test_menu_additional_checks.py
Jonathan Tinney 7971961166
Some checks failed
Analyze modified files / flake8 (push) Failing after 2m28s
Build / build-win (push) Has been cancelled
Build / build-ubuntu2204 (push) Has been cancelled
ctest / Test C++ ubuntu-latest (push) Has been cancelled
ctest / Test C++ windows-latest (push) Has been cancelled
Analyze modified files / mypy (push) Has been cancelled
Build and Publish Docker Images / Push Docker image to Docker Hub (push) Successful in 5m4s
Native Code Static Analysis / scan-build (push) Failing after 5m2s
type check / pyright (push) Successful in 1m7s
unittests / Test Python 3.11.2 ubuntu-latest (push) Failing after 16m23s
unittests / Test Python 3.12 ubuntu-latest (push) Failing after 28m19s
unittests / Test Python 3.13 ubuntu-latest (push) Failing after 14m49s
unittests / Test hosting with 3.13 on ubuntu-latest (push) Successful in 5m0s
unittests / Test Python 3.13 macos-latest (push) Has been cancelled
unittests / Test Python 3.11 windows-latest (push) Has been cancelled
unittests / Test Python 3.13 windows-latest (push) Has been cancelled
add schedule I, sonic 1/frontiers/heroes, spirit island
2026-04-02 23:46:36 -07:00

62 lines
3.0 KiB
Python

from worlds.AutoWorld import call_all
from .test_base_menu import FakeClient
from .bases import Portal2TestBase
from ..Options import GameModeOption
from ..mod_helpers.MapMenu import Menu
from ..ItemNames import portal_gun_1, portal_gun_2, potatos
from ..mod_helpers.MapMenu import indicator_characters
class AdditionalChecksMenuTests(Portal2TestBase):
options = {
"game_mode": GameModeOption.NORMAL,
"wheatley_monitors": True,
"ratman_dens": True,
"cutscene_levels": True,
}
def setUp(self):
super().setUp()
self.client = FakeClient()
def test_title_generation(self) -> None:
from Fill import distribute_items_restrictive
with self.subTest("Game", game=self.game, seed=self.multiworld.seed):
distribute_items_restrictive(self.multiworld)
call_all(self.multiworld, "post_fill")
slot_data = self.world.fill_slot_data()
menu = Menu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"])
menu.generate_menu()
menu_string = str(menu)
# Find map that includes Wheatley Monitors in the title and check it is correct
self.assertTrue(f"M{indicator_characters["wheatley"]}{indicator_characters["wheatley"]}-Funnel Catch" in menu_string)
self.assertTrue(f"M{indicator_characters["wheatley"]}--Laser Platform" in menu_string)
self.assertTrue("MR--Laser Stairs" in menu_string)
self.assertTrue("M---" in menu_string)
self.assertTrue(f"M{indicator_characters[portal_gun_1]}--Portal Gun" in menu_string)
self.assertTrue(f"M{indicator_characters[portal_gun_2]}--Incinerator" in menu_string)
self.assertTrue(f"M{indicator_characters[potatos]}--PotatOS" in menu_string)
def test_sub_location_completion(self) -> None:
from Fill import distribute_items_restrictive
with self.subTest("Game", game=self.game, seed=self.multiworld.seed):
distribute_items_restrictive(self.multiworld)
call_all(self.multiworld, "post_fill")
slot_data = self.world.fill_slot_data()
menu = Menu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"])
menu.generate_menu()
# Complete a map with a sub location and check the title updates
menu.complete_map(slot_data["location_name_to_id"]["Portal Gun Completion"])
menu_string = str(menu)
self.assertTrue(f"{indicator_characters[portal_gun_1]}--Portal Gun" in menu_string)
menu.complete_sub_location_check(portal_gun_1)
menu_string = str(menu)
self.assertTrue("✓✓--Portal Gun" in menu_string)