def test_PlotCurvesItem_bounds(self):
pc = PlotCurvesItem()
# test defaults
np.testing.assert_equal(pc.boundingRect(), QRectF(0, 0, 1, 1))
pc.add_curve(pg.PlotCurveItem(x=[0, 1], y=[NAN, NAN]))
np.testing.assert_equal(pc.boundingRect(), QRectF(0, 0, 1, 1))
pc.add_curve(pg.PlotCurveItem(x=[-1, 2], y=[NAN, NAN]))
np.testing.assert_equal(pc.boundingRect(), QRectF(-1, 0, 3, 1))
# valid y values should overwrite the defaults
pc.add_curve(pg.PlotCurveItem(x=[-1, 2], y=[0.1, 0.2]))
np.testing.assert_equal(pc.boundingRect(), QRectF(-1, 0.1, 3, 0.1))
评论列表
文章目录