예제 #1
0
    def test_clear(self):
        viewer = IntegrableViewer()

        viewer.load_mesh(path=f'{TEST_FILES_FOLDER_PATH}/caseron.off')
        viewer.load_blocks(path=f'{TEST_FILES_FOLDER_PATH}/mini.csv')
        viewer.load_points(path=f'{TEST_FILES_FOLDER_PATH}/mini.csv')

        assert viewer.drawable_collection.size() == 3
        viewer.clear()
        assert viewer.drawable_collection.size() == 0
예제 #2
0
    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
예제 #3
0
    def test_load_elements(self):
        viewer = IntegrableViewer()

        # Mesh
        mesh = viewer.load_mesh(f'{TEST_FILES_FOLDER_PATH}/caseron.dxf')
        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.load_blocks(f'{TEST_FILES_FOLDER_PATH}/mini.csv')
        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.load_points(f'{TEST_FILES_FOLDER_PATH}/mini.csv')
        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.load_lines(f'{TEST_FILES_FOLDER_PATH}/mini.csv')
        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.load_tubes(f'{TEST_FILES_FOLDER_PATH}/mini.csv')
        assert type(tubes) is TubeGL
        assert viewer.last_id == tubes.id
        assert viewer.last_drawable is tubes
        assert len(viewer.get_all_drawables()) == 5