test_android_conversions.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_android_conversions():
  9. """Scenario: test each android conversion option.
  10. """
  11. device_list = devices.devices('Android')
  12. for x in device_list:
  13. yield convert_to_format, x
  14. def test_android_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. """Scenario: Test items are converted to the specified format.
  34. """
  35. print(device_output)
  36. lvc = MVCGui()
  37. lvc.lvc_focus()
  38. expected_failures = ['fake_video.mp4']
  39. datadir, testfiles = data.test_data(many=True, new=True)
  40. lvc.browse_for_files(datadir, testfiles)
  41. output_dir = tempfile.mkdtemp()
  42. lvc.choose_save_location(output_dir)
  43. lvc.choose_device_conversion("device_output")
  44. lvc.start_conversions()
  45. for item in testfiles:
  46. if item in expected_failures:
  47. lvc.verify_failed(item, 120)
  48. else:
  49. lvc.verify_completed(item, 120)
  50. lvc.clear_finished_files(item)
  51. lvc.clear_and_start_over()