def test_interpolation_combobox(qtbot): """Changing the model attribute should update the view""" layer = Image(np.random.rand(8, 8)) qtctrl = QtImageControls(layer) qtbot.addWidget(qtctrl) combo = qtctrl.interpComboBox opts = {combo.itemText(i) for i in range(combo.count())} assert opts == {'bicubic', 'bilinear', 'kaiser', 'nearest', 'spline36'} # programmatically adding approved interpolation works layer.interpolation2d = 'lanczos' assert combo.findText('lanczos') == 5
def test_interpolation(): """Test setting image interpolation mode.""" np.random.seed(0) data = np.random.random((10, 15)) layer = Image(data) with pytest.deprecated_call(): assert layer.interpolation == 'nearest' assert layer.interpolation2d == 'nearest' assert layer.interpolation3d == 'linear' layer = Image(data, interpolation2d='bicubic') assert layer.interpolation2d == 'bicubic' with pytest.deprecated_call(): assert layer.interpolation == 'bicubic' layer.interpolation2d = 'bilinear' assert layer.interpolation2d == 'bilinear' with pytest.deprecated_call(): assert layer.interpolation == 'bilinear'
def test_interpolation(): """Test setting image interpolation mode.""" shapes = [(40, 20), (20, 10), (10, 5)] np.random.seed(0) data = [np.random.random(s) for s in shapes] layer = Image(data, multiscale=True) with pytest.deprecated_call(): assert layer.interpolation == 'nearest' assert layer.interpolation2d == 'nearest' assert layer.interpolation3d == 'linear' layer = Image(data, multiscale=True, interpolation2d='bicubic') assert layer.interpolation2d == 'bicubic' with pytest.deprecated_call(): assert layer.interpolation == 'bicubic' layer.interpolation2d = 'bilinear' with pytest.deprecated_call(): assert layer.interpolation == 'bilinear' assert layer.interpolation2d == 'bilinear'