Skip to content

Commit

Permalink
Added screen and window sizes to reset function
Browse files Browse the repository at this point in the history
  • Loading branch information
peterklijn committed Aug 28, 2022
1 parent ae03cc3 commit cfb3a48
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hammerspoon_mocks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ local hotkey = {
bindings = {},
}

local defaultScreenRect = { x = 0, y = 0, w = 1200, h = 800 }
local defaultWindowRect = { x = 100, y = 100, w = 1000, h = 600 }

function hotkey.bind(mods, key, fn)
lu.assertNotNil(mods)
lu.assertNotNil(key)
Expand All @@ -12,15 +15,15 @@ function hotkey.bind(mods, key, fn)
end

local screen = {
rect = { x = 0, y = 0, w = 1200, h = 800 },
rect = defaultScreenRect,
}

function screen:frame()
return self.rect
end

local window = {
rect = { x = 0, y = 0, w = 1200, h = 800 },
rect = defaultWindowRect,
_screen = screen,
}

Expand Down Expand Up @@ -51,6 +54,8 @@ local mocks = {

function mocks:reset()
self.hotkey.bindings = {}
self.window.rect = defaultWindowRect
self.window._screen.rect = defaultScreenRect
end

return mocks

0 comments on commit cfb3a48

Please sign in to comment.