Example #1
0
def test_save_buttons():
    viewer = get_image_viewer()
    sv = SaveButtons()
    viewer.plugins[0] += sv

    import tempfile
    fid, filename = tempfile.mkstemp(suffix='.png')
    os.close(fid)

    timer = QtCore.QTimer()
    timer.singleShot(100, QtWidgets.QApplication.quit)

    # exercise the button clicks
    sv.save_stack.click()
    sv.save_file.click()

    # call the save functions directly
    sv.save_to_stack()
    with expected_warnings(['precision loss']):
        sv.save_to_file(filename)

    img = data.imread(filename)

    with expected_warnings(['precision loss']):
        assert_almost_equal(img, img_as_uint(viewer.image))

    img = io.pop()
    assert_almost_equal(img, viewer.image)

    os.remove(filename)
Example #2
0
def test_save_buttons():
    viewer = get_image_viewer()
    sv = SaveButtons()
    viewer.plugins[0] += sv

    import tempfile
    fid, filename = tempfile.mkstemp(suffix='.png')
    os.close(fid)

    timer = QtCore.QTimer()
    timer.singleShot(100, QtGui.QApplication.quit)

    # exercise the button clicks
    sv.save_stack.click()
    sv.save_file.click()

    # call the save functions directly
    sv.save_to_stack()
    with expected_warnings(['precision loss']):
        sv.save_to_file(filename)

    img = data.imread(filename)

    with expected_warnings(['precision loss']):
        assert_almost_equal(img, img_as_uint(viewer.image))

    img = io.pop()
    assert_almost_equal(img, viewer.image)

    os.remove(filename)
Example #3
0
def test_save_buttons():
    viewer = get_image_viewer()
    sv = SaveButtons()
    viewer.plugins[0] += sv

    import tempfile
    _, filename = tempfile.mkstemp(suffix='.png')
    os.remove(filename)

    timer = QtCore.QTimer()
    timer.singleShot(100, lambda: QtGui.QApplication.quit())

    sv.save_to_stack()
    sv.save_to_file(filename)

    img = img_as_float(data.imread(filename))
    assert_almost_equal(img, viewer.image)

    img = io.pop()
    assert_almost_equal(img, viewer.image)
Example #4
0
def test_save_buttons():
    viewer = get_image_viewer()
    sv = SaveButtons()
    viewer.plugins[0] += sv

    import tempfile
    _, filename = tempfile.mkstemp(suffix='.png')
    os.remove(filename)

    timer = QtCore.QTimer()
    timer.singleShot(100, lambda: QtGui.QApplication.quit())

    sv.save_to_stack()
    sv.save_to_file(filename)

    img = img_as_float(data.imread(filename))
    assert_almost_equal(img, viewer.image)

    img = io.pop()
    assert_almost_equal(img, viewer.image)
Example #5
0
def test_stack_basic():
    x = np.arange(12).reshape(3, 4)
    io.push(x)

    assert_array_equal(io.pop(), x)
Example #6
0
def test_stack_basic():
    x = np.arange(12).reshape(3, 4)
    io.push(x)

    assert_array_equal(io.pop(), x)