コード例 #1
0
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()
        self.mockController.sequence = MagicMock(return_value=1)

        self.screens = Device("Screens")
        self.screens.lower = MagicMock(return_value=1)
        self.screens.raiseUp = MagicMock(return_value=1)
        self.screens.stop = MagicMock(return_value=1)
        self.mockController.addDevice(self.screens)

        self.main = MainWindow(self.mockController)
コード例 #2
0
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.atem = MagicMock()
        self.atem.deviceID = 'ATEM'
        self.mockController.addDevice(self.atem)

        self.switcherState = MagicMock()
        self.switcherState.dsks = {0: DSK(1)}
        self.switcherState.inputs = VisualsSystem._default_inputs()
        self.switcherState.outputs = VisualsSystem._default_outputs()

        self.mainWindow = MagicMock()
コード例 #3
0
class TestMainWindow(GuiTest):
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()
        self.mockController.sequence = MagicMock(return_value=1)

        self.screens = Device("Screens")
        self.screens.lower = MagicMock(return_value=1)
        self.screens.raiseUp = MagicMock(return_value=1)
        self.screens.stop = MagicMock(return_value=1)
        self.mockController.addDevice(self.screens)

        self.main = MainWindow(self.mockController)

    def getCurrentScreen(self):
        return self.main.stack.currentWidget()

    def testSystemPower(self):
        spcButton = self.findButton(self.main, "Power")
        self.assertFalse(spcButton is None)

        spcButton.click()
        spc = self.getCurrentScreen()
        self.assertTrue(isinstance(spc, SystemPowerWidget))
        self.findButton(spc, "On").click()
        self.assertEquals(self.mockController.sequence.call_count, 1)

        self.findButton(spc, "Off").click()
        self.assertEquals(self.mockController.sequence.call_count, 2)
        # Probably ought to verify exactly what has been sequenced...

        self.findButton(spc, "Back").click()
        self.assertTrue(
            isinstance(self.main.stack.currentWidget(), VideoSwitcher))

    def testLog(self):
        entry = FakeLogEntry("2013-04-17 18:45:38", "ERROR",
                             "This is a test message")
        self.mockController.getLog = MagicMock(return_value=[entry])

        advMenuButton = self.findButton(self.main, "Advanced")
        advMenuButton.click()
        top = self.getCurrentScreen()

        logButton = self.findButton(top, "Log")
        logButton.click()
        lw = self.main.stack.currentWidget()
        self.assertTrue(isinstance(lw, LogViewer))
        self.assertEqual(self.mockController.getLog.call_count, 1)
コード例 #4
0
class TestMainWindow(GuiTest):

    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()
        self.mockController.sequence = MagicMock(return_value=1)

        self.screens = Device("Screens")
        self.screens.lower = MagicMock(return_value=1)
        self.screens.raiseUp = MagicMock(return_value=1)
        self.screens.stop = MagicMock(return_value=1)
        self.mockController.addDevice(self.screens)

        self.main = MainWindow(self.mockController)

    def getCurrentScreen(self):
        return self.main.stack.currentWidget()

    def testSystemPower(self):
        spcButton = self.findButton(self.main, "Power")
        self.assertFalse(spcButton is None)

        spcButton.click()
        spc = self.getCurrentScreen()
        self.assertTrue(isinstance(spc, SystemPowerWidget))
        self.findButton(spc, "On").click()
        self.assertEquals(self.mockController.sequence.call_count, 1)

        self.findButton(spc, "Off").click()
        self.assertEquals(self.mockController.sequence.call_count, 2)
        # Probably ought to verify exactly what has been sequenced...

        self.findButton(spc, "Back").click()
        self.assertTrue(isinstance(self.main.stack.currentWidget(), VideoSwitcher))

    def testLog(self):
        entry = FakeLogEntry("2013-04-17 18:45:38", "ERROR", "This is a test message")
        self.mockController.getLog = MagicMock(return_value=[entry])

        advMenuButton = self.findButton(self.main, "Advanced")
        advMenuButton.click()
        top = self.getCurrentScreen()

        logButton = self.findButton(top, "Log")
        logButton.click()
        lw = self.main.stack.currentWidget()
        self.assertTrue(isinstance(lw, LogViewer))
        self.assertEqual(self.mockController.getLog.call_count, 1)
