code: def test_wrappers_glir():
      """Test that special wrapper functions do what they must do"""
      glir = install_dummy_glir()
  
      # Test clear() function
      gloo.clear()
      cmds = glir.clear()
      assert len(cmds) == 1
      assert cmds[0][0] == "FUNC"
      assert cmds[0][1] == "glClear"
      #
      gloo.clear(True, False, False)
      cmds = glir.clear()
      assert len(cmds) == 1
      assert cmds[0][0] == "FUNC"
      assert cmds[0][1] == "glClear"
      assert cmds[0][2] == gl.GL_COLOR_BUFFER_BIT
      #
      gloo.clear("red")
      cmds = glir.clear()
      assert len(cmds) == 2
      assert cmds[0][0] == "FUNC"
      assert cmds[0][1] == "glClearColor"
      assert cmds[1][0] == "FUNC"
      assert cmds[1][1] == "glClear"
      #
      gloo.clear("red", 4, 3)
      cmds = glir.clear()
      assert len(cmds) == 4
      assert cmds[0][1] == "glClearColor"
      assert cmds[1][1] == "glClearDepth"
      assert cmds[2][1] == "glClearStencil"
      assert cmds[3][1] == "glClear"
  
      # Test set_state() function
      gloo.set_state(foo=True, bar=False)
      cmds = set(glir.clear())
      assert len(cmds) == 2
      assert ("FUNC", "glEnable", "foo") in cmds
      assert ("FUNC", "glDisable", "bar") in cmds
      #
      gloo.set_state(viewport=(0, 0, 10, 10), clear_color="red")
      cmds = sorted(glir.clear())
      assert len(cmds) == 2
      assert cmds[0][1] == "glClearColor"
      assert cmds[1][1] == "glViewport"
      #
      presets = gloo.get_state_presets()
      a_preset = list(presets.keys())[0]
      gloo.set_state(a_preset)
      cmds = sorted(glir.clear())
      assert len(cmds) == len(presets[a_preset])
  
      reset_glir()
  
file_path: vispy/vispy/gloo/tests/test_wrappers.py
imports: import numpy
  from numpy.testing import assert_array_equal, assert_allclose
  from vispy import gloo
  from vispy.gloo import gl
  from vispy.app import Canvas
  from vispy.testing import requires_application, run_tests_if_main, assert_true, assert_equal, assert_raises
  from vispy.gloo import read_pixels
  from vispy.gloo.glir import GlirQueue
  from vispy.gloo import wrappers
label_desc: Use image node_id 5 for calling a global function with example usage: test_wrappers_glir() without return types