Skip to content

Commit

Permalink
Add test with 2 items without legend
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Dec 8, 2023
1 parent f8ec2cd commit 0c14386
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/silx/gui/plot/test/testItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from silx.gui.utils.testutils import SignalListener
from silx.gui.plot.items.roi import RegionOfInterest
from silx.gui.plot.items import ItemChangedType
from silx.gui.plot import items
from silx.gui.plot import items, PlotWidget
from .utils import PlotWidgetTestCase


Expand Down Expand Up @@ -386,3 +386,25 @@ def testRegionOfInterestText():
ItemChangedType.NAME, ItemChangedType.TEXT
]
assert roi.getText() == "even_newer_name"


def testPlotAddItemsWithoutLegend(qWidgetFactory):
plotWidget = qWidgetFactory(PlotWidget)

curve1 = items.Curve()
curve1.setData([0, 10], [0, 20])
plotWidget.addItem(curve1)

curve2 = items.Curve()
curve2.setData([0, -10], [0, -20])
plotWidget.addItem(curve2)

assert plotWidget.getItems() == curve1, curve2

datarange = plotWidget.getDataRange()
assert datarange.x == -10, 10
assert datarange.y == -20, 20

plotWidget.resetZoom()
assert plotWidget.getXAxis().getLimits() == -10, 10
assert plotWidget.getYAxis().getLimits() == -20, 20

0 comments on commit 0c14386

Please sign in to comment.