コード例 #5
0
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()
        self.mockController.sequence = MagicMock(return_value=1)

        self.screens = Device("Screens")
        self.screens.lower = MagicMock(return_value=1)
        self.screens.raiseUp = MagicMock(return_value=1)
        self.screens.stop = MagicMock(return_value=1)
        self.mockController.addDevice(self.screens)

        self.main = MainWindow(self.mockController)
コード例 #6
0
class TestBlindsControl(GuiTest):

    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()
        self.mockBlindsDevice = Device("Test")
        self.mockController.addDevice(self.mockBlindsDevice)
        self.mockMainWindow = MainWindow(self.mockController)

    def testBlinds(self):
        bc = BlindsControl(self.mockBlindsDevice, self.mockMainWindow)

        self.mockBlindsDevice.raiseUp = MagicMock()
        self.mockBlindsDevice.lower = MagicMock()
        self.mockBlindsDevice.stop = MagicMock()

        self.findButton(bc, "All").click()
        self.findButton(bc, "Raise").click()
        self.mockBlindsDevice.raiseUp.assert_called_once_with(0)
        self.findButton(bc, "Lower").click()
        self.mockBlindsDevice.lower.assert_called_once_with(0)
        self.findButton(bc, "Stop").click()
        self.mockBlindsDevice.stop.assert_called_once_with(0)

        self.mockBlindsDevice.raiseUp.reset_mock()
        self.mockBlindsDevice.lower.reset_mock()
        self.mockBlindsDevice.stop.reset_mock()

        self.findButton(bc, "3").click()
        self.findButton(bc, "Raise").click()
        self.mockBlindsDevice.raiseUp.assert_called_once_with(3)
        self.findButton(bc, "Lower").click()
        self.mockBlindsDevice.lower.assert_called_once_with(3)
        self.findButton(bc, "Stop").click()
        self.mockBlindsDevice.stop.assert_called_once_with(3)

        self.mockMainWindow.stepBack = MagicMock()
        self.findButton(bc, "Back").click()
        self.assertEqual(1, self.mockMainWindow.stepBack.call_count)
コード例 #7
0
class TestBlindsControl(GuiTest):
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()
        self.mockBlindsDevice = Device("Test")
        self.mockController.addDevice(self.mockBlindsDevice)
        self.mockMainWindow = MainWindow(self.mockController)

    def testBlinds(self):
        bc = BlindsControl(self.mockBlindsDevice, self.mockMainWindow)

        self.mockBlindsDevice.raiseUp = MagicMock()
        self.mockBlindsDevice.lower = MagicMock()
        self.mockBlindsDevice.stop = MagicMock()

        self.findButton(bc, "All").click()
        self.findButton(bc, "Raise").click()
        self.mockBlindsDevice.raiseUp.assert_called_once_with(0)
        self.findButton(bc, "Lower").click()
        self.mockBlindsDevice.lower.assert_called_once_with(0)
        self.findButton(bc, "Stop").click()
        self.mockBlindsDevice.stop.assert_called_once_with(0)

        self.mockBlindsDevice.raiseUp.reset_mock()
        self.mockBlindsDevice.lower.reset_mock()
        self.mockBlindsDevice.stop.reset_mock()

        self.findButton(bc, "3").click()
        self.findButton(bc, "Raise").click()
        self.mockBlindsDevice.raiseUp.assert_called_once_with(3)
        self.findButton(bc, "Lower").click()
        self.mockBlindsDevice.lower.assert_called_once_with(3)
        self.findButton(bc, "Stop").click()
        self.mockBlindsDevice.stop.assert_called_once_with(3)

        self.mockMainWindow.stepBack = MagicMock()
        self.findButton(bc, "Back").click()
        self.assertEqual(1, self.mockMainWindow.stepBack.call_count)
