mirror of
https://github.com/JesseTG/melonds-ds.git
synced 2024-11-27 16:51:24 +00:00
Implement a shutdown test, mostly
This commit is contained in:
parent
c170081201
commit
eae3532bb6
@ -137,8 +137,13 @@ add_python_test(
|
||||
)
|
||||
|
||||
add_python_test(
|
||||
NAME "Core can shut down internally"
|
||||
TEST_MODULE ""
|
||||
NAME "Core can shut down"
|
||||
TEST_MODULE basics.core_can_shut_down
|
||||
NDS_SYSFILES
|
||||
TIMEOUT 30
|
||||
DISABLED
|
||||
# Failure is expected, as the frontend will shut down
|
||||
# (But segfaults or timeouts are still actual failures)
|
||||
)
|
||||
|
||||
add_python_test(
|
||||
|
42
test/python/basics/core_can_shut_down.py
Normal file
42
test/python/basics/core_can_shut_down.py
Normal file
@ -0,0 +1,42 @@
|
||||
import itertools
|
||||
from typing import cast
|
||||
|
||||
from libretro import Session
|
||||
from libretro.api.input import DeviceIdJoypad
|
||||
from libretro.api.video import SoftwareVideoState
|
||||
|
||||
import prelude
|
||||
|
||||
|
||||
def generate_input():
|
||||
# Wait for intro to finish
|
||||
yield from itertools.repeat(None, 240)
|
||||
|
||||
# Go to NDS main menu and wait for it to appear
|
||||
yield DeviceIdJoypad.A
|
||||
yield from itertools.repeat(None, 59)
|
||||
|
||||
# Select the options menu and wait for the cursor to move
|
||||
yield DeviceIdJoypad.DOWN
|
||||
yield from itertools.repeat(None, 29)
|
||||
|
||||
# Go to the options menu and wait for it to appear
|
||||
yield DeviceIdJoypad.A
|
||||
yield from itertools.repeat(None, 179)
|
||||
|
||||
# Exit the options menu and wait for the window to appear
|
||||
yield DeviceIdJoypad.B
|
||||
yield from itertools.repeat(None, 29)
|
||||
|
||||
# Confirm the exit (exiting the NDS options menu shuts down the console)
|
||||
yield DeviceIdJoypad.A
|
||||
yield from itertools.repeat(None)
|
||||
|
||||
|
||||
session: Session
|
||||
with prelude.session(input_state=generate_input) as session:
|
||||
video = cast(SoftwareVideoState, session.video)
|
||||
for i in range(600):
|
||||
session.core.run()
|
||||
|
||||
assert session.is_shutdown
|
Loading…
Reference in New Issue
Block a user