mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
test: add tests for name creation of custom curves, and object name handling
This commit is contained in:
@ -79,7 +79,7 @@ class ScatterCurve(BECConnector, pg.PlotDataItem):
|
|||||||
name = config.label
|
name = config.label
|
||||||
self.parent_item = parent_item
|
self.parent_item = parent_item
|
||||||
self.parent_id = self.parent_item.gui_id
|
self.parent_id = self.parent_item.gui_id
|
||||||
object_name = name.replace("-", "_") if name else None
|
object_name = name.replace("-", "_").replace(" ", "_") if name else None
|
||||||
super().__init__(name=name, object_name=object_name, config=config, gui_id=gui_id, **kwargs)
|
super().__init__(name=name, object_name=object_name, config=config, gui_id=gui_id, **kwargs)
|
||||||
|
|
||||||
self.data_z = None # color scaling needs to be cashed for changing colormap
|
self.data_z = None # color scaling needs to be cashed for changing colormap
|
||||||
|
@ -35,10 +35,22 @@ def test_rpc_plotting_shortcuts_init_configs(qtbot, connected_client_gui_obj):
|
|||||||
mw = dock.new("mw_dock").new("MultiWaveform")
|
mw = dock.new("mw_dock").new("MultiWaveform")
|
||||||
|
|
||||||
c1 = wf.plot(x_name="samx", y_name="bpm4i")
|
c1 = wf.plot(x_name="samx", y_name="bpm4i")
|
||||||
|
# Adding custom curves, removing one and adding it again should not crash
|
||||||
|
c2 = wf.plot(y=[1, 2, 3], x=[1, 2, 3])
|
||||||
|
assert c2.object_name == "Curve_0"
|
||||||
|
c2.remove()
|
||||||
|
c3 = wf.plot(y=[1, 2, 3], x=[1, 2, 3])
|
||||||
|
assert c3.object_name == "Curve_0"
|
||||||
|
|
||||||
im_item = im.image(monitor="eiger")
|
im_item = im.image(monitor="eiger")
|
||||||
mm.map(x_name="samx", y_name="samy")
|
mm.map(x_name="samx", y_name="samy")
|
||||||
sw.plot(x_name="samx", y_name="samy", z_name="bpm4i")
|
sw.plot(x_name="samx", y_name="samy", z_name="bpm4i")
|
||||||
|
assert sw.main_curve.object_name == "bpm4i_bpm4i"
|
||||||
|
# Create a new curve on the scatter waveform should replace the old one
|
||||||
|
sw.plot(x_name="samx", y_name="samy", z_name="bpm4a")
|
||||||
|
assert sw.main_curve.object_name == "bpm4a_bpm4a"
|
||||||
mw.plot(monitor="waveform")
|
mw.plot(monitor="waveform")
|
||||||
|
# Adding multiple custom curves sho
|
||||||
|
|
||||||
# Checking if classes are correctly initialised
|
# Checking if classes are correctly initialised
|
||||||
assert len(dock.panel_list) == 5
|
assert len(dock.panel_list) == 5
|
||||||
|
Reference in New Issue
Block a user