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()
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)
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()
def test_windows_managed(self): wid = util.create_window() pwm.state.store() self.reset() pwm.state.restore() self.assertIn(wid, pwm.windows.managed)
def test_focused(self): wid = util.create_window() pwm.state.store() self.reset() pwm.state.restore() self.assertEqual(pwm.windows.focused, wid)
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)
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)
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()
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])
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))
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()
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()
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)
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)
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)
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)
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)))
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)))
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)
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)
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))
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))
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)
def test_handle_wm_state_add_fullscreen(self): wid = util.create_window() self._test_wm_state_fullscreen(wid, pwm.atom._NET_WM_STATE_ADD)
def test_handle_wm_state_add_fullscreen(self): wid = util.create_window() self._test_wm_state_fullscreen(wid, pwm.atom._NET_WM_STATE_ADD)
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)]
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)
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)
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)
def test_handle_wm_state_toggle_urgent(self): wid = util.create_window() self._test_wm_state_urgent(wid, pwm.atom._NET_WM_STATE_TOGGLE)
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)
def test_send_to_workspace(self, send): wid = util.create_window() pwm.commands.send_to_workspace(1)() send.assert_called_once_with(wid, 1)
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)
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)]
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)
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)
def test_handle_wm_state_toggle_urgent(self): wid = util.create_window() self._test_wm_state_urgent(wid, pwm.atom._NET_WM_STATE_TOGGLE)
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)
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)
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)
def test_kill(self, kill): wid = util.create_window() pwm.commands.kill()() kill.assert_called_once_with(wid)
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)