Ejemplo n.º 1
0
    def testMultiWindowFX(self):
        def setHueSat(node):
            effect = avg.HueSatFXNode()
            effect.saturation = -200
            node.setEffect(effect)

        def setBlur(node):
            node.setEffect(avg.BlurFXNode(3))

        def startVideo():
            node.unlink(True)
            self.videoNode = avg.VideoNode(href="mpeg1-48x48.mov",
                                           size=(96, 96),
                                           threaded=False,
                                           parent=root)
            self.videoNode.setEffect(avg.NullFXNode())
            self.videoNode.play()

        root = self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        node = avg.ImageNode(pos=(0, 0), href="rgb24-64x64.png", parent=root)
        node.setEffect(avg.NullFXNode())
        player.setFakeFPS(25)
        self.start(False, (
            self.skipIfMinimalShader,
            lambda: self.compareImage("testMultiWindowFX1"),
            lambda: setHueSat(node),
            lambda: self.compareImage("testMultiWindowFX2"),
            lambda: setBlur(node),
            lambda: self.compareImage("testMultiWindowFX3"),
            startVideo,
            lambda: self.compareImage("testMultiWindowFXVideo1"),
            lambda: setHueSat(self.videoNode),
            lambda: self.compareImage("testMultiWindowFXVideo2"),
        ))
Ejemplo n.º 2
0
 def testMultiWindowBase(self):
     root = self.loadEmptyScene()
     avg.ImageNode(pos=(0,0), href="rgb24-64x64.png", parent=root)
     player.setWindowConfig("avgwindowconfig.xml")
     self.start(False,
             (lambda: self.compareImage("testMultiWindow1"),
             ))
Ejemplo n.º 3
0
Archivo: app.py Proyecto: libavg/libavg
    def _setupResolution(self):
        rotation = self.settings.get('app_rotation').lower()
        resolutionStr = self.settings.get('app_resolution').lower()
        windowSizeStr = self.settings.get('app_window_size')
        if self.settings.get('app_windowconfig') == '':
            if resolutionStr != '':
                resolution = self.settings.getPoint2D('app_resolution')
            else:
                resolution = libavg.player.getScreenResolution()

            if windowSizeStr != '':
                windowSize = self.settings.getPoint2D('app_window_size')
            else:
                windowSize = resolution

            if rotation in ('left', 'right'):
                resolution = Point2D(resolution.y, resolution.x)
                windowSize = Point2D(windowSize.y, windowSize.x)

            self._resolution = resolution
            self._windowSize = windowSize
        else:
            if rotation != 'normal' or windowSizeStr != '':
                raise TypeError('App parameters: app_windowconfig is incompatible '+
                        'with app_window_size and app_rotation')
            player.setWindowConfig(self.settings.get('app_windowconfig'))
            self._resolution = self.settings.getPoint2D('app_resolution')
Ejemplo n.º 4
0
    def _setupResolution(self):
        rotation = self.settings.get('app_rotation').lower()
        resolutionStr = self.settings.get('app_resolution').lower()
        windowSizeStr = self.settings.get('app_window_size')
        if self.settings.get('app_windowconfig') == '':
            if resolutionStr != '':
                resolution = self.settings.getPoint2D('app_resolution')
            else:
                resolution = libavg.player.getScreenResolution()

            if windowSizeStr != '':
                windowSize = self.settings.getPoint2D('app_window_size')
            else:
                windowSize = resolution

            if rotation in ('left', 'right'):
                resolution = Point2D(resolution.y, resolution.x)
                windowSize = Point2D(windowSize.y, windowSize.x)

            self._resolution = resolution
            self._windowSize = windowSize
        else:
            if rotation != 'normal' or windowSizeStr != '':
                raise TypeError(
                    'App parameters: app_windowconfig is incompatible ' +
                    'with app_window_size and app_rotation')
            player.setWindowConfig(self.settings.get('app_windowconfig'))
            self._resolution = self.settings.getPoint2D('app_resolution')
Ejemplo n.º 5
0
 def testMultiWindowBase(self):
     root = self.loadEmptyScene()
     avg.ImageNode(pos=(0,0), href="rgb24-64x64.png", parent=root)
     player.setWindowConfig("avgwindowconfig.xml")
     self.start(False,
             (lambda: self.compareImage("testMultiWindow1"),
             ))
