code: def test_brain_time_viewer(
      renderer_interactive_pyvistaqt, pixel_ratio, brain_gc
  ):
      """Test time viewer primitives."""
      with pytest.raises(ValueError, match="between 0 and 1"):
          _create_testing_brain(hemi="lh", show_traces=-1.0)
      with pytest.raises(ValueError, match="got unknown keys"):
          _create_testing_brain(
              hemi="lh",
              surf="white",
              src="volume",
              volume_options={"foo": "bar"},
          )
      brain = _create_testing_brain(
          hemi="both",
          show_traces=False,
          brain_kwargs=dict(silhouette=dict(decimate=0.95)),
      )
      # test sub routines when show_traces=False
      brain._on_pick(None, None)
      brain._configure_vertex_time_course()
      brain._configure_label_time_course()
      brain.setup_time_viewer()  # for coverage
      brain.set_time(1)
      brain.set_time_point(0)
      brain.show_view("lat")
      brain.show_view("medial")
      brain.set_data_smoothing(1)
      _assert_brain_range(brain, [0.1, 0.3])
      from mne.utils import use_log_level
  
      with use_log_level("debug"):
          brain.update_lut(fmin=12.0)
      assert brain._data["fmin"] == 12.0
      brain.update_lut(fmax=4.0)
      _assert_brain_range(brain, [4.0, 4.0])
      brain.update_lut(fmid=6.0)
      _assert_brain_range(brain, [4.0, 6.0])
      brain.update_lut(fmid=4.0)
      brain._update_fscale(1.2**0.25)
      brain._update_fscale(1.2**-0.25)
      brain.update_lut(fmin=12.0, fmid=4.0)
      _assert_brain_range(brain, [4.0, 12.0])
      # one at a time no-op
      r_, d_, a_, e_, f_ = brain.get_view()
      _assert_view_allclose(brain, r_, d_, a_, e_, f_)
      brain.show_view(verbose="debug")  # should be a no-op
      _assert_view_allclose(brain, r_, d_, a_, e_, f_)
      brain._set_camera(verbose="debug")  # also no-op
      _assert_view_allclose(brain, r_, d_, a_, e_, f_)
      want_view = np.array([r_, d_, a_, e_], float)  # ignore focalpoint
      for k, v in (
          ("roll", r_),
          ("distance", d_),
          ("azimuth", a_),
          ("elevation", e_),
      ):
          brain.show_view(**{k: v})
          _assert_view_allclose(brain, r_, d_, a_, e_, f_)
      got_view = np.array(brain.get_view()[:4], float)
      assert_allclose(got_view, want_view, rtol=1e-5, atol=1e-6)
      brain._rotate_camera("azimuth", 15)
      want_view[2] += 15
      got_view = np.array(brain.get_view()[:4], float)
      # roll changes when you adjust these because of the affine
      assert_allclose(got_view[1:], want_view[1:], rtol=1e-5, atol=1e-6)
      brain._rotate_camera("elevation", 15)
      want_view[3] += 15
      got_view = np.array(brain.get_view()[:4], float)
      assert_allclose(got_view[1:], want_view[1:], rtol=1e-5, atol=1e-6)
      brain.toggle_interface()
      brain.toggle_interface(value=False)
      brain.set_playback_speed(0.1)
      brain.toggle_playback()
      brain.toggle_playback(value=False)
      brain.apply_auto_scaling()
      brain.restore_user_scaling()
      brain.reset()
  
      assert brain.help_canvas is not None
      assert not brain.help_canvas.canvas.isVisible()
      brain.help()
      assert brain.help_canvas.canvas.isVisible()
  
      # screenshot
      # Need to turn the interface back on otherwise the window is too wide
      # (it keeps the window size and expands the 3D area when the interface
      # is toggled off)
      brain.toggle_interface(value=True)
      brain.show_view(azimuth=180.0, elevation=90.0)
      img = brain.screenshot(mode="rgb")
      want_shape = np.array([300 * pixel_ratio, 300 * pixel_ratio, 3])
      assert_allclose(img.shape, want_shape, atol=30)
      brain.close()
  
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 14 for calling a global function with example usage: test_brain_time_viewer(renderer_interactive_pyvistaqt, pixel_ratio, brain_gc) without return types