# Path: pwm/config.py
# class Config:
#     def __init__(self):
#     def load(self, default=False):
#     def _load_default(self):
#     def _ensure_config_exists(self, path):
#     def __getattr__(self, name):
# def setup_keys():
# def handle_key_press_event(event):
# def create_arguments(func):
#     def wrapper(*args, **kwargs):


import unittest
import pwm.layout
import pwm.workspaces
import test.util as util
from unittest.mock import patch
from pwm.config import config

    def test_add_window(self):
        wid = util.create_window(floating=True)
        self.floating.add_window(wid)
        self.assertIn(wid, self.floating.windows)

    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_delta(self):
        self.assertEqual(self.floating._delta("left", 10), (-10, 0))
        self.assertEqual(self.floating._delta("right", 10), (10, 0))
        self.assertEqual(self.floating._delta("up", 10), (0, -10))
        self.assertEqual(self.floating._delta("down", 10), (0, 10))

    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

# Path: pwm/config.py
# class Config:
#     def __init__(self):
#     def load(self, default=False):
#     def _load_default(self):
#     def _ensure_config_exists(self, path):
#     def __getattr__(self, name):
# def setup_keys():
# def handle_key_press_event(event):
# def create_arguments(func):
#     def wrapper(*args, **kwargs):


# Path: test/test_layout.py
import unittest
import pwm.layout
import pwm.workspaces
import test.util as util
from unittest.mock import patch
from pwm.config import config


    def test_add_window(self):
        wid = util.create_window(floating=True)
        self.floating.add_window(wid)
        self.assertIn(wid, self.floating.windows)

    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_delta(self):
        self.assertEqual(self.floating._delta("left", 10), (-10, 0))
        self.assertEqual(self.floating._delta("right", 10), (10, 0))
        self.assertEqual(self.floating._delta("up", 10), (0, -10))
        self.assertEqual(self.floating._delta("down", 10), (0, 10))

    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