def helper_test_dismiss_dialog_twice(self, app):
"""
If by some choice the dismiss event of a dialog created with
Controller.create_dialog_helper() is fired twice, it should be
handled gracefully, refs #89.
"""
Controller = main.Controller
title = "title"
body = "body"
# makes sure the controller has no dialog
self.assertEqual(Controller.dialogs, [])
# creates one and verifies it was created
dialog = Controller.create_dialog_helper(title, body)
self.assertEqual(len(Controller.dialogs), 1)
# dimisses it once and verifies it was handled
dialog.dispatch('on_dismiss')
self.assertEqual(Controller.dialogs, [])
# then a second time and it should not crash
dialog.dispatch('on_dismiss')
self.assertEqual(Controller.dialogs, [])
评论列表
文章目录