Skip to content

Commit

Permalink
Further correct flake8 style errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
eeromakiesko authored and eeter committed Feb 25, 2019
1 parent 15da67d commit 5401170
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/WhiteLibrary/keywords/items/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,3 @@ def get_check_box_state(self, locator):
"""
checkbox = self.state._get_typed_item_by_locator(CheckBox, locator)
return checkbox.IsSelected


1 change: 0 additions & 1 deletion src/WhiteLibrary/keywords/items/listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ def right_click_listview_row(self, locator, column_name, cell_text, x_offset=0,
row = self._get_row(locator, column_name, cell_text)
Clicks.right_click(row, x_offset, y_offset)


@keyword
def right_click_listview_row_by_index(self, locator, row_index, x_offset=0, y_offset=0):
"""Right clicks a listview row at index.
Expand Down
5 changes: 0 additions & 5 deletions src/WhiteLibrary/keywords/items/uiitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from WhiteLibrary.keywords.librarycomponent import LibraryComponent
from WhiteLibrary.keywords.robotlibcore import keyword
from WhiteLibrary.utils.click import Clicks
from robot.api import logger


class UiItemKeywords(LibraryComponent):
Expand All @@ -19,7 +18,6 @@ def click_item(self, locator, x_offset=0, y_offset=0):
item = self.state._get_item_by_locator(locator)
Clicks.click(item, x_offset, y_offset)


@keyword
def right_click_item(self, locator, x_offset=0, y_offset=0):
"""Right clicks an item.
Expand All @@ -33,7 +31,6 @@ def right_click_item(self, locator, x_offset=0, y_offset=0):
item = self.state._get_item_by_locator(locator)
Clicks.right_click(item, x_offset, y_offset)


@keyword
def double_click_item(self, locator, x_offset=0, y_offset=0):
"""Double clicks an item.
Expand All @@ -47,7 +44,6 @@ def double_click_item(self, locator, x_offset=0, y_offset=0):
item = self.state._get_item_by_locator(locator)
Clicks.double_click(item, x_offset, y_offset)


@keyword
def get_items(self, locator):
"""Returns a list of items that match the given `locator`.
Expand All @@ -64,4 +60,3 @@ def get_item(self, locator):
Locator syntax is explained in `Item locators`.
"""
return self.state._get_item_by_locator(locator)

11 changes: 6 additions & 5 deletions src/WhiteLibrary/utils/click.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from TestStack.White.UIA import RectX
from TestStack.White.InputDevices import Mouse


class Clicks():
#Low level function to handle offset click.
# Low level function to handle offset click.
@staticmethod
def click(item, x_offset, y_offset):
if x_offset == 0 and y_offset == 0:
Expand All @@ -12,7 +13,7 @@ def click(item, x_offset, y_offset):
offset_position = Clicks._get_offset_point(item, x_offset, y_offset)
Mouse.Instance.Click(offset_position)

#Low level helper function to handle offset right click.
# Low level helper function to handle offset right click.
@staticmethod
def right_click(item, x_offset, y_offset):
if x_offset == 0 and y_offset == 0:
Expand All @@ -22,7 +23,7 @@ def right_click(item, x_offset, y_offset):
Mouse.Instance.Location = offset_position
Mouse.Instance.RightClick()

#Low level helper function to handle offset double click.
# Low level helper function to handle offset double click.
@staticmethod
def double_click(item, x_offset, y_offset):
if x_offset == 0 and y_offset == 0:
Expand All @@ -31,13 +32,13 @@ def double_click(item, x_offset, y_offset):
offset_position = Clicks._get_offset_point(item, x_offset, y_offset)
Mouse.Instance.DoubleClick(offset_position)

#Helper function to translate item center to offset point
# Helper function to translate item center to offset point
@staticmethod
def _get_offset_point(item, x_offset, y_offset):
item_bounds = item.Bounds
item_center = RectX.Center(item_bounds)
offset_point = Point(int(item_center.X) + int(x_offset),
int(item_center.Y) + int(y_offset))
int(item_center.Y) + int(y_offset))
if not item_bounds.Contains(offset_point):
raise AssertionError("click location out of bounds")
return offset_point

0 comments on commit 5401170

Please sign in to comment.