def test_load_elements(self): viewer = IntegrableViewer() mesh = viewer.mesh(x=[-1, 1, 0], y=[0, 0, 1], z=[-3, -3, -3], color=[0.0, 0.0, 1.0], indices=[[0, 1, 2]], alpha=0.4, name='mesh_name', extension='dxf') assert viewer.last_id == 0 blocks = viewer.blocks(x=[-3, 3, 0], y=[0, 0, 5], z=[0, 0, 0], block_size=[1.0, 1.0, 1.0], values=[0.5, 1.0, 1.5]) assert viewer.last_id == 1 points = viewer.points(vertices=[[-3, 2, 0], [0, 2, 1], [3, 2, 2]], point_size=10.0, values=[1.5, 1.0, 0.5]) assert viewer.last_id == 2 lines = viewer.lines(x=[-0.5, 0.5], y=[-2.0, 1.5], z=[-2.0, -2.0], color=[0.2, 0.8, 0.8]) assert viewer.last_id == 3 tubes = viewer.tubes(x=[0.5, -0.5, 1.5, 1.5], y=[-2.0, 1.8, 1.8, 0.0], z=[-1.5, -1.5, -1.5, -1.5], color=[0.9, 0.2, 0.2], radius=0.2, resolution=15) assert viewer.last_id == 4 assert viewer.drawable_collection.size() == 5 assert viewer.get_drawable(0) is mesh assert viewer.get_drawable(1) is blocks assert viewer.get_drawable(2) is points assert viewer.get_drawable(3) is lines assert viewer.get_drawable(4) is tubes
def test_add_wrong_elements(self): viewer = IntegrableViewer() assert viewer.mesh() is None assert viewer.blocks() is None assert viewer.points() is None assert viewer.lines() is None assert viewer.tubes() is None assert viewer.load_mesh('') is None assert viewer.load_blocks('') is None assert viewer.load_points('') is None assert viewer.load_lines('') is None assert viewer.load_tubes('') is None assert len(viewer.get_all_drawables()) == 0
def test_add_elements(self): viewer = IntegrableViewer() # Mesh mesh = viewer.mesh(x=[-1, 1, 0], y=[0, 0, 1], z=[0, 0, 0], indices=[[0, 1, 2]]) assert type(mesh) is MeshGL assert viewer.last_id == mesh.id assert viewer.last_drawable is mesh assert len(viewer.get_all_drawables()) == 1 # Blocks blocks = viewer.blocks(x=[-1, 1, 0], y=[0, 0, 1], z=[0, 0, 0], values=[0, 1, 2]) assert type(blocks) is BlockGL assert viewer.last_id == blocks.id assert viewer.last_drawable is blocks assert len(viewer.get_all_drawables()) == 2 # Points points = viewer.points(x=[-1, 1, 0], y=[0, 0, 1], z=[0, 0, 0], values=[0, 1, 2]) assert type(points) is PointGL assert viewer.last_id == points.id assert viewer.last_drawable is points assert len(viewer.get_all_drawables()) == 3 # Lines lines = viewer.lines(x=[-1, 1, 0], y=[0, 0, 1], z=[0, 0, 0]) assert type(lines) is LineGL assert viewer.last_id == lines.id assert viewer.last_drawable is lines assert len(viewer.get_all_drawables()) == 4 # Tubes tubes = viewer.tubes(x=[-1, 1, 0], y=[0, 0, 1], z=[0, 0, 0]) assert type(tubes) is TubeGL assert viewer.last_id == tubes.id assert viewer.last_drawable is tubes assert len(viewer.get_all_drawables()) == 5