video.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. -- love.video
  2. --------------------------------------------------------------------------------
  3. --------------------------------------------------------------------------------
  4. ----------------------------------OBJECTS---------------------------------------
  5. --------------------------------------------------------------------------------
  6. --------------------------------------------------------------------------------
  7. -- VideoStream (love.thread.newVideoStream)
  8. love.test.video.VideoStream = function(test)
  9. -- create obj
  10. local video = love.video.newVideoStream('resources/sample.ogv')
  11. test:assertObject(video)
  12. -- check def properties
  13. test:assertEquals('resources/sample.ogv', video:getFilename(), 'check filename')
  14. test:assertFalse(video:isPlaying(), 'check not playing by def')
  15. -- check playing and pausing states
  16. video:play()
  17. test:assertTrue(video:isPlaying(), 'check now playing')
  18. video:seek(0.3)
  19. test:assertRange(video:tell(), 0.3, 0.4, 'check seek/tell')
  20. video:rewind()
  21. test:assertRange(video:tell(), 0, 0.1, 'check rewind')
  22. video:pause()
  23. test:assertFalse(video:isPlaying(), 'check paused')
  24. end
  25. --------------------------------------------------------------------------------
  26. --------------------------------------------------------------------------------
  27. ----------------------------------METHODS---------------------------------------
  28. --------------------------------------------------------------------------------
  29. --------------------------------------------------------------------------------
  30. -- love.video.newVideoStream
  31. -- @NOTE this is just basic nil checking, objs have their own test method
  32. love.test.video.newVideoStream = function(test)
  33. test:assertObject(love.video.newVideoStream('resources/sample.ogv'))
  34. end