code: def test_widget_slider(uniform):
      p = pv.Plotter()
      func = lambda value: value  # Does nothing
      p.add_mesh(uniform)
      p.add_slider_widget(callback=func, rng=[0, 10], style="classic")
      p.close()
  
      p = pv.Plotter()
      for interaction_event in ["start", "end", "always"]:
          p.add_slider_widget(
              callback=func,
              rng=[0, 10],
              interaction_event=interaction_event,
          )
      with pytest.raises(TypeError, match="type for ``style``"):
          p.add_slider_widget(callback=func, rng=[0, 10], style=0)
      with pytest.raises(AttributeError):
          p.add_slider_widget(callback=func, rng=[0, 10], style="foo")
      with pytest.raises(
          TypeError, match="Expected type for `interaction_event`"
      ):
          p.add_slider_widget(
              callback=func, rng=[0, 10], interaction_event=0
          )
      with pytest.raises(
          ValueError, match="Expected value for `interaction_event`"
      ):
          p.add_slider_widget(
              callback=func, rng=[0, 10], interaction_event="foo"
          )
      p.close()
  
      p = pv.Plotter()
      func = lambda value, widget: value  # Does nothing
      p.add_mesh(uniform)
      p.add_slider_widget(
          callback=func, rng=[0, 10], style="modern", pass_widget=True
      )
      p.close()
  
      p = pv.Plotter()
      p.add_mesh_threshold(uniform, invert=True)
      p.add_mesh(uniform.outline())
      p.close()
  
      p = pv.Plotter()
      p.add_mesh_threshold(uniform, invert=False)
      p.add_mesh(uniform.outline())
      p.close()
  
      p = pv.Plotter()
      p.add_mesh_isovalue(uniform)
      p.close()
  
      func = lambda value: value  # Does nothing
      p = pv.Plotter()
      title_height = np.random.default_rng().random()
      s = p.add_slider_widget(
          callback=func,
          rng=[0, 10],
          style="classic",
          title_height=title_height,
      )
      assert s.GetRepresentation().GetTitleHeight() == title_height
      p.close()
  
      p = pv.Plotter()
      title_opacity = np.random.default_rng().random()
      s = p.add_slider_widget(
          callback=func,
          rng=[0, 10],
          style="classic",
          title_opacity=title_opacity,
      )
      assert (
          s.GetRepresentation().GetTitleProperty().GetOpacity()
          == title_opacity
      )
      p.close()
  
      p = pv.Plotter()
      title_color = "red"
      s = p.add_slider_widget(
          callback=func,
          rng=[0, 10],
          style="classic",
          title_color=title_color,
      )
      assert (
          s.GetRepresentation().GetTitleProperty().GetColor()
          == pv.Color(title_color)
      )
      p.close()
  
      p = pv.Plotter()
      fmt = "%0.9f"
      s = p.add_slider_widget(
          callback=func, rng=[0, 10], style="classic", fmt=fmt
      )
      assert s.GetRepresentation().GetLabelFormat() == fmt
      p.close()
  
      # custom width
      p = pv.Plotter()
      slider = p.add_slider_widget(
          callback=func,
          rng=[0, 10],
          fmt=fmt,
          tube_width=0.1,
          slider_width=0.2,
      )
      assert slider.GetRepresentation().GetSliderWidth() == 0.2
      assert slider.GetRepresentation().GetTubeWidth() == 0.1
      p.close()
  
imports: import numpy
  import pytest
  import vtk
  import pyvista
  from pyvista import examples
  from pyvista.core.errors import VTKVersionError
  from pyvista.plotting.affine_widget import DARK_YELLOW, get_angle, ray_plane_intersection
label_desc: Use image node_id 6 for calling a global function with example usage: test_widget_slider(uniform) without return types