示例#1
0
    def test_saveConfigurationMask(self, qtbot):
        mw = SpotMotionMonitor()
        mw.show()
        qtbot.addWidget(mw)
        # Force camera setup
        mw.cameraController.setupCamera('GaussianCamera')

        mask = mw.getSaveConfigurationMask()
        assert mask == 0
        mw.actionWritePlotConfig.setChecked(True)
        mask = mw.getSaveConfigurationMask()
        assert mask == 1
        mw.actionWriteEmptyConfig.setChecked(True)
        mask = mw.getSaveConfigurationMask()
        assert mask == 3
        mw.actionWritePlotConfig.setChecked(False)
        mask = mw.getSaveConfigurationMask()
        assert mask == 2
示例#2
0
    def test_saveConfiguration(self, qtbot, mocker):
        mw = SpotMotionMonitor()
        mw.show()
        qtbot.addWidget(mw)
        # Force camera setup
        mw.cameraController.setupCamera('GaussianCamera')

        truthFile = "./configuration.yaml"

        mask = mw.getSaveConfigurationMask()
        assert mask == 0

        mw._saveFileDialog = mocker.Mock(return_value=truthFile)
        mw.saveConfiguration()
        assert os.path.exists(truthFile)
        os.remove(truthFile)