def test_controller_set_cut_high(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_controller = histogram.HistogramController(model, test_hist) test_controller.set_cut_high(42) assert model.cut_high == 42 assert model.view_cuts[1] == 42
def test_controller_set_cut_low(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_controller = histogram.HistogramController(model, test_hist) test_controller.set_cut_low(24) assert model.cut_low == 24 assert model.view_cuts[0] == 24
def test_histogram_change_cut_high(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_hist._set_vlines() model._cut_high = 42 test_hist.change_cut_high(draw=False) assert test_hist._right_vline.get_xdata()[0] == 42 assert test_hist._left_vline.get_xdata()[0] == model.cut_low
def test_histogram_set_vlines(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_hist._set_vlines() assert isinstance(test_hist._left_vline, Line2D) assert isinstance(test_hist._right_vline, Line2D) assert test_hist._left_vline.get_xdata()[0] == model.cut_low assert test_hist._right_vline.get_xdata()[0] == model.cut_high
def test_histogram_init(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) assert test_hist.model == model assert test_hist in model._views assert test_hist.sizePolicy().hasHeightForWidth() assert test_hist._right_vline is None assert test_hist._left_vline is None
def test_histogram_change_bins(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_hist.set_data() assert model.bins == 100 assert len(test_hist._ax.patches) == 100 model._bins = 50 test_hist.change_bins() assert len(test_hist._ax.patches) == 50
def test_controller_set_cuts(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_controller = histogram.HistogramController(model, test_hist) test_controller.set_cuts(10, 100) assert model.cut_low == 10 assert model.cut_high == 100 assert model.cuts == (10, 100) assert model.view_cuts == (10, 100)
def test_controller_restore(): model = histogram.HistogramModel(image_view) def_cuts = model.view_cuts test_hist = histogram.Histogram(model) test_controller = histogram.HistogramController(model, test_hist) model.cuts = 24, 42 image_view.cut_levels(*def_cuts) test_controller.restore() assert model.cuts != (24, 42) assert model.cuts == def_cuts assert model.view_cuts == def_cuts
def test_controller_set_bins(): model = histogram.HistogramModel(image_view) test_hist = histogram.Histogram(model) test_controller = histogram.HistogramController(model, test_hist) test_controller.set_bins(50) assert model.bins == 50