def runTests(): import imp import os import pytests # This is to get the path to the tests path = pytests.__path__._path[0] for name in os.listdir(path): if name.find(".py") == -1 or name.find(".py") != len(name) - 3: continue print("\n==========", name, "==========") filepath = path + "/" + name src = imp.load_source("data", path, open(filepath)) if 'run' not in dir(src): print("File " + name + " has no run() method") if 'description' not in dir(src): print("No description available") else: print(src.description) try: src.run() except Exception as e: print("Exception caught: ", str(e)) print("Press a key to continue") input() splash.set_global("quit", [])
def run(): splash.set_global("replaceObject", ["image", "image_v4l2", "object"]) splash.set_object("image", "doCapture", 1) sleep(1.0) splash.set_object("image", "captureSize", [2048, 2048]) sleep(1.0) splash.set_object("image", "captureSize", [640, 480]) sleep(1.0) splash.set_object("image", "doCapture", 0)
def run(): for i in range(5): filename = os.path.dirname( os.path.abspath(__file__)) + "/../data/color_map.png" splash.set_global("replaceObject", ["image", "image", "object"]) splash.set_object("image", "file", filename) sleep(1.0) splash.set_global("replaceObject", ["image", "image_ffmpeg", "object"]) sleep(1.0)
def link_object_image(): print("---> Linking object and image") splash.set_global("sendAllScenes", ["unlink", "image", "object"]) sleep(1.0) splash.set_global("sendAllScenes", ["link", "image", "object"]) sleep(1.0) splash.set_global("sendAllScenes", ["unlink", "image", "object"]) sleep(1.0) splash.set_global("sendAllScenes", ["link", "image", "object"]) sleep(1.0)
def link_window_image(): print("---> Linking window and image") splash.set_global("sendAllScenes", ["unlink", "cam1", "win1"]) splash.set_global("sendAllScenes", ["link", "image", "win1"]) sleep(1.0) splash.set_global("sendAllScenes", ["unlink", "image", "win1"]) sleep(1.0) splash.set_global("sendAllScenes", ["link", "image", "win1"]) sleep(1.0) splash.set_global("sendAllScenes", ["unlink", "image", "win1"]) sleep(1.0) splash.set_global("sendAllScenes", ["link", "cam1", "win1"]) sleep(1.0)
def run(): projectFilePath = "/tmp/splashProject.json" splash.set_global("saveProject", [projectFilePath]) splash.set_global("loadProject", [projectFilePath])