示例#1
0
    def test_toggle_focus_layer(self):
        util.create_window()
        ws = pwm.workspaces.current()

        with patch.object(ws, "toggle_focus_layer") as toggle:
            pwm.commands.toggle_focus_layer()()
        toggle.assert_called_once_with()
示例#2
0
    def test_handle_unmap(self):
        wid = util.create_window()

        with patch.object(pwm.windows, "unmanage") as unmanage:
            pwm.events.handle_unmap(wid)

        unmanage.assert_called_once_with(wid)
示例#3
0
    def test_add_window_configure(self):
        wid = util.create_window()

        with patch.object(pwm.windows, "configure") as conf:
            self.fullscreen.add_window(wid)

        conf.assert_called_once()
示例#4
0
文件: test_state.py 项目: linuscl/pwm
    def test_windows_managed(self):
        wid = util.create_window()
        pwm.state.store()
        self.reset()
        pwm.state.restore()

        self.assertIn(wid, pwm.windows.managed)
示例#5
0
文件: test_state.py 项目: linuscl/pwm
    def test_focused(self):
        wid = util.create_window()

        pwm.state.store()
        self.reset()
        pwm.state.restore()
        self.assertEqual(pwm.windows.focused, wid)
示例#6
0
    def test_toggle_floating(self):
        wid = util.create_window()
        ws = pwm.workspaces.current()

        with patch.object(ws, "toggle_floating") as toggle:
            pwm.commands.toggle_floating()()
        toggle.assert_called_once_with(wid)
示例#7
0
    def test_handle_unmap(self):
        wid = util.create_window()

        with patch.object(pwm.windows, "unmanage") as unmanage:
            pwm.events.handle_unmap(wid)

        unmanage.assert_called_once_with(wid)
示例#8
0
    def test_add_window_configure(self):
        wid = util.create_window()

        with patch.object(pwm.windows, "configure") as conf:
            self.fullscreen.add_window(wid)

        conf.assert_called_once()
示例#9
0
文件: test_state.py 项目: linuscl/pwm
    def test_windows_managed_workspace(self):
        wid = util.create_window()
        pwm.state.store()
        self.reset()
        pwm.state.restore()

        self.assertEqual(pwm.windows.managed[wid].workspace,
                         pwm.workspaces.workspaces[0])
示例#10
0
    def test_resize(self):
        wid = util.create_window()
        ws = pwm.workspaces.current()

        with patch.object(ws, "resize_window") as resize:
            pwm.commands.resize((0.1, 0.1))()

        resize.assert_called_once_with(wid, (0.1, 0.1))
示例#11
0
    def test_handle_configure_request_floating(self):
        wid = util.create_window(floating=True)
        event = MagicMock()
        event.window = wid

        with patch.object(pwm.windows, "configure") as conf:
            pwm.events.handle_configure_request(event)

        conf.assert_called_once()
示例#12
0
    def test_handle_configure_request_floating(self):
        wid = util.create_window(floating=True)
        event = MagicMock()
        event.window = wid

        with patch.object(pwm.windows, "configure") as conf:
            pwm.events.handle_configure_request(event)

        conf.assert_called_once()
示例#13
0
    def test_handle_configure_request_tiling(self):
        wid = util.create_window()
        event = MagicMock()
        event.window = wid

        with patch.object(pwm.windows.managed[wid].workspace.tiling,
                          "arrange") as arr:
            pwm.events.handle_configure_request(event)

        arr.assert_called_once_with(wid)
示例#14
0
    def test_handle_property_notify_name(self):
        wid = util.create_window()
        event = MagicMock()
        event.atom = pwm.atom.get("_NET_WM_NAME")
        event.window = wid

        with patch.object(pwm.events, "window_name_changed") as ev:
            pwm.events.handle_property_notify(event)

        ev.assert_called_once_with(wid)
示例#15
0
    def test_handle_configure_request_tiling(self):
        wid = util.create_window()
        event = MagicMock()
        event.window = wid

        with patch.object(pwm.windows.managed[wid].workspace.tiling,
                          "arrange") as arr:
            pwm.events.handle_configure_request(event)

        arr.assert_called_once_with(wid)