コード例 #8
0
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.atem = MagicMock()
        self.atem.deviceID = 'ATEM'
        self.mockController.addDevice(self.atem)

        self.switcherState = MagicMock()
        self.switcherState.dsks = {0: DSK(1)}
        self.switcherState.inputs = VisualsSystem._default_inputs()
        self.switcherState.outputs = VisualsSystem._default_outputs()

        self.mainWindow = MagicMock()
コード例 #9
0
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.main = Device("Main")
        self.mockController.addDevice(self.main)
        self.main.sendInputToOutput = MagicMock(return_value=1)

        self.preview = Device("Preview")
        self.mockController.addDevice(self.preview)
        self.preview.sendInputToOutput = MagicMock(return_value=1)

        self.extras = Device("Extras")
        self.mockController.addDevice(self.extras)
        self.extras.sendInputToOutput = MagicMock(return_value=1)

        fakeMainWindow = object()
        self.vs = VideoSwitcher(self.mockController, fakeMainWindow)
コード例 #10
0
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.main = Device("Main")
        self.mockController.addDevice(self.main)
        self.main.sendInputToOutput = MagicMock(return_value=1)

        self.extras = Device("Extras")
        self.mockController.addDevice(self.extras)
        self.extras.sendInputToOutput = MagicMock(return_value=1)

        self.esc = Device("Extras Scan Converter")
        self.mockController.addDevice(self.esc)
        self.esc.overscanOff = MagicMock(return_value=1)
        self.esc.overscanOn = MagicMock(return_value=1)
        self.esc.unfreeze = MagicMock(return_value=1)
        self.esc.freeze = MagicMock(return_value=1)

        self.es = ExtrasSwitcher(self.mockController)
コード例 #11
0
class Test(GuiTest):

    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.main = Device("Main")
        self.mockController.addDevice(self.main)
        self.main.sendInputToOutput = MagicMock(return_value=1)

        self.extras = Device("Extras")
        self.mockController.addDevice(self.extras)
        self.extras.sendInputToOutput = MagicMock(return_value=1)

        self.esc = Device("Extras Scan Converter")
        self.mockController.addDevice(self.esc)
        self.esc.overscanOff = MagicMock(return_value=1)
        self.esc.overscanOn = MagicMock(return_value=1)
        self.esc.unfreeze = MagicMock(return_value=1)
        self.esc.freeze = MagicMock(return_value=1)

        self.es = ExtrasSwitcher(self.mockController)

    def testDoesntSwitchMinusOne(self):
        self.es.takePreview()
        self.assertFalse(self.extras.sendInputToOutput.called, "Switcher was called but it shouldn't have been")
        self.es.inputs.buttons()[0].click()
        self.es.takePreview()
        self.assert_(self.extras.sendInputToOutput.called, "Switcher was not called but it should have been")

    def testToggleOverscan(self):
        self.findButton(self.es, "Overscan").click()
        self.esc.overscanOff.assert_called_once_with()
        self.findButton(self.es, "Overscan").click()
        self.esc.overscanOn.assert_called_once_with()

    def testToggleFreeze(self):
        self.findButton(self.es, "Freeze").click()
        self.esc.freeze.assert_called_once_with()
        self.findButton(self.es, "Freeze").click()
        self.esc.unfreeze.assert_called_once_with()
