def test_5_on_push_calls_on_enter_on_exit(self): global rec scene0 = Scene() scene1 = Scene() def on_exit(): global rec rec.append('on_exit_called') def on_enter(): global rec rec.append('on_enter_called') scene0.on_exit = on_exit scene1.on_enter = on_enter rec = [] director.on_push(scene0) # pyglet mockup 1 don't tickle on_draw, we call # directly so the push / pop operation completes director.on_draw() rec = [] director.on_push(scene1) director.on_draw() assert rec[0] == 'on_exit_called' assert rec[1] == 'on_enter_called'
def test_5_on_push_calls_on_enter_on_exit(self): global rec scene0 = Scene() scene1 = Scene() def on_exit(): global rec rec.append('on_exit_called') def on_enter(): global rec rec.append('on_enter_called') scene0.on_exit = on_exit scene1.on_enter = on_enter rec = [] director.on_push(scene0) # pyglet mockup 1 don't tickle on_draw, we call # directly so the push / pop operation completes director.on_draw() rec = [] director.on_push(scene1) director.on_draw() assert rec[0]=='on_exit_called' assert rec[1]=='on_enter_called'
def test_1_push(self): old_scene = Scene() director.run(old_scene) new_scene = Scene() new_scene.parent = not_None_value director.on_push(new_scene) # pyglet mockup 1 don't tickle on_draw, we call # directly so the push / pop operation completes director.on_draw() assert new_scene.parent is None
def test_4_on_push_on_pop_and_current_scene(self): scene0 = director.scene scene1 = Scene() scene2 = Scene() director.on_push(scene1) # pyglet mockup 1 don't tickle on_draw, we call # directly so the push / pop operation completes director.on_draw() assert director.scene is scene1 director.on_push(scene2) director.on_draw() assert director.scene is scene2 director.on_pop() director.on_draw() assert director.scene is scene1 director.on_pop() director.on_draw() assert director.scene is scene0
def test_7_replace(self): global rec scene0 = Scene() scene1 = Scene() scene2 = Scene() def on_exit(): global rec rec.append('on_exit_called') def on_enter(): global rec rec.append('on_enter_called') scene1.on_exit = on_exit scene2.on_enter = on_enter director.on_push(scene0) # pyglet mockup 1 don't tickle on_draw, we call # directly so the push / pop operation completes director.on_draw() director.on_push(scene1) director.on_draw() rec = [] director.replace(scene2) director.on_draw() # final scene ok assert director.scene is scene2 # old scene on_exit called, new scene on_enter called assert rec[0] == 'on_exit_called' assert rec[1] == 'on_enter_called' # underlaying scene ok director.on_pop() director.on_draw() assert director.scene is scene0
def test_7_replace(self): global rec scene0 = Scene() scene1 = Scene() scene2 = Scene() def on_exit(): global rec rec.append('on_exit_called') def on_enter(): global rec rec.append('on_enter_called') scene1.on_exit = on_exit scene2.on_enter = on_enter director.on_push(scene0) # pyglet mockup 1 don't tickle on_draw, we call # directly so the push / pop operation completes director.on_draw() director.on_push(scene1) director.on_draw() rec = [] director.replace(scene2) director.on_draw() # final scene ok assert director.scene is scene2 # old scene on_exit called, new scene on_enter called assert rec[0]=='on_exit_called' assert rec[1]=='on_enter_called' # underlaying scene ok director.on_pop() director.on_draw() assert director.scene is scene0