#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Layer property access') import easyvideo.screen scr = easyvideo.screen.Screen() try: test.ok('Background layer size: %s' % scr.background.area) except Exception, e: test.failed('Cannot get layer size (%s)' % e)
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Screen update') import easyvideo.screen scr = easyvideo.screen.Screen() try: scr.update() except Exception, e: test.failed('Cannot perform update() (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create frameset') import easyvideo.animation try: frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') except Exception, e: test.failed('Cannot create frame set (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation loop') import easyvideo.animation frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animation_loop = frames.animation_loop except Exception, e: test.failed('Cannot create animation loop (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add animations to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet('data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.animation) except Exception, e: test.failed('Cannot add animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Change screen caption') import easyvideo.screen scr = easyvideo.screen.Screen() try: scr.set_caption('Another caption') except Exception, e: test.failed('Cannot change screen caption (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Import') try: import easyvideo.screen except ImportError: test.failed('Cannot import library!') test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Get screen properties') import easyvideo.screen scr = easyvideo.screen.Screen() try: test.ok('Screen resolution: %sx%s' % scr.size) except Exception, e: test.failed('Cannot get screen size (%s)' % e)
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Image load') import easyvideo.image try: img = easyvideo.image.load('data/sample_image.jpg') except Exception, e: test.failed('Cannot load image (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Display init') import easyvideo.screen try: scr = easyvideo.screen.Screen() except Exception, e: test.failed('Cannot init display (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation') import easyvideo.animation frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animation = frames.animation except Exception, e: test.failed('Cannot create animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Add animations to container') import easyvideo.animation animations = easyvideo.animation.Animations() frames = easyvideo.animation.FrameSet( 'data/frame01.png', 'data/frame02.png', 'data/frame03.png', 'data/frame04.png', 'data/frame05.png', 'data/frame06.png', 'data/frame07.png', 'data/frame08.png') try: animations.add('animation1', frames.animation) except Exception, e: test.failed('Cannot add animation (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Screen layers access') import easyvideo.screen scr = easyvideo.screen.Screen() try: test.ok('Background layer: %s' % type(scr.background.layer)) except Exception, e: test.failed('Cannot access to background layer (%s)' % e)
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Image draw') import easyvideo.screen import easyvideo.image scr = easyvideo.screen.Screen() img = easyvideo.image.load('data/sample_image.jpg') try: scr.background.draw(img, (0, 0)) scr.update() except Exception, e: test.failed('Cannot draw image (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Create animation container') import easyvideo.animation try: animations = easyvideo.animation.Animations() except Exception, e: test.failed('Cannot create animation container (%s)' % e) test.ok()
#!/usr/bin/env python # -*- coding: utf-8 -*- # import test test.start('Layer drawing') import easyvideo.screen scr = easyvideo.screen.Screen() import random import pygame def _randint(max_val): return random.randint(0, max_val) for circle in range(100): try: pygame.draw.circle(scr.background.layer, (_randint(255), _randint(255), _randint(255), 255), (_randint(1024), _randint(768)), _randint(10)) except Exception, e: test.failed('Cannot draw into layer (%s)' % e) scr.update() test.ok()