コード例 #12
0
class TestVideoSwitcher(GuiTest):
    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.atem = MagicMock()
        self.atem.deviceID = 'ATEM'
        self.mockController.addDevice(self.atem)

        self.switcherState = MagicMock()
        self.switcherState.dsks = {0: DSK(1)}
        self.switcherState.inputs = VisualsSystem._default_inputs()
        self.switcherState.outputs = VisualsSystem._default_outputs()

        self.mainWindow = MagicMock()

    def makeVS(self):
        return VideoSwitcher(self.mockController, self.mainWindow,
                             self.switcherState)

    def testSelectiveInputButtons(self):
        # FSR tests will segfault if a camera device is added
        # I think it's as a result of Qt connect() calls
        # But still, it's useful to test that the camera buttons are hidden when
        # no cameras are present in the controller.
        vs = self.makeVS()
        self.assertTrue(self.findButton(vs, "Camera 1") is None)
        self.assertTrue(self.findButton(vs, "Camera 2") is None)
        self.assertTrue(self.findButton(vs, "Camera 3") is None)
        self.assertFalse(self.findButton(vs, "Extras") is None)

    def testExtrasButton(self):
        vs = self.makeVS()
        extrasBtn = self.findButton(vs, "Extras")

        self.assertFalse(extrasBtn is None)
        all_inputs = extrasBtn.property("panel")
        self.assertTrue(isinstance(all_inputs, AllInputsPanel))

        vs.og.setAuxesEnabled(True)  # as if we'd selected something before
        self.assertTrue(self.findButton(vs, "All").isEnabled()
                        )  # Before we click Extras, All button is enabled

        self.assertTrue(extrasBtn.input is None)  # At first, it has no input
        self.assertTrue(self.findButton(vs, "Camera 1") is
                        None)  # No button for Camera 1 in window

        extrasBtn.click()

        self.assertFalse(
            self.findButton(vs, "Camera 1") is
            None)  # A Camera 1 button has appeared! (In the AllInputsPanel)
        self.assertFalse(self.findButton(
            vs, "All").isEnabled())  # Disabled as button has no input
        self.findButton(vs, "Camera 1").click()
        self.assertEqual(extrasBtn.input, self.switcherState.inputs[
            VideoSource.INPUT_1])  # Button has input set
        self.assertTrue(self.findButton(
            vs, "All").isEnabled())  # All button is enabled again

    def testSwitching(self):
        vs = self.makeVS()

        self.findButton(vs, "Cut").click()
        self.atem.performCut.assert_called_once()

        self.findButton(vs, "DVD").click()
        self.atem.setPreview.assert_called_once_with(VideoSource.INPUT_4)

        self.findButton(vs, "Fade").click()
        self.atem.setNextTransition.assert_called_once_with(
            TransitionStyle.MIX,
            bkgd=True,
            key1=False,
            key2=False,
            key3=False,
            key4=False)
        self.atem.performAutoTake.assert_called_once()

        self.findButton(vs, "All").click()
        self.atem.setProgram.assert_called_once_with(VideoSource.INPUT_4)
        self.atem.setAuxSource.assert_has_calls([
            call(1, VideoSource.INPUT_4),
            call(2, VideoSource.INPUT_4),
            call(3, VideoSource.INPUT_4),
            call(4, VideoSource.INPUT_4),
            call(5, VideoSource.INPUT_4),
            call(6, VideoSource.INPUT_4),
        ])

        self.atem.setAuxSource.reset_mock()
        self.findButton(vs, "Visuals PC").click()
        self.findButton(vs.og, "Record").click()
        self.atem.setAuxSource.assert_called_once_with(2, VideoSource.INPUT_5)
        self.atem.setAuxSource.reset_mock()

        self.findButton(vs.og, "Record").longpress.emit()
        self.atem.setAuxSource.assert_called_once_with(
            2, VideoSource.ME_1_PROGRAM)
        self.atem.setAuxSource.reset_mock()

        self.findButton(vs.og, "Mix to all").click()
        self.atem.setAuxSource.assert_has_calls([
            call(1, VideoSource.ME_1_PROGRAM),
            call(2, VideoSource.ME_1_PROGRAM),
            call(3, VideoSource.ME_1_PROGRAM),
            call(4, VideoSource.ME_1_PROGRAM),
            call(5, VideoSource.ME_1_PROGRAM),
            call(6, VideoSource.ME_1_PROGRAM),
        ])
