code: def test_mesh_normals_length_scale():
      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.
          meshdata = create_sphere(radius=1.0)
          mesh = scene.visuals.Mesh(
              meshdata=meshdata,
              shading=None,
              color=(0.1, 0.1, 0.1, 1.0),
          )
          v.add(mesh)
  
          length = 1.0
          length_scale_up = 2.0
          length_scale_down = 0.5
  
          normals = scene.visuals.MeshNormals(
              meshdata, color=(1, 0, 0), length=length
          )
          normals.parent = mesh
          rendered_length_default = c.render()
          normals.parent = None
  
          normals_scaled_up = scene.visuals.MeshNormals(
              meshdata,
              color=(1, 0, 0),
              length=length,
              length_scale=length_scale_up,
          )
          normals_scaled_up.parent = mesh
          rendered_length_scaled_up = c.render()
          normals_scaled_up.parent = None
  
          normals_scaled_down = scene.visuals.MeshNormals(
              meshdata,
              color=(1, 0, 0),
              length=length,
              length_scale=length_scale_down,
          )
          normals_scaled_down.parent = mesh
          rendered_length_scaled_down = c.render()
          normals_scaled_down.parent = None
  
          # There should be more red pixels with the scaled-up normals and less
          # with the ones scaled down.
          n_pixels_default = np.sum(
              rendered_length_default[..., 0] > 128
          )
          n_pixels_scaled_up = np.sum(
              rendered_length_scaled_up[..., 0] > 128
          )
          n_pixels_scaled_down = np.sum(
              rendered_length_scaled_down[..., 0] > 128
          )
          assert (
              n_pixels_scaled_down
              < n_pixels_default
              < n_pixels_scaled_up
          )
  
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 4 for calling a global function with example usage: test_mesh_normals_length_scale() without return types