code: def test_layered_mesh(renderer_interactive_pyvistaqt):
      """Test management of scalars/colormap overlay."""
      mesh = _LayeredMesh(
          renderer=renderer_interactive_pyvistaqt._get_renderer(
              size=(300, 300)
          ),
          vertices=np.array(
              [[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0]]
          ),
          triangles=np.array([[0, 1, 2], [1, 2, 3]]),
          normals=np.array([[0, 0, 1]] * 4),
      )
      assert not mesh._is_mapped
      mesh.map()
      assert mesh._is_mapped
      assert mesh._current_colors is None
      assert mesh._cached_colors is None
      mesh.update()
      assert len(mesh._overlays) == 0
      mesh.add_overlay(
          scalars=np.array([0, 1, 1, 0]),
          colormap=np.array([(1, 1, 1, 1), (0, 0, 0, 0)]),
          rng=[0, 1],
          opacity=None,
          name="test1",
      )
      assert mesh._current_colors is not None
      assert mesh._cached_colors is None
      assert len(mesh._overlays) == 1
      assert "test1" in mesh._overlays
      mesh.add_overlay(
          scalars=np.array([1, 0, 0, 1]),
          colormap=np.array([(1, 1, 1, 1), (0, 0, 0, 0)]),
          rng=[0, 1],
          opacity=None,
          name="test2",
      )
      assert mesh._current_colors is not None
      assert mesh._cached_colors is not None
      assert len(mesh._overlays) == 2
      assert "test2" in mesh._overlays
      mesh.remove_overlay("test2")
      assert "test2" not in mesh._overlays
      mesh.update()
      assert len(mesh._overlays) == 1
      mesh._clean()
  
imports: import os
  import platform
  from pathlib import Path
  from shutil import copyfile
  import numpy
  import pytest
  from matplotlib import image
  from matplotlib.lines import Line2D
  from numpy.testing import assert_allclose, assert_array_equal
  from mne import Dipole, MixedSourceEstimate, SourceEstimate, VolSourceEstimate, create_info, pick_types_forward, read_cov, read_evokeds, read_forward_solution, read_source_estimate, vertex_to_mni, write_surface
  from mne.channels import make_dig_montage
  from mne.datasets import testing
  from mne.io import read_info
  from mne.label import read_label
  from mne.minimum_norm import apply_inverse, make_inverse_operator
  from mne.source_estimate import _BaseSourceEstimate
  from mne.source_space import read_source_spaces, setup_volume_source_space
  from mne.utils import check_version
  from mne.viz import ui_events
  from mne.viz._brain import Brain, _BrainScraper, _LayeredMesh, _LinkViewer
  from mne.viz._brain.colormap import calculate_lut
  from mne.viz.utils import _get_cmap
label_desc: Use image node_id 1 for calling a global function with example usage: test_layered_mesh(renderer_interactive_pyvistaqt) without return types