コード例 #13
0
class TestVideoSwitcher(GuiTest):

    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.main = Device("Main")
        self.mockController.addDevice(self.main)
        self.main.sendInputToOutput = MagicMock(return_value=1)

        self.preview = Device("Preview")
        self.mockController.addDevice(self.preview)
        self.preview.sendInputToOutput = MagicMock(return_value=1)

        self.extras = Device("Extras")
        self.mockController.addDevice(self.extras)
        self.extras.sendInputToOutput = MagicMock(return_value=1)

        fakeMainWindow = object()
        self.vs = VideoSwitcher(self.mockController, fakeMainWindow)

    def testSendInputsToOutputs(self):
        outputsGrid = self.vs.findChild(OutputsGrid)
        self.assertTrue(outputsGrid is not None)

        self.vs.btnCamera1.click()
        self.assertPreviewCalledFor(1)  # Camera 1 is previewed

        outputsGrid.btnChurch.click()
        self.main.sendInputToOutput.assert_called_with(1, 4)  # Camera 1 sent to output 4 (church)

        self.vs.btnCamera3.click()
        self.assertPreviewCalledFor(3)  # Camera 3 previewed
        outputsGrid.btnGallery.click()
        self.main.sendInputToOutput.assert_called_with(3, 6)  # Camera 3 sent to output 6 (gallery)
        outputsGrid.btnPCMix.click()
        self.preview.sendInputToOutput.assert_called_with(3, 2)  # Camera 3 sent to PC Mix

        self.vs.btnBlank.click()
        outputsGrid.btnAll.click()
        self.main.sendInputToOutput.assert_called_with(0, 0)  # Everything blanked

        self.extras.sendInputToOutput.reset_mock()
        self.vs.btnExtras.click()
        self.extras.sendInputToOutput.assert_not_called()  # main sw not involved and no input selected
        self.vs.extrasSwitcher.inputs.buttons()[4].click()  # Visuals PC video
        self.assertEqual("PC video", self.vs.btnExtras.text())
        self.extras.sendInputToOutput.assert_called_with(8, EXTRAS_OUTPUT_TO_PREVIEW)
        self.assertEqual(self.vs.extrasSwitcher.inputs.checkedButton(), self.vs.extrasSwitcher.inputs.buttons()[4])
        outputsGrid.btnAll.click()  # This one click should trigger two takes, one on each switcher
        self.extras.sendInputToOutput.assert_called_with(8, 1)
        self.main.sendInputToOutput.assert_called_with(5, 0)  # Extras to everywhere
        outputsGrid.updateOutputMappings({'Main': {0: 5}})
        self.assertEqual("PC video", outputsGrid.btnMonitor1.inputDisplay.text())
        self.main.sendInputToOutput.reset_mock()
        self.extras.sendInputToOutput.reset_mock()
        self.assertTrue(outputsGrid.isEnabled())
        self.assertTrue(outputsGrid.btnPCMix.isEnabled())
        outputsGrid.btnPCMix.click()
        self.assertTrue(outputsGrid.isEnabled())
        self.extras.sendInputToOutput.assert_called_with(8, 2)
        self.preview.sendInputToOutput.assert_called_with(6, 2)  # Extras to PC Mix

    def testCantSendPCMixToItself(self):
        outputsGrid = self.vs.findChild(OutputsGrid)

        self.vs.btnVisualsPC.click()
        self.assertPreviewCalledFor(6)
        self.main.sendInputToOutput.reset_mock()
        outputsGrid.btnPCMix.click()
        self.assertFalse(self.preview.sendInputToOutput.called)
        self.assertFalse(self.main.sendInputToOutput.called)
        self.assertFalse(outputsGrid.btnPCMix.isEnabled())

    def testCantBlankPCMix(self):
        outputsGrid = self.vs.findChild(OutputsGrid)

        self.vs.btnBlank.click()
        outputsGrid.btnPCMix.click()
        self.assertFalse(self.preview.sendInputToOutput.called)
        self.assertFalse(self.main.sendInputToOutput.called)
        self.assertFalse(outputsGrid.btnPCMix.isEnabled())

    def testKeyboardControls(self):
        QTest.keyClick(self.vs, Qt.Key_0)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(0, 0)

        QTest.keyClick(self.vs, Qt.Key_1)
        self.assertPreviewCalledFor(1)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(1, 0)

        QTest.keyClick(self.vs, Qt.Key_2)
        self.assertPreviewCalledFor(2)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(2, 0)

        QTest.keyClick(self.vs, Qt.Key_3)
        self.assertPreviewCalledFor(3)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(3, 0)

        QTest.keyClick(self.vs, Qt.Key_4)
        self.assertPreviewCalledFor(4)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(4, 0)

        self.extras.sendInputToOutput.reset_mock()
        QTest.keyClick(self.vs, Qt.Key_5)
        self.extras.sendInputToOutput.assert_not_called()  # main sw not involved and no input selected
        # Make sure there's an actual channel selected
        self.vs.extrasSwitcher.inputs.buttons()[3].click()
        self.assertEqual("Extras 4", self.vs.btnExtras.text())
        self.extras.sendInputToOutput.assert_called_with(4, EXTRAS_OUTPUT_TO_PREVIEW)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(5, 0)

        QTest.keyClick(self.vs, Qt.Key_6)
        self.assertPreviewCalledFor(6)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(6, 0)

        self.main.sendInputToOutput.reset_mock()
        self.preview.sendInputToOutput.reset_mock()
        QTest.keyClick(self.vs, Qt.Key_7)
        self.assertFalse(self.preview.sendInputToOutput.called)
        QTest.keyClick(self.vs, Qt.Key_Space)
        self.main.sendInputToOutput.assert_called_with(6, 0)  # which was the last valid input key pressed

    def testNotSendNullExtra(self):
        outputsGrid = self.vs.findChild(OutputsGrid)
        self.vs.btnExtras.click()
        self.assertIsNone(self.vs.extrasSwitcher.currentInput())
        self.assertFalse(outputsGrid.isEnabled())
        self.assertTrue(self.vs.extrasSwitcher.noInputWarning.isVisibleTo(self.vs.extrasSwitcher))

    def assertPreviewCalledFor(self, inputID):
        self.main.sendInputToOutput.assert_called_with(inputID, 1)
        return self.extras.sendInputToOutput.assert_called_with(EXTRAS_INPUT_FROM_MAIN, EXTRAS_OUTPUT_TO_PREVIEW)
