Allow overriding replay options in test cases

This commit is contained in:
baldurk
2019-09-05 11:48:47 +01:00
parent bfad3dac2f
commit 4a4884129b
2 changed files with 16 additions and 3 deletions
+6 -2
View File
@@ -6,16 +6,20 @@ import renderdoc
rd = renderdoc
def open_capture(filename="", cap: rd.CaptureFile=None):
def open_capture(filename="", cap: rd.CaptureFile=None, opts: rd.ReplayOptions=None):
"""
Opens a capture file and begins a replay.
:param filename: The filename to open, or empty if cap is used.
:param cap: The capture file to use, or ``None`` if a filename is given.
:param opts: The replay options to use, or ``None`` to use the default options.
:return: A replay controller for the capture
:rtype: renderdoc.ReplayController
"""
if opts is None:
opts = rd.ReplayOptions()
# Open a capture file handle
own_cap = False
api = "Unknown"
@@ -40,7 +44,7 @@ def open_capture(filename="", cap: rd.CaptureFile=None):
cap.Shutdown()
raise RuntimeError("{} capture cannot be replayed".format(api))
status, controller = cap.OpenCapture(rd.ReplayOptions(), None)
status, controller = cap.OpenCapture(opts, None)
if own_cap:
cap.Shutdown()
+10 -1
View File
@@ -168,6 +168,15 @@ class TestCase:
else:
raise TestFailureException('Assertion Failure: {}'.format(msg))
def get_replay_options(self):
"""
Method to overload if you want to override the replay options used.
:return: The renderdoc.ReplayOptions to use.
"""
return rd.ReplayOptions()
def get_capture(self):
"""
Method to overload if not implementing a run(), using the default run which
@@ -287,7 +296,7 @@ class TestCase:
log.print("Loading capture")
self.controller = analyse.open_capture(self.capture_filename)
self.controller = analyse.open_capture(self.capture_filename, opts=self.get_replay_options())
log.print("Checking capture")