test_resource_provider.py 771 B

123456789101112131415161718192021222324
  1. from ..resource_provider import GooeyResources
  2. from PySide6.QtGui import QIcon
  3. gooey_resources = GooeyResources()
  4. def test_qicon_pointer():
  5. # This test should run first
  6. # Test whether class dict is empty before getting icon
  7. assert not gooey_resources._icons
  8. # Test whether class dict has correct content after getting icon
  9. gooey_resources.get_best_icon('file')
  10. assert hasattr(gooey_resources, '_icons')
  11. assert 'file' in gooey_resources._icons
  12. assert isinstance(gooey_resources._icons['file'], QIcon)
  13. def test_gooey_resources():
  14. # Test all current labels
  15. # None
  16. gooey_resources.get_best_icon(None)
  17. # All other options
  18. for label in gooey_resources.label_to_name.keys():
  19. gooey_resources.get_best_icon(label)