@requires_application()
def 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):
  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')

@ requires_application ( ) def 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 ) : 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' )
test event order .