Skip to content

Commit d5d17c1

Browse files
committed
got rid of toPixels
1 parent aed587a commit d5d17c1

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

src/main/java/net/itarray/automotion/internal/ResponsiveUIValidatorBase.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,6 @@ private double getScaleFactor() {
132132
return factor;
133133
}
134134

135-
protected int toPixelsHorizontally(int coordinate) {
136-
return toPixels(Direction.RIGHT, coordinate);
137-
}
138-
139-
protected int toPixelsVertically(int coordinate) {
140-
return toPixels(Direction.DOWN, coordinate);
141-
}
142-
143-
private int toPixels(Direction direction, int coordinate) { // todo: remove
144-
if (getUnits().equals(Units.PX)) {
145-
return coordinate;
146-
} else {
147-
return (coordinate * page.getExtend(direction).intValue()) / 100;
148-
}
149-
}
150-
151-
152135
private int getYOffset() {
153136
if (isMobile() && getDriver().isAppiumWebContext() && getReport().isMobileTopBarOffset()) {
154137
if (isIOS() || isAndroid()) {

src/main/java/net/itarray/automotion/internal/UIValidatorBase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,10 @@ public UIValidatorBase isInsideOf(WebElement containerElement, String readableCo
569569

570570
@Override
571571
public UIValidatorBase isInsideOf(WebElement containerElement, String readableContainerName, Padding padding) {
572-
int top = toPixelsVertically(padding.getTop());
573-
int right = toPixelsHorizontally(padding.getRight());
574-
int bottom = toPixelsVertically(padding.getBottom());
575-
int left = toPixelsHorizontally(padding.getLeft());
572+
int top = percentOrPixels(padding.getTop()).evaluateIn(getContext(), Direction.UP).intValue();
573+
int right = percentOrPixels(padding.getRight()).evaluateIn(getContext(), Direction.RIGHT).intValue();
574+
int bottom = percentOrPixels(padding.getBottom()).evaluateIn(getContext(), Direction.DOWN).intValue();
575+
int left = percentOrPixels(padding.getLeft()).evaluateIn(getContext(), Direction.LEFT).intValue();
576576

577577
rootElement.validateInsideOfContainer(asElement(containerElement, readableContainerName), top, right, bottom, left, errors);
578578
return this;

0 commit comments

Comments
 (0)