@requires_application()
def test_linear_region_gradient():
 pos2 = [5, 42, 80]
 color2 = np.array([[0.0, 1.0, 0.0, 0.5], [1.0, 0.0, 0.0, 0.75], [0.0, 0.0, 1.0, 1.0]], dtype=np.float32)
 color2_expected = np.array([color2[0], color2[0], color2[1], color2[1], color2[2], color2[2]], dtype=np.float32)
 with TestingCanvas() as c:
  region = visuals.LinearRegion(pos=pos2, color=color2, parent=c.scene)
  assert np.all((region._color == color2_expected))
  assert np.all((region.color == color2))
  assert_image_approved(c.render(), 'visuals/linear_region2.png')

@ requires_application ( ) def test_linear_region_gradient ( ) : pos2 = [ 5 , 42 , 80 ] color2 = np . array ( [ [ 0.0 , 1.0 , 0.0 , 0.5 ] , [ 1.0 , 0.0 , 0.0 , 0.75 ] , [ 0.0 , 0.0 , 1.0 , 1.0 ] ] , dtype = np . float32 ) color2_expected = np . array ( [ color2 [ 0 ] , color2 [ 0 ] , color2 [ 1 ] , color2 [ 1 ] , color2 [ 2 ] , color2 [ 2 ] ] , dtype = np . float32 ) with TestingCanvas ( ) as c : region = visuals . LinearRegion ( pos = pos2 , color = color2 , parent = c . scene ) assert np . all ( ( region . _color == color2_expected ) ) assert np . all ( ( region . color == color2 ) ) assert_image_approved ( c . render ( ) , 'visuals/linear_region2.png' )
test linearregionvisual with a gradient as color .