Add an extra test case

This commit is contained in:
Jesse Talavera 2024-05-30 14:31:40 -04:00
parent d00fb33bd2
commit 18435ef988
2 changed files with 33 additions and 0 deletions

View File

@ -31,3 +31,10 @@ add_python_test(
CORE_OPTION "melonds_render_mode=opengl"
REQUIRES_OPENGL
)
add_python_test(
NAME "Core can switch from software to OpenGL mode at runtime"
TEST_MODULE opengl.core_switch_software_to_opengl_runtime
CONTENT "${NDS_ROM}"
REQUIRES_OPENGL
)

View File

@ -0,0 +1,26 @@
from ctypes import CFUNCTYPE, c_bool
import prelude
options = {
b"melonds_render_mode": b"software",
}
with prelude.builder().with_options(options).build() as session:
is_opengl_renderer = session.get_proc_address(b"melondsds_is_opengl_renderer", CFUNCTYPE(c_bool))
assert is_opengl_renderer is not None, "melondsds_is_opengl_renderer not defined in the core"
is_software_renderer = session.get_proc_address(b"melondsds_is_software_renderer", CFUNCTYPE(c_bool))
assert is_software_renderer is not None, "melondsds_is_software_renderer not defined in the core"
assert is_software_renderer()
for i in range(3):
session.run()
session.options.variables["melonds_render_mode"] = b"opengl"
for i in range(3):
session.run()
assert is_opengl_renderer()