Exemple #1
0
    def test_compose_mode_args(self):
        xrandr = Xrandr(":0", None)
        xrandr.EXECUTABLE = "stub"

        outputs = {
            "LVDS1": Output(mode='1366x768'),
            "DP1": Output(mode='1920x1080', pos='1366x0', scale='1.5x1.5', panning='1920x1080'),
            "VGA1": Output(mode='800x600', pos='0x768')
        }

        p = Profile("default", outputs, primary="LVDS1")

        xrandr_connections = [XrandrConnection("HDMI1"), XrandrConnection("HDMI2")]

        command = xrandr._compose_mode_args(p, xrandr_connections)

        num_of_outputs = len(outputs) + len(xrandr_connections)

        self.assertEqual(num_of_outputs, command.count(xrandr.OUTPUT_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.POS_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.MODE_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.PANNING_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.ROTATE_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.SCALE_KEY))
        self.assertEqual(len(xrandr_connections), command.count(xrandr.OFF_KEY))
        self.assertEqual(1, command.count(xrandr.PRIMARY_KEY))
        self.assertEqual(1, command.count("LVDS1"))
        self.assertEqual(1, command.count("DP1"))
        self.assertEqual(1, command.count("VGA1"))
        self.assertEqual(1, command.count("HDMI1"))
        self.assertEqual(1, command.count("HDMI2"))
Exemple #2
0
    def test_compose_mode_args_exact_line(self):
        xrandr = Xrandr(":0", None)
        xrandr.EXECUTABLE = "stub"

        outputs = {"LVDS1": Output(mode='1366x768')}

        p = Profile("default", outputs, primary="LVDS1")

        xrandr_connections = [XrandrConnection("LVDS1"), XrandrConnection("HDMI1")]

        command = xrandr._compose_mode_args(p, xrandr_connections)
        self.assertListEqual([
            '--output', 'LVDS1', '--mode', '1366x768', '--pos', '0x0', '--rotate', 'normal', '--panning', '0x0',
            '--scale', '1x1', '--primary',
            '--output', 'HDMI1', '--off'
        ], command)
Exemple #3
0
    def test_compose_mode_args_exact_line(self):
        xrandr = Xrandr()
        xrandr.EXECUTABLE = "stub"

        outputs = [Output("LVDS1", mode='1366x768')]

        p = Profile("default", outputs, primary="LVDS1")

        xrandr_connections = [
            XrandrConnection("LVDS1"),
            XrandrConnection("HDMI1")
        ]

        command = xrandr._compose_mode_args(p, xrandr_connections)
        self.assertListEqual([
            '--output', 'LVDS1', '--mode', '1366x768', '--pos', '0x0',
            '--rotate', 'normal', '--panning', '0x0', '--scale', '1x1',
            '--primary', '--output', 'HDMI1', '--off'
        ], command)
Exemple #4
0
    def test_compose_mode_args(self):
        xrandr = Xrandr(":0", None)
        xrandr.EXECUTABLE = "stub"

        outputs = {
            "LVDS1":
            Output(mode='1366x768'),
            "DP1":
            Output(mode='1920x1080',
                   pos='1366x0',
                   scale='1.5x1.5',
                   panning='1920x1080'),
            "VGA1":
            Output(mode='800x600', pos='0x768')
        }

        p = Profile("default", outputs, primary="LVDS1")

        xrandr_connections = [
            XrandrConnection("HDMI1"),
            XrandrConnection("HDMI2")
        ]

        command = xrandr._compose_mode_args(p, xrandr_connections)

        num_of_outputs = len(outputs) + len(xrandr_connections)

        self.assertEqual(num_of_outputs, command.count(xrandr.OUTPUT_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.POS_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.MODE_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.PANNING_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.ROTATE_KEY))
        self.assertEqual(len(outputs), command.count(xrandr.SCALE_KEY))
        self.assertEqual(len(xrandr_connections),
                         command.count(xrandr.OFF_KEY))
        self.assertEqual(1, command.count(xrandr.PRIMARY_KEY))
        self.assertEqual(1, command.count("LVDS1"))
        self.assertEqual(1, command.count("DP1"))
        self.assertEqual(1, command.count("VGA1"))
        self.assertEqual(1, command.count("HDMI1"))
        self.assertEqual(1, command.count("HDMI2"))