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.

31 lines
1010 B

2 years ago
2 years ago
  1. import unittest
  2. from tests.harness import instrumentGooey
  3. from gooey import GooeyParser
  4. from gooey.tests import *
  5. class TestTextarea(unittest.TestCase):
  6. def makeParser(self, **kwargs):
  7. parser = GooeyParser(description='description')
  8. parser.add_argument('--widget', widget="Textarea", **kwargs)
  9. return parser
  10. def testPlaceholder(self):
  11. cases = [
  12. [{}, ''],
  13. [{'placeholder': 'Hello'}, 'Hello']
  14. ]
  15. for options, expected in cases:
  16. parser = self.makeParser(gooey_options=options)
  17. with instrumentGooey(parser) as (app, frame, gapp):
  18. # because of how poorly designed the Gooey widgets are
  19. # we have to reach down 3 levels in order to find the
  20. # actual WX object we need to test.
  21. widget = gapp.getActiveConfig().reifiedWidgets[0]
  22. self.assertEqual(widget.widget.GetHint(), expected)
  23. if __name__ == '__main__':
  24. unittest.main()