Skip to content

Commit

Permalink
More Mac bugfixes; updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glitchassassin committed Nov 13, 2018
1 parent 7af29f6 commit 20d90bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 7 additions & 6 deletions lackey/PlatformManagerDarwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ def getScreenDetails(self):
)
}
screens.append(screen)

# Convert y-coordinates
y1 = min([s["rect"][1] for s in screens])
y2 = max([s["rect"][1]+s["rect"][3] for s in screens])
y1 = screens[0]["rect"][1] # min([s["rect"][1] for s in screens])
y2 = screens[0]["rect"][1]+screens[0]["rect"][3] # max([s["rect"][1]+s["rect"][3] for s in screens])
for screen in screens:
screen["rect"] = (
screen["rect"][0],
Expand All @@ -297,15 +298,15 @@ def isPointVisible(self, x, y):
def osCopy(self):
""" Triggers the OS "copy" keyboard shortcut """
k = Keyboard()
k.keyDown("{CTRL}")
k.keyDown("{CMD}")
k.type("c")
k.keyUp("{CTRL}")
k.keyUp("{CMD}")
def osPaste(self):
""" Triggers the OS "paste" keyboard shortcut """
k = Keyboard()
k.keyDown("{CTRL}")
k.keyDown("{CMD}")
k.type("v")
k.keyUp("{CTRL}")
k.keyUp("{CMD}")

## Window functions

Expand Down
12 changes: 11 additions & 1 deletion tests/appveyor_test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_offsets(self):
self.assertEqual(offset.getTuple(), (3,11))

def test_screen_methods(self):
outside_loc = lackey.Location(-10, -10)
outside_loc = lackey.Location(-9000, -9000)
self.assertIsNone(outside_loc.getScreen()) # Should be outside all screens and return None
self.assertEqual(self.test_loc.getScreen().getID(), 0) # Test location should be on screen 0
self.assertEqual(outside_loc.getMonitor().getID(), 0) # Outside all screens, should return default monitor (0)
Expand Down Expand Up @@ -436,6 +436,7 @@ def test_region_interface(self):
self.assertHasMethod(lackey.Region, "findAll", 2)
self.assertHasMethod(lackey.Region, "wait", 3)
self.assertHasMethod(lackey.Region, "waitVanish", 3)
self.assertHasMethod(lackey.Region, "has", 2)
self.assertHasMethod(lackey.Region, "exists", 3)
self.assertHasMethod(lackey.Region, "click", 3)
self.assertHasMethod(lackey.Region, "doubleClick", 3)
Expand All @@ -454,6 +455,15 @@ def test_region_interface(self):
self.assertHasMethod(lackey.Region, "wheel", 1) # Uses *args
self.assertHasMethod(lackey.Region, "keyDown", 2)
self.assertHasMethod(lackey.Region, "keyUp", 2)
# OCR Methods
self.assertHasMethod(lackey.Region, "findText", 2)
self.assertHasMethod(lackey.Region, "findWord", 2)
self.assertHasMethod(lackey.Region, "findLine", 2)
self.assertHasMethod(lackey.Region, "waitText", 3)
self.assertHasMethod(lackey.Region, "hasText", 2)
self.assertHasMethod(lackey.Region, "existsText", 3)
self.assertHasMethod(lackey.Region, "waitVanishText", 3)
self.assertHasMethod(lackey.Region, "findAllText", 2)
# Event Handler Methods
self.assertHasMethod(lackey.Region, "onAppear", 3)
self.assertHasMethod(lackey.Region, "onVanish", 3)
Expand Down

0 comments on commit 20d90bb

Please sign in to comment.