示例#16
0
    def test_handle_property_notify_name(self):
        wid = util.create_window()
        event = MagicMock()
        event.atom = pwm.atom.get("_NET_WM_NAME")
        event.window = wid

        with patch.object(pwm.events, "window_name_changed") as ev:
            pwm.events.handle_property_notify(event)

        ev.assert_called_once_with(wid)
示例#17
0
    def test_resize(self):
        wid = util.create_window(floating=True)
        _, _, width, height = pwm.windows.get_geometry(wid)

        self.floating.resize(wid, (0.02, 0.03))

        _, _, new_width, new_height = pwm.windows.get_geometry(wid)
        ws = pwm.workspaces.current()
        self.assertEqual(
            (new_width, new_height),
            (round(width+ws.width*0.02), round(height+ws.height*0.03)))
示例#18
0
    def test_resize(self):
        wid = util.create_window(floating=True)
        _, _, width, height = pwm.windows.get_geometry(wid)

        self.floating.resize(wid, (0.02, 0.03))

        _, _, new_width, new_height = pwm.windows.get_geometry(wid)
        ws = pwm.workspaces.current()
        self.assertEqual(
            (new_width, new_height),
            (round(width + ws.width * 0.02), round(height + ws.height * 0.03)))
示例#19
0
    def test_focus(self):
        wid = util.create_window()
        ws = pwm.workspaces.current()

        def _test_focus(pos):
            with patch.object(ws, "focus_relative") as focus:
                pwm.commands.focus(pos)()

            focus.assert_called_once_with(wid, pos)

        for pos in ["above", "below", "left", "right"]:
            _test_focus(pos)
示例#20
0
    def test_move(self):
        wid = util.create_window()
        ws = pwm.workspaces.current()

        def _test_direction(direction):
            with patch.object(ws, "move_window") as move:
                pwm.commands.move(direction)()

            move.assert_called_once_with(wid, direction)

        for d in ["up", "down", "left", "right"]:
            _test_direction(d)
示例#21
0
    def test_move(self):
        wid = util.create_window(floating=True)

        def _test_move(direction, relpos):
            x, y = 0, 0
            pwm.windows.configure(wid, x=x, y=y)
            self.floating.move(wid, direction)
            nx, ny, _, _ = pwm.windows.get_geometry(wid)
            self.assertEqual((nx, ny),
                             (round(x + relpos[0]), round(y + relpos[1])))

        speedx = config.window.move_speed * self.floating.workspace.width
        speedy = config.window.move_speed * self.floating.workspace.height
        _test_move("right", (speedx, 0))
        _test_move("left", (-speedx, 0))
        _test_move("up", (0, -speedy))
        _test_move("down", (0, speedy))
示例#22
0
    def test_move(self):
        wid = util.create_window(floating=True)

        def _test_move(direction, relpos):
            x, y = 0, 0
            pwm.windows.configure(wid, x=x, y=y)
            self.floating.move(wid, direction)
            nx, ny, _, _ = pwm.windows.get_geometry(wid)
            self.assertEqual((nx, ny),
                             (round(x+relpos[0]), round(y+relpos[1])))

        speedx = config.window.move_speed*self.floating.workspace.width
        speedy = config.window.move_speed*self.floating.workspace.height
        _test_move("right", (speedx, 0))
        _test_move("left", (-speedx, 0))
        _test_move("up", (0, -speedy))
        _test_move("down", (0, speedy))
示例#23
0
 def test_handle_wm_state_remove_fullscreen(self):
     wid = util.create_window()
     pwm.windows.managed[wid].fullscreen = True
     self._test_wm_state_fullscreen(wid, pwm.atom._NET_WM_STATE_REMOVE)
示例#24
0
 def test_handle_wm_state_add_fullscreen(self):
     wid = util.create_window()
     self._test_wm_state_fullscreen(wid, pwm.atom._NET_WM_STATE_ADD)
