def test_get_supported_modes(self, monkeypatch, edid, fs):
        """
        Tests the the get_supported_modes function returns the expected values.

        Args:
            monkeypatch - pytest fixture which gives mocking functionality
            edid - parameterised fixture containing raw, rpi_dumps, expected test data
        """

        from kano_settings.system import display

        # get_supported_modes will bail if it can't find the tvservice executable
        fs.CreateFile(display.tvservice_path)

        # Mock the subprocess function to return the dumps for the CEA modes.
        monkeypatch.setattr(
            display.subprocess, 'check_output',
            lambda x: edid['rpi_dumps']['cea_modes']
        )
        rv_cea = display.get_supported_modes('CEA', min_width=0, min_height=0)

        # Mock the subprocess function to return the dumps for the DMT modes.
        monkeypatch.setattr(
            display.subprocess, 'check_output',
            lambda x: edid['rpi_dumps']['dmt_modes']
        )
        rv_dmt = display.get_supported_modes('DMT', min_width=0, min_height=0)

        assert(
            rv_cea == edid['expected']['cea_modes'] and
            rv_dmt == edid['expected']['dmt_modes']
        )
    def test_get_supported_modes(self, monkeypatch, edid, fs):
        """
        Tests the the get_supported_modes function returns the expected values.

        Args:
            monkeypatch - pytest fixture which gives mocking functionality
            edid - parameterised fixture containing raw, rpi_dumps, expected test data
        """

        from kano_settings.system import display

        # get_supported_modes will bail if it can't find the tvservice executable
        fs.CreateFile(display.tvservice_path)

        # Mock the subprocess function to return the dumps for the CEA modes.
        monkeypatch.setattr(display.subprocess, 'check_output',
                            lambda x: edid['rpi_dumps']['cea_modes'])
        rv_cea = display.get_supported_modes('CEA', min_width=0, min_height=0)

        # Mock the subprocess function to return the dumps for the DMT modes.
        monkeypatch.setattr(display.subprocess, 'check_output',
                            lambda x: edid['rpi_dumps']['dmt_modes'])
        rv_dmt = display.get_supported_modes('DMT', min_width=0, min_height=0)

        assert (rv_cea == edid['expected']['cea_modes']
                and rv_dmt == edid['expected']['dmt_modes'])
Example #3
0
    def test_get_supported_modes(self, monkeypatch, edid):
        """
        Tests the the get_supported_modes function returns the expected values.

        Args:
            monkeypatch - pytest fixture which gives mocking functionality
            edid - parameterised fixture containing raw, rpi_dumps, expected test data
        """

        # Mock the subprocess function to return the dumps for the CEA modes.
        monkeypatch.setattr(display.subprocess, 'check_output',
                            lambda x: edid['rpi_dumps']['cea_modes'])
        rv_cea = display.get_supported_modes('CEA', min_width=0, min_height=0)

        # Mock the subprocess function to return the dumps for the DMT modes.
        monkeypatch.setattr(display.subprocess, 'check_output',
                            lambda x: edid['rpi_dumps']['dmt_modes'])
        rv_dmt = display.get_supported_modes('DMT', min_width=0, min_height=0)

        assert (rv_cea == edid['expected']['cea_modes']
                and rv_dmt == edid['expected']['dmt_modes'])
Example #4
0
    def test_cea_modes(self):
        with patched_isfile_cmd():
            with patched_subprocess_cmd(TVSERVICE_CEA_OUTPUT):
                modes = display.get_supported_modes('CEA')

        expected_val = {
            1: ['640x480', '60Hz', '4:3'],
            2: ['720x480', '60Hz', '4:3'],
            3: ['720x480', '60Hz', '16:9'],
            4: ['1280x720', '60Hz', '16:9'],
            17: ['720x576', '50Hz', '4:3'],
            18: ['720x576', '50Hz', '16:9'],
            19: ['1280x720', '50Hz', '16:9']
        }
        self.assertEqual(modes, expected_val)
Example #5
0
    def test_dmt_modes(self):
        with patched_isfile_cmd():
            with patched_subprocess_cmd(TVSERVICE_DMT_OUTPUT):
                modes = display.get_supported_modes('DMT')

        expected_val = {
            4: ['640x480', '60Hz', '4:3'],
            5: ['640x480', '72Hz', '4:3'],
            6: ['640x480', '75Hz', '4:3'],
            39: ['1360x768', '60Hz', '16:9'],
            8: ['800x600', '56Hz', '4:3'],
            9: ['800x600', '60Hz', '4:3'],
            10: ['800x600', '72Hz', '4:3'],
            11: ['800x600', '75Hz', '4:3'],
            16: ['1024x768', '60Hz', '4:3'],
            17: ['1024x768', '70Hz', '4:3'],
            18: ['1024x768', '75Hz', '4:3'],
            85: ['1280x720', '60Hz', '16:9'],
            81: ['1366x768', '60Hz', '16:9']
        }
        self.assertEqual(modes, expected_val)