コード例 #14
0
class TestVideoSwitcher(GuiTest):

    def setUp(self):
        GuiTest.setUp(self)
        self.mockController = MockController()

        self.atem = MagicMock()
        self.atem.deviceID = 'ATEM'
        self.mockController.addDevice(self.atem)

        self.switcherState = MagicMock()
        self.switcherState.dsks = {0: DSK(1)}
        self.switcherState.inputs = VisualsSystem._default_inputs()
        self.switcherState.outputs = VisualsSystem._default_outputs()

        self.mainWindow = MagicMock()

    def makeVS(self):
        return VideoSwitcher(self.mockController, self.mainWindow, self.switcherState)

    def testSelectiveInputButtons(self):
        # FSR tests will segfault if a camera device is added
        # I think it's as a result of Qt connect() calls
        # But still, it's useful to test that the camera buttons are hidden when
        # no cameras are present in the controller.
        vs = self.makeVS()
        self.assertTrue(self.findButton(vs, "Camera 1") is None)
        self.assertTrue(self.findButton(vs, "Camera 2") is None)
        self.assertTrue(self.findButton(vs, "Camera 3") is None)
        self.assertFalse(self.findButton(vs, "Extras") is None)

    def testExtrasButton(self):
        vs = self.makeVS()
        extrasBtn = self.findButton(vs, "Extras")

        self.assertFalse(extrasBtn is None)
        all_inputs = extrasBtn.property("panel")
        self.assertTrue(isinstance(all_inputs, AllInputsPanel))

        vs.og.setAuxesEnabled(True)  # as if we'd selected something before
        self.assertTrue(self.findButton(vs, "All").isEnabled())  # Before we click Extras, All button is enabled

        self.assertTrue(extrasBtn.input is None)  # At first, it has no input
        self.assertTrue(self.findButton(vs, "Camera 1") is None)  # No button for Camera 1 in window

        extrasBtn.click()

        self.assertFalse(self.findButton(vs, "Camera 1") is None)  # A Camera 1 button has appeared! (In the AllInputsPanel)
        self.assertFalse(self.findButton(vs, "All").isEnabled())  # Disabled as button has no input
        self.findButton(vs, "Camera 1").click()
        self.assertEqual(extrasBtn.input, self.switcherState.inputs[VideoSource.INPUT_1])  # Button has input set
        self.assertTrue(self.findButton(vs, "All").isEnabled())  # All button is enabled again

    def testSwitching(self):
        vs = self.makeVS()

        self.findButton(vs, "Cut").click()
        self.atem.performCut.assert_called_once()

        self.findButton(vs, "DVD").click()
        self.atem.setPreview.assert_called_once_with(VideoSource.INPUT_4)

        self.findButton(vs, "Fade").click()
        self.atem.setNextTransition.assert_called_once_with(TransitionStyle.MIX, bkgd=True, key1=False, key2=False, key3=False, key4=False)
        self.atem.performAutoTake.assert_called_once()

        self.findButton(vs, "All").click()
        self.atem.setProgram.assert_called_once_with(VideoSource.INPUT_4)
        self.atem.setAuxSource.assert_has_calls([
            call(1, VideoSource.INPUT_4),
            call(2, VideoSource.INPUT_4),
            call(3, VideoSource.INPUT_4),
            call(4, VideoSource.INPUT_4),
            call(5, VideoSource.INPUT_4),
            call(6, VideoSource.INPUT_4),
        ])

        self.atem.setAuxSource.reset_mock()
        self.findButton(vs, "Visuals PC").click()
        self.findButton(vs.og, "Record").click()
        self.atem.setAuxSource.assert_called_once_with(2, VideoSource.INPUT_5)
        self.atem.setAuxSource.reset_mock()

        self.findButton(vs.og, "Record").longpress.emit()
        self.atem.setAuxSource.assert_called_once_with(2, VideoSource.ME_1_PROGRAM)
        self.atem.setAuxSource.reset_mock()

        self.findButton(vs.og, "Mix to all").click()
        self.atem.setAuxSource.assert_has_calls([
            call(1, VideoSource.ME_1_PROGRAM),
            call(2, VideoSource.ME_1_PROGRAM),
            call(3, VideoSource.ME_1_PROGRAM),
            call(4, VideoSource.ME_1_PROGRAM),
            call(5, VideoSource.ME_1_PROGRAM),
            call(6, VideoSource.ME_1_PROGRAM),
        ])
コード例 #15
0
 def setUp(self):
     GuiTest.setUp(self)
     self.mockController = MockController()
     self.mockBlindsDevice = Device("Test")
     self.mockController.addDevice(self.mockBlindsDevice)
     self.mockMainWindow = MainWindow(self.mockController)
コード例 #16
0
 def setUp(self):
     GuiTest.setUp(self)
     self.mockController = MockController()
     self.mockBlindsDevice = Device("Test")
     self.mockController.addDevice(self.mockBlindsDevice)
     self.mockMainWindow = MainWindow(self.mockController)