()
| 5 | |
| 6 | |
| 7 | def test_scatterplotitem(): |
| 8 | app = pg.mkQApp() |
| 9 | |
| 10 | plot = pg.PlotWidget() |
| 11 | # set view range equal to its bounding rect. |
| 12 | # This causes plots to look the same regardless of pxMode. |
| 13 | plot.setRange(rect=plot.boundingRect()) |
| 14 | |
| 15 | # test SymbolAtlas accepts custom symbol |
| 16 | s = pg.ScatterPlotItem(name="Scatter") |
| 17 | symbol = QtGui.QPainterPath() |
| 18 | symbol.addEllipse(QtCore.QRectF(-0.5, -0.5, 1, 1)) |
| 19 | s.addPoints([{'pos': [0, 0], 'data': 1, 'symbol': symbol}]) |
| 20 | |
| 21 | assert s.name() == "Scatter" |
| 22 | |
| 23 | for i, pxMode in enumerate([True, False]): |
| 24 | for j, useCache in enumerate([True, False]): |
| 25 | s = pg.ScatterPlotItem() |
| 26 | s.opts['useCache'] = useCache |
| 27 | plot.addItem(s) |
| 28 | s.setData(x=np.array([10, 40, 20, 30]) + i * 100, |
| 29 | y=np.array([40, 60, 10, 30]) + j * 100, pxMode=pxMode, |
| 30 | name="MoreScatter") |
| 31 | s.addPoints(x=np.array([60, 70]) + i * 100, |
| 32 | y=np.array([60, 70]) + j * 100, size=[20, 30]) |
| 33 | |
| 34 | assert s.name() == "MoreScatter" |
| 35 | # Test uniform spot updates |
| 36 | s.setSize(10) |
| 37 | s.setBrush('r') |
| 38 | s.setPen('g') |
| 39 | s.setSymbol('+') |
| 40 | app.processEvents() |
| 41 | |
| 42 | # Test list spot updates |
| 43 | s.setSize([10] * 6) |
| 44 | s.setBrush([pg.mkBrush('r')] * 6) |
| 45 | s.setPen([pg.mkPen('g')] * 6) |
| 46 | s.setSymbol(['+'] * 6) |
| 47 | s.setPointData([s] * 6) |
| 48 | app.processEvents() |
| 49 | |
| 50 | # Test array spot updates |
| 51 | s.setSize(np.array([10] * 6)) |
| 52 | s.setBrush(np.array([pg.mkBrush('r')] * 6)) |
| 53 | s.setPen(np.array([pg.mkPen('g')] * 6)) |
| 54 | s.setSymbol(np.array(['+'] * 6)) |
| 55 | s.setPointData(np.array([s] * 6)) |
| 56 | app.processEvents() |
| 57 | |
| 58 | # Test per-spot updates |
| 59 | spot = s.points()[0] |
| 60 | spot.setSize(20) |
| 61 | spot.setBrush('b') |
| 62 | spot.setPen('g') |
| 63 | spot.setSymbol('o') |
| 64 | spot.setData(None) |
nothing calls this directly
no test coverage detected
searching dependent graphs…