示例#25
0
 def test_handle_wm_state_add_fullscreen(self):
     wid = util.create_window()
     self._test_wm_state_fullscreen(wid, pwm.atom._NET_WM_STATE_ADD)
示例#26
0
    def setUp(self):
        util.setup()
        self.tiling = pwm.layout.Tiling(pwm.workspaces.current())

        self.wid = [util.create_window(manage=False) for wid in range(10)]
示例#27
0
 def test_remove_window(self):
     wid = util.create_window(floating=True)
     self.floating.add_window(wid)
     self.floating.remove_window(wid)
     self.assertNotIn(wid, self.floating.windows)
示例#28
0
 def test_remove_window_flag(self):
     wid = util.create_window()
     self.fullscreen.add_window(wid)
     self.fullscreen.remove_window(wid)
     self.assertFalse(pwm.windows.managed[wid].fullscreen)
示例#29
0
 def test_remove_window(self):
     wid = util.create_window()
     self.fullscreen.add_window(wid)
     self.fullscreen.remove_window(wid)
     self.assertNotIn(wid, self.fullscreen.windows)
示例#30
0
 def test_handle_wm_state_toggle_urgent(self):
     wid = util.create_window()
     self._test_wm_state_urgent(wid, pwm.atom._NET_WM_STATE_TOGGLE)
示例#31
0
 def test_handle_wm_state_remove_urgent(self):
     wid = util.create_window()
     pwm.windows.managed[wid].urgent = True
     self._test_wm_state_urgent(wid, pwm.atom._NET_WM_STATE_REMOVE)
示例#32
0
 def test_send_to_workspace(self, send):
     wid = util.create_window()
     pwm.commands.send_to_workspace(1)()
     send.assert_called_once_with(wid, 1)
示例#33
0
 def test_remove_window(self):
     wid = util.create_window(floating=True)
     self.floating.add_window(wid)
     self.floating.remove_window(wid)
     self.assertNotIn(wid, self.floating.windows)
示例#34
0
    def setUp(self):
        util.setup()
        self.tiling = pwm.layout.Tiling(pwm.workspaces.current())

        self.wid = [util.create_window(manage=False) for wid in range(10)]
示例#35
0
 def test_handle_wm_state_remove_urgent(self):
     wid = util.create_window()
     pwm.windows.managed[wid].urgent = True
     self._test_wm_state_urgent(wid, pwm.atom._NET_WM_STATE_REMOVE)
示例#36
0
 def test_handle_wm_state_remove_fullscreen(self):
     wid = util.create_window()
     pwm.windows.managed[wid].fullscreen = True
     self._test_wm_state_fullscreen(wid, pwm.atom._NET_WM_STATE_REMOVE)
示例#37
0
 def test_handle_wm_state_toggle_urgent(self):
     wid = util.create_window()
     self._test_wm_state_urgent(wid, pwm.atom._NET_WM_STATE_TOGGLE)
示例#38
0
 def test_handle_unmap_ignore(self):
     wid = util.create_window()
     pwm.windows.managed[wid].ignore_unmaps = 1
     pwm.events.handle_unmap(wid)
     self.assertEqual(pwm.windows.managed[wid].ignore_unmaps, 0)
示例#39
0
 def test_handle_unmap_ignore(self):
     wid = util.create_window()
     pwm.windows.managed[wid].ignore_unmaps = 1
     pwm.events.handle_unmap(wid)
     self.assertEqual(pwm.windows.managed[wid].ignore_unmaps, 0)
示例#40
0
 def test_remove_window(self):
     wid = util.create_window()
     self.fullscreen.add_window(wid)
     self.fullscreen.remove_window(wid)
     self.assertNotIn(wid, self.fullscreen.windows)
示例#41
0
 def test_kill(self, kill):
     wid = util.create_window()
     pwm.commands.kill()()
     kill.assert_called_once_with(wid)
示例#42
0
 def test_remove_window_flag(self):
     wid = util.create_window()
     self.fullscreen.add_window(wid)
     self.fullscreen.remove_window(wid)
     self.assertFalse(pwm.windows.managed[wid].fullscreen)