def test_add_layer(make_napari_viewer, layer_class, data, ndim): viewer = make_napari_viewer(ndisplay=int(np.clip(ndim, 2, 3))) view = viewer.window._qt_viewer add_layer_by_type(viewer, layer_class, data) check_viewer_functioning(viewer, view, data, ndim)
def test_add_layer(make_napari_viewer, layer_class, data, ndim): viewer = make_napari_viewer() layer = add_layer_by_type(viewer, layer_class, data, visible=True) check_viewer_functioning(viewer, viewer.window._qt_viewer, data, ndim) for func in layer.class_keymap.values(): func(layer)
def test_view(qtbot, napari_plugin_manager, layer_type, data, ndim): np.random.seed(0) viewer = getattr(napari, f'view_{layer_type.__name__.lower()}')(data, show=False) view = viewer.window._qt_viewer check_viewer_functioning(viewer, view, data, ndim) viewer.close()
def test_add_layer(viewer_factory, layer_class, data, ndim, visible): view, viewer = viewer_factory() layer = add_layer_by_type(viewer, layer_class, data, visible=visible) check_viewer_functioning(viewer, view, data, ndim) # Run all class keybindings for func in layer.class_keymap.values(): func(layer)
def test_add_layer(make_napari_viewer, layer_class, data, ndim, visible): viewer = make_napari_viewer() layer = add_layer_by_type(viewer, layer_class, data, visible=visible) check_viewer_functioning(viewer, viewer.window.qt_viewer, data, ndim) # Run all class key bindings for func in layer.class_keymap.values(): func(layer)
def test_add_layer(qtbot, layer_class, data, ndim): viewer = ViewerModel(ndisplay=ndim) view = QtViewer(viewer) qtbot.addWidget(view) add_layer_by_type(viewer, layer_class, data) check_viewer_functioning(viewer, view, data, ndim) view.shutdown()
def test_add_layer(make_napari_viewer, layer_class, data, ndim, func, Nmeth, visible): viewer = make_napari_viewer() layer = add_layer_by_type(viewer, layer_class, data, visible=visible) check_viewer_functioning(viewer, viewer.window.qt_viewer, data, ndim) func(layer) assert Nmeth == EXPECTED_NUMBER_OF_LAYER_METHODS[layer_class.__name__]
def test_view(qtbot, layer_type, data, ndim): np.random.seed(0) viewer = view_layer_type(layer_type, data) view = viewer.window.qt_viewer qtbot.addWidget(view) check_viewer_functioning(viewer, view, data, ndim) # Close the viewer viewer.window.close()
def test_add_layer(qtbot, layer_class, data, ndim, visible): viewer = Viewer() view = viewer.window.qt_viewer qtbot.addWidget(view) layer = add_layer_by_type(viewer, layer_class, data, visible=visible) check_viewer_functioning(viewer, view, data, ndim) # Run all class keybindings for func in layer.class_keymap.values(): func(layer) # Close the viewer viewer.window.close()
def test_view(qtbot, layer_type, data, ndim): np.random.seed(0) viewer = view_layer_type(layer_type, data) view = viewer.window.qt_viewer check_viewer_functioning(viewer, view, data, ndim) viewer.close()
def test_add_layer(make_test_viewer, layer_class, data, ndim): viewer = make_test_viewer(ndisplay=ndim) view = viewer.window.qt_viewer add_layer_by_type(viewer, layer_class, data) check_viewer_functioning(viewer, view, data, ndim)
def test_add_layer(viewer_factory, layer_class, data, ndim): view, viewer = viewer_factory(ndisplay=ndim) add_layer_by_type(viewer, layer_class, data) check_viewer_functioning(viewer, view, data, ndim)