Ejemplo n.º 6
0
    def testMultiWindowFX(self):
        def setHueSat(node):
            effect = avg.HueSatFXNode()
            effect.saturation = -200
            node.setEffect(effect)

        def setBlur(node):
            node.setEffect(avg.BlurFXNode(3))

        def startVideo():
            node.unlink(True)
            self.videoNode = avg.VideoNode(href="mpeg1-48x48.mov", size=(96,96), 
                    threaded=False, parent=root)
            self.videoNode.setEffect(avg.NullFXNode())
            self.videoNode.play()

        root = self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        node = avg.ImageNode(pos=(0,0), href="rgb24-64x64.png", parent=root)
        node.setEffect(avg.NullFXNode())
        player.setFakeFPS(25)
        self.start(False,
                (self.skipIfMinimalShader,
                 lambda: self.compareImage("testMultiWindowFX1"),
                 lambda: setHueSat(node),
                 lambda: self.compareImage("testMultiWindowFX2"),
                 lambda: setBlur(node),
                 lambda: self.compareImage("testMultiWindowFX3"),
                 startVideo,
                 lambda: self.compareImage("testMultiWindowFXVideo1"),
                 lambda: setHueSat(self.videoNode),
                 lambda: self.compareImage("testMultiWindowFXVideo2"),
                ))
Ejemplo n.º 7
0
    def testMultiWindowManualCanvas(self):
        def renderCanvas():
            canvas.render()
            bmp = canvas.screenshot()
            self.compareBitmapToFile(bmp, "testMultiWindowManualCanvas")

        self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        canvas = player.createCanvas(id="canvas", size=(160,120), autorender=False)
        avg.ImageNode(pos=(0,0), href="media/rgb24-64x64.png", 
                parent=canvas.getRootNode())
        self.start(False,
                (renderCanvas,
                ))
Ejemplo n.º 8
0
    def testMultiWindowManualCanvas(self):
        def renderCanvas():
            canvas.render()
            bmp = canvas.screenshot()
            self.compareBitmapToFile(bmp, "testMultiWindowManualCanvas")

        self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        canvas = player.createCanvas(id="canvas", size=(160,120), autorender=False)
        avg.ImageNode(pos=(0,0), href="media/rgb24-64x64.png", 
                parent=canvas.getRootNode())
        self.start(False,
                (renderCanvas,
                ))
Ejemplo n.º 9
0
    def testMultiWindowFXWords(self):
        def setHueSat(node):
            effect = avg.HueSatFXNode()
            effect.saturation = -200
            node.setEffect(effect)

        root = self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        self.wordsNode = avg.WordsNode(text="WordsNode", color="FF0000", parent=root)
        self.wordsNode.setEffect(avg.NullFXNode())

        self.start(True,
                (
                 lambda: self.compareImage("testMultiWindowFXWords1"),
                 lambda: setHueSat(self.wordsNode),
                 lambda: self.compareImage("testMultiWindowFXWords2"),
                ))
Ejemplo n.º 10
0
    def testMultiWindowFXWords(self):
        def setHueSat(node):
            effect = avg.HueSatFXNode()
            effect.saturation = -200
            node.setEffect(effect)

        root = self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        self.wordsNode = avg.WordsNode(text="WordsNode", color="FF0000", parent=root)
        self.wordsNode.setEffect(avg.NullFXNode())

        self.start(True,
                (
                 lambda: self.compareImage("testMultiWindowFXWords1"),
                 lambda: setHueSat(self.wordsNode),
                 lambda: self.compareImage("testMultiWindowFXWords2"),
                ))
Ejemplo n.º 11
0
    def testMultiWindowCanvas(self):
        def deleteCanvas():
            img1.unlink(True)
            img2.unlink(True)
            player.deleteCanvas("canvas")

        def canvasScreenshot():
            bmp = canvas.screenshot()
            self.compareBitmapToFile(bmp, "testMultiWindowCanvas2")

        root = self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        canvas = player.createCanvas(id="canvas", size=(160, 120))
        avg.ImageNode(pos=(0, 0),
                      href="media/rgb24-64x64.png",
                      parent=canvas.getRootNode())
        img1 = avg.ImageNode(pos=(0, 0), href="canvas:canvas", parent=root)
        img2 = avg.ImageNode(pos=(80, 0), href="canvas:canvas", parent=root)
        self.start(False, (
            lambda: self.compareImage("testMultiWindowCanvas1"),
            canvasScreenshot,
            deleteCanvas,
        ))
Ejemplo n.º 12
0
    def testMultiWindowCanvas(self):
        def deleteCanvas():
            img1.unlink(True)
            img2.unlink(True)
            player.deleteCanvas("canvas")

        def canvasScreenshot():
            bmp = canvas.screenshot()
            self.compareBitmapToFile(bmp, "testMultiWindowCanvas2")


        root = self.loadEmptyScene()
        player.setWindowConfig("avgwindowconfig.xml")
        canvas = player.createCanvas(id="canvas", size=(160,120))
        avg.ImageNode(pos=(0,0), href="media/rgb24-64x64.png", 
                parent=canvas.getRootNode())
        img1 = avg.ImageNode(pos=(0,0), href="canvas:canvas", parent=root)
        img2 = avg.ImageNode(pos=(80,0), href="canvas:canvas", parent=root)
        self.start(False,
                (lambda: self.compareImage("testMultiWindowCanvas1"),
                 canvasScreenshot,
                 deleteCanvas,
                ))