示例#1
0
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)
示例#2
0
文件: test_viewer.py 项目: jni/napari
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)
示例#3
0
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()
示例#4
0
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)
示例#5
0
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)
示例#6
0
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()
示例#7
0
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__]
示例#8
0
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()
示例#9
0
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()
示例#10
0
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()
示例#11
0
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)
示例#12
0
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)