You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.3 KiB

  1. import time
  2. import unittest
  3. from gooey.gui.lang.i18n import _
  4. from tests.integration.programs import auto_start as auto_start_module
  5. class TestGooeyIntegration(unittest.TestCase):
  6. def test__gooeyAutoStart(self):
  7. """Verifies that issue #201 doesn't regress and auto_start skips the config
  8. screen and hops right into the client's program"""
  9. from gooey.tests.integration import runner
  10. runner.run_integration(auto_start_module, self.verifyAutoStart, auto_start=True)
  11. def verifyAutoStart(self, app, buildSpec):
  12. """
  13. When the auto_start flag == True Gooey should skip the
  14. configuration screen
  15. """
  16. time.sleep(1)
  17. try:
  18. # Gooey should NOT be showing the name/description headers
  19. # present on the config page
  20. title = app.TopWindow.header._header.GetLabel()
  21. subtitle = app.TopWindow.header._subheader.GetLabel()
  22. self.assertNotEqual(title, buildSpec['program_name'])
  23. self.assertNotEqual(subtitle, buildSpec['program_description'])
  24. # Gooey should be showing the console messages straight away
  25. # without manually starting the program
  26. title = app.TopWindow.header._header.GetLabel()
  27. subtitle = app.TopWindow.header._subheader.GetLabel()
  28. self.assertEqual(title,_("running_title"))
  29. self.assertEqual(subtitle, _('running_msg'))
  30. # Wait for Gooey to swap the header to the final screen
  31. while app.TopWindow.header._header.GetLabel() == _("running_title"):
  32. time.sleep(.1)
  33. # verify that we've landed on the success screen
  34. title = app.TopWindow.header._header.GetLabel()
  35. subtitle = app.TopWindow.header._subheader.GetLabel()
  36. self.assertEqual(title, _("finished_title"))
  37. self.assertEqual(subtitle, _('finished_msg'))
  38. # and that output was actually written to the console
  39. self.assertIn("Success", app.TopWindow.console.textbox.GetValue())
  40. except:
  41. app.TopWindow.Destroy()
  42. raise
  43. else:
  44. import wx
  45. wx.CallAfter(app.TopWindow.Destroy)
  46. return None
  47. if __name__ == '__main__':
  48. unittest.main()