コード例 #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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_layout.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
    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
ファイル: test_layout.py プロジェクト: linuscl/pwm
    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
ファイル: test_layout.py プロジェクト: linuscl/pwm
    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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_layout.py プロジェクト: linuscl/pwm
    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
ファイル: test_layout.py プロジェクト: linuscl/pwm
 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
ファイル: test_layout.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_events.py プロジェクト: linuscl/pwm
 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
ファイル: test_layout.py プロジェクト: linuscl/pwm
 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)