pyqtgraph/tests/imageview/test_imageview.py
magnium 6f4b6b1b88
Fix ImageView levelMode (#1974)
* fixes #1769

* Automatically set image to ImageView if imageItem is provided.
Added a test for correct initialization of ImageView with imageItem and levelMode.
2021-09-07 21:27:26 -07:00

19 lines
449 B
Python

import pyqtgraph as pg
import numpy as np
app = pg.mkQApp()
def test_nan_image():
img = np.ones((10,10))
img[0,0] = np.nan
v = pg.image(img)
v.imageItem.getHistogram()
app.processEvents()
v.window().close()
def test_init_with_mode_and_imageitem():
data = np.random.randint(256, size=(256, 256, 3))
imgitem = pg.ImageItem(data)
pg.ImageView(imageItem=imgitem, levelMode="rgba")
assert(pg.image is not None)