def test_object_list(): client.connect() res = client.request('vget /objects') obj_ids = res.split(' ') assert checker.not_error(res) for obj_id in obj_ids: color = client.request('vget /object/%s/color' % obj_id) assert checker.not_error(color)
def test_exr_file(): cmds = [ 'vget /camera/0/depth test.exr', # This is very likely to fail in Linux ] client.connect() for cmd in cmds: res = client.request(cmd) assert checker.not_error(res) im = imread_file(res)
def test_pause(): client.connect() cmds = [ 'vset /action/game/pause', 'vget /camera/0/lit', 'vget /camera/1/lit', 'vset /action/game/pause', ] for cmd in cmds: res = client.request(cmd) assert checker.not_error(res)
def test_npy_mode(): """ Get data as a numpy array """ client.connect() cmd = 'vget /camera/0/depth npy' res = client.request(cmd) assert checker.not_error(res) # Do these but without assert, if exception happened, this test failed arr = imread_npy(res)
def test_camera_control(): client.connect() cmds = [ 'vget /camera/0/location', 'vget /camera/0/rotation', # 'vset /camera/0/location 0 0 0', # BUG: If moved out the game bounary, the pawn will be deleted, so that the server code will crash with a nullptr error. # 'vset /camera/0/rotation 0 0 0', ] for cmd in cmds: res = client.request(cmd) assert checker.not_error(res)
def test_npy_mode(): ''' Get data as a numpy array ''' client.connect() cmd = 'vget /camera/0/depth npy' res = client.request(cmd) assert checker.not_error(res) # Do these but without assert, if exception happened, this test failed arr = imread_npy(res)
def test_file_mode(): """ Save data to disk as image file """ client.connect() cmds = [ 'vget /camera/0/lit test.png', 'vget /camera/0/object_mask test.png', 'vget /camera/0/normal test.png', 'vget /camera/0/depth test.png', ] for cmd in cmds: res = client.request(cmd) assert checker.not_error(res) im = imread_file(res)
def test_png_mode(): """ Get image as a png binary, make sure no exception happened """ client.connect() cmds = [ 'vget /camera/0/lit png', 'vget /camera/0/object_mask png', 'vget /camera/0/normal png', ] for cmd in cmds: res = client.request(cmd) assert checker.not_error(res) im = imread_png(res)
def test_file_mode(): ''' Save data to disk as image file ''' client.connect() cmds = [ 'vget /camera/0/lit test.png', 'vget /camera/0/object_mask test.png', 'vget /camera/0/normal test.png', 'vget /camera/0/depth test.png', ] for cmd in cmds: res = client.request(cmd) assert checker.not_error(res) im = imread_file(res)
def test_png_mode(): ''' Get image as a png binary, make sure no exception happened ''' client.connect() cmds = [ 'vget /camera/0/lit png', 'vget /camera/0/object_mask png', 'vget /camera/0/normal png', ] for cmd in cmds: res = client.request(cmd) assert checker.not_error(res) im = imread_png(res)
def test_connection(): client.connect() res = client.request('vget /unrealcv/status') assert checker.not_error(res)