#102 FIX by TikhomirovSergey · Pull Request #772 · appium/java-client
Change list
- MissingParameterException was removed
- some code improvements in MultiTouchAction. Now it will throw
IllegalArgumentExceptionwhen no action is defined.
Types of changes
- No changes in production code.
- Bugfix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
| } else if (size == 1) { | ||
| } else { | ||
| //android doesn't like having multi-touch actions with only a single TouchAction... | ||
| performsTouchActions.performTouchAction(actions.build().get(0)); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps touchActions.get(0) ?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. Will improve soon
| checkArgument(touchActions.size() > 0, | ||
| "MultiTouch action must have at least one TouchAction added before it can be performed"); | ||
| if (touchActions.size() > 1) { | ||
| performsTouchActions.performMultiTouchAction(this); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can returns this immediately here, so then else block is not needed
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach
I can't understand how to do it
performsTouchActions.performMultiTouchAction(this);
is void
performsTouchActions.performTouchAction(touchActions.get(0));
returns TouchAction
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (touchActions.size() > 1) { performsTouchActions.performMultiTouchAction(this); return this; } //android doesn't like having multi-touch actions with only a single TouchAction... performsTouchActions.performTouchAction(touchActions.get(0)); return this;
| touchActions.forEach(action -> { | ||
| listOfActionChains.add(action.getParameters().get("actions")); | ||
| }); | ||
| touchActions.forEach(action -> |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to replace it with something like ImmutableList.Builder<Object> listOfActionChains = ImmutableList.copyOf(touchActions.stream().map(x -> x.getParameters().get("actions"))); ?
@mykola-mokhnach There is one more change.
Yes. There is some legacy (from Java 7 times) code which still can be here. Sometimes it is difficult to see it because of force of habit :)
@SrinivasanTarget your rewiev is is also valuable.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters