0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix(figure): subplot methods consolidated; added subplot factory

This commit is contained in:
2024-06-27 16:38:08 +02:00
parent 797f73c39a
commit 4a97105e4b
4 changed files with 37 additions and 117 deletions

View File

@ -11,7 +11,7 @@ from .test_bec_figure import bec_figure
def test_adding_curve_to_waveform(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
# adding curve which is in bec - only names
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
@ -39,7 +39,7 @@ def test_adding_curve_to_waveform(bec_figure):
def test_adding_curve_with_same_id(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i", gui_id="test_curve")
with pytest.raises(ValueError) as excinfo:
@ -122,9 +122,10 @@ def test_create_waveform1D_by_config(bec_figure):
},
}
w1 = bec_figure.add_plot(config=w1_config_input)
w1 = bec_figure.plot(config=w1_config_input)
w1_config_output = w1.get_config()
w1_config_input["gui_id"] = w1.gui_id
assert w1_config_input == w1_config_output
assert w1.plot_item.titleLabel.text == "Widget 1"
@ -132,7 +133,7 @@ def test_create_waveform1D_by_config(bec_figure):
def test_change_gui_id(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
w1.change_gui_id("new_id")
@ -141,7 +142,7 @@ def test_change_gui_id(bec_figure):
def test_getting_curve(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i", gui_id="test_curve")
c1_expected_config = CurveConfig(
widget_class="BECCurve",
@ -171,7 +172,7 @@ def test_getting_curve(bec_figure):
def test_getting_curve_errors(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i", gui_id="test_curve")
with pytest.raises(ValueError) as excinfo:
@ -188,7 +189,7 @@ def test_getting_curve_errors(bec_figure):
def test_add_curve(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
@ -199,7 +200,7 @@ def test_add_curve(bec_figure):
def test_change_legend_font_size(bec_figure):
plot = bec_figure.add_plot()
plot = bec_figure.plot()
w1 = plot.add_curve_scan(x_name="samx", y_name="bpm4i")
my_func = plot.plot_item.legend
@ -211,7 +212,7 @@ def test_change_legend_font_size(bec_figure):
def test_remove_curve(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
w1.add_curve_scan(x_name="samx", y_name="bpm4i")
w1.add_curve_scan(x_name="samx", y_name="bpm3a")
@ -229,7 +230,7 @@ def test_remove_curve(bec_figure):
def test_change_curve_appearance_methods(bec_figure, qtbot):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
@ -258,7 +259,7 @@ def test_change_curve_appearance_methods(bec_figure, qtbot):
def test_change_curve_appearance_args(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
@ -288,7 +289,7 @@ def test_change_curve_appearance_args(bec_figure):
def test_set_custom_curve_data(bec_figure, qtbot):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_custom(
x=[1, 2, 3],
@ -336,7 +337,7 @@ def test_custom_data_2D_array(bec_figure, qtbot):
def test_get_all_data(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_custom(
x=[1, 2, 3],
@ -371,7 +372,7 @@ def test_get_all_data(bec_figure):
def test_curve_add_by_config(bec_figure):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1_config_input = {
"widget_class": "BECCurve",
@ -411,7 +412,7 @@ def test_curve_add_by_config(bec_figure):
def test_scan_update(bec_figure, qtbot):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
@ -445,7 +446,7 @@ def test_scan_update(bec_figure, qtbot):
def test_scan_history_with_val_access(bec_figure, qtbot):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="bpm4i")
@ -470,7 +471,7 @@ def test_scan_history_with_val_access(bec_figure, qtbot):
def test_scatter_2d_update(bec_figure, qtbot):
w1 = bec_figure.add_plot()
w1 = bec_figure.plot()
c1 = w1.add_curve_scan(x_name="samx", y_name="samx", z_name="bpm4i")