code: def test_transform_chain():
      # Make dummy classes for easier distinguishing the transforms
  
      class DummyTrans(tr.BaseTransform):
          glsl_map = "vec4 trans(vec4 pos) {return pos;}"
          glsl_imap = "vec4 trans(vec4 pos) {return pos;}"
  
      class TransA(DummyTrans):
          pass
  
      class TransB(DummyTrans):
          pass
  
      class TransC(DummyTrans):
          pass
  
      # Create test transforms
      a, b, c = TransA(), TransB(), TransC()
  
      # Test Chain creation
      assert tr.ChainTransform().transforms == []
      assert tr.ChainTransform(a).transforms == [a]
      assert tr.ChainTransform(a, b).transforms == [a, b]
      assert tr.ChainTransform(a, b, c, a).transforms == [a, b, c, a]
  
      # Test composition by multiplication
      assert_chain_objects(a * b, tr.ChainTransform(a, b))
      assert_chain_objects(a * b * c, tr.ChainTransform(a, b, c))
      assert_chain_objects(a * b * c * a, tr.ChainTransform(a, b, c, a))
  
      # Test adding/prepending to transform
      chain = tr.ChainTransform()
      chain.append(a)
      assert chain.transforms == [a]
      chain.append(b)
      assert chain.transforms == [a, b]
      chain.append(c)
      assert chain.transforms == [a, b, c]
      chain.prepend(b)
      assert chain.transforms == [b, a, b, c]
      chain.prepend(c)
      assert chain.transforms == [c, b, a, b, c]
  
      # Test simplifying
      t1 = tr.STTransform(scale=(2, 3))
      t2 = tr.STTransform(translate=(3, 4))
      t3 = tr.STTransform(translate=(3, 4))
      # Create multiplied versions
      t123 = t1 * t2 * t3
      t321 = t3 * t2 * t1
      c123 = tr.ChainTransform(t1, t2, t3)
      c321 = tr.ChainTransform(t3, t2, t1)
      c123s = c123.simplified
      c321s = c321.simplified
      #
      assert isinstance(t123, tr.STTransform)  # or the test is useless
      assert isinstance(t321, tr.STTransform)  # or the test is useless
      assert isinstance(
          c123s, tr.ChainTransform
      )  # or the test is useless
      assert isinstance(
          c321s, tr.ChainTransform
      )  # or the test is useless
  
      # Test Mapping
      t1 = tr.STTransform(scale=(2, 3))
      t2 = tr.STTransform(translate=(3, 4))
      chain1 = tr.ChainTransform(t1, t2)
      chain2 = tr.ChainTransform(t2, t1)
      #
      assert chain1.transforms == [t1, t2]  # or the test is useless
      assert chain2.transforms == [t2, t1]  # or the test is useless
      #
      m12 = (t1 * t2).map((1, 1)).tolist()
      m21 = (t2 * t1).map((1, 1)).tolist()
      m12_ = chain1.map((1, 1)).tolist()
      m21_ = chain2.map((1, 1)).tolist()
      #
      # print(m12, m21, m12_, m21_)
      assert m12 != m21
      assert m12 == m12_
      assert m21 == m21_
  
      # Test shader map
      t1 = tr.STTransform(scale=(2, 3))
      t2 = tr.STTransform(translate=(3, 4))
      chain = tr.ChainTransform(t1, t2)
      #
      funcs = chain.shader_map().dependencies()
      funcsi = chain.shader_imap().dependencies()
      #
      assert t1.shader_map() in funcs
      assert t2.shader_map() in funcs
      assert t1.shader_imap() in funcsi
      assert t2.shader_imap() in funcsi
  
file_path: vispy/vispy/visuals/transforms/tests/test_transforms.py
imports: import numpy
  from numpy.testing import assert_allclose
  import pytest
  import vispy.visuals.transforms
  from vispy.geometry import Rect
  from vispy.testing import run_tests_if_main
label_desc: Use image node_id 4 for calling a global function with example usage: test_transform_chain() without return types