code: def test_event_order():
      """Test event order"""
      x = list()
  
      class MyCanvas(Canvas):
          def on_initialize(self, event):
              x.append("init")
  
          def on_draw(self, event):
              sz = True if self.size is not None else False
              x.append("draw size=%s show=%s" % (sz, show))
  
          def on_close(self, event):
              x.append("close")
  
      for show in (False, True):
          # clear our storage variable
          while x:
              x.pop()
          with MyCanvas(show=show) as c:
              c.update()
              c.app.process_events()
  
          print(x)
          assert_true(len(x) >= 3)
          assert_equal(x[0], "init")
          assert_in("draw size=True", x[1])
          assert_in("draw size=True", x[-2])
          assert_equal(x[-1], "close")
          del c
          gc.collect()
  
imports: import sys
  from collections import namedtuple
  from io import StringIO
  from time import sleep
  import gc
  import numpy
  from numpy.testing import assert_array_equal
  import pytest
  from vispy.app import use_app, Canvas, Timer, MouseEvent, KeyEvent
  from vispy.app.base import BaseApplicationBackend
  from vispy.testing import requires_application, SkipTest, assert_is, assert_in, run_tests_if_main, assert_equal, assert_true, assert_raises, IS_TRAVIS_CI
  from vispy.util import keys, use_log_level
  from vispy.gloo.program import Program, VertexBuffer, IndexBuffer
  from vispy.gloo.util import _screenshot
  from vispy.gloo import gl
label_desc: Use image node_id 10 for calling a global function with example usage: test_event_order() without return types