code: def test_mesh_normals():
      size = (45, 40)
      with TestingCanvas(size=size, bgcolor="k") as c:
          v = c.central_widget.add_view(border_width=0)
          v.camera = "arcball"
          # Create visual.
          mdata = create_sphere(radius=1.0)
          mesh = scene.visuals.Mesh(
              meshdata=mdata, shading=None, color=(0.1, 0.1, 0.1, 1.0)
          )
          v.add(mesh)
  
          rendered_without_normals = c.render()
          # The color should be of low intensity.
          assert np.all((rendered_without_normals[..., 0:3]) < 32)
  
          face_normals = scene.visuals.MeshNormals(
              mdata, primitive="face", color=(1, 0, 0)
          )
          face_normals.parent = mesh
          rendered_with_face_normals = c.render()
          face_normals.parent = None
          # There should be some pixels with brighter red.
          assert np.sum(rendered_with_face_normals[..., 0] > 128) > 64
          pytest.raises(
              AssertionError,
              np.testing.assert_allclose,
              rendered_without_normals,
              rendered_with_face_normals,
          )
  
          vertex_normals = scene.visuals.MeshNormals(
              mdata, primitive="vertex", color=(0, 1, 0)
          )
          vertex_normals.parent = mesh
          rendered_with_vertex_normals = c.render()
          vertex_normals.parent = None
          # There should be some pixels with brighter green.
          assert np.sum(rendered_with_vertex_normals[..., 1] > 128) > 64
          pytest.raises(
              AssertionError,
              np.testing.assert_allclose,
              rendered_without_normals,
              rendered_with_vertex_normals,
          )
          pytest.raises(
              AssertionError,
              np.testing.assert_allclose,
              rendered_with_face_normals,
              rendered_with_vertex_normals,
          )
  
file_path: vispy/vispy/visuals/tests/test_mesh_normals.py
imports: import numpy
  import pytest
  from vispy import scene
  from vispy.geometry import create_sphere
  from vispy.testing import TestingCanvas, requires_application, run_tests_if_main, requires_pyopengl
label_desc: Use image node_id 1 for calling a global function with example usage: test_mesh_normals() without return types