forked from mirror/Archipelago
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
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
from worlds.AutoWorld import call_all
|
|
|
|
from .bases import Portal2TestBase
|
|
from ..Options import GameModeOption
|
|
from ..mod_helpers.MapMenu import Menu
|
|
from ..Locations import all_locations_table
|
|
|
|
class FakeClient:
|
|
item_list: list[str] = []
|
|
location_id_to_name: dict[int, str] = {data.id: name for name, data in all_locations_table.items()}
|
|
|
|
|
|
class BaseMenuTests(Portal2TestBase):
|
|
options = {
|
|
"game_mode": GameModeOption.NORMAL
|
|
}
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.client = FakeClient()
|
|
|
|
def test_menu_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()
|
|
# Check menu is generated where the first map of each chapter says "command" and the rest say "command_deactivated"
|
|
menu_string = str(menu)
|
|
print(menu_string)
|
|
self.assertGreater(menu_string.count('"command_deactivated"'), 0)
|
|
self.assertEqual(menu_string.count('"command"'), 18)
|
|
|
|
def test_menu_no_maps(self) -> None:
|
|
menu = Menu({1: [], 2: [], 3: []}, self.client)
|
|
menu.generate_menu()
|
|
menu_string = str(menu)
|
|
print(menu_string)
|
|
# Check menu is generated where the first map of each chapter says "No Maps In This Chapter"
|
|
self.assertEqual(menu_string.count("No Maps In This Chapter"), 3) |