test_apple_conversions.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/python
  2. import devices
  3. from sikuli.Sikuli import *
  4. import config
  5. from lvcgui import MVCGui
  6. import datafiles
  7. data = datafiles.TestData()
  8. def test_apple_conversions():
  9. """Scenario: test each android conversion option.
  10. """
  11. device_list = devices.devices('Apple')
  12. for x in device_list:
  13. yield convert_to_format, x
  14. def test_apple_size_output_default():
  15. """Scenario: the output format and size are defaults when device selected.
  16. """
  17. device_list = devices.devices('Android')
  18. datadir, testfiles = data.test_data(many=True, new=True)
  19. lvc = MVCGui()
  20. lvc.lvc_focus()
  21. lvc.browse_for_files(datadir, testfiles)
  22. for x in device_list:
  23. yield device_defaults, x, lvc
  24. def device_defaults(device_output, lvc):
  25. print(device_output)
  26. lvc.choose_device_conversion(device_output)
  27. width = devices.device_attr(device_output, 'width')
  28. height = devices.device_attr(device_output, 'height')
  29. default_format = 'MP4'
  30. assert lvc.verify_device_format_selected(device_output)
  31. assert lvc.verify_device_size_default(str(width), str(height))
  32. def convert_to_format(device_output):
  33. print(device_output)
  34. expected_failures = ['fake_video.mp4']
  35. lvc = MVCGui()
  36. lvc.lvc_focus()
  37. datadir, testfiles = data.test_data(many=True, new=True)
  38. lvc.browse_for_files(datadir, testfiles)
  39. output_dir = tempfile.mkdtemp()
  40. lvc.choose_save_location(output_dir)
  41. lvc.choose_device_conversion("device_output")
  42. lvc.start_conversions()
  43. for item in testfiles:
  44. if item in expected_failures:
  45. lvc.verify_failed(item, 120)
  46. else:
  47. lvc.verify_completed(item, 120)
  48. lvc.clear_finished_files(item)
  49. lvc.clear_and_start_over()