Inconsistency in `-[EarlGreyImpl rotateDeviceToOrientation: error:]`
- Dominant language
- Objective-C
- Stars
- 5.7k
- Forks
- 737
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 5
Description
The documentation and the implementation differs.
According to the [documentation](https://github.com/google/EarlGrey/blob/d5b5f18f3cf231f3b3c53a898780926aaeed2905/TestLib/EarlGreyImpl/EarlGreyImpl.h#L274), any orientation is a valid input, except for unknown.
Except that the orientations face up/down are not actually valid. They cause an error.
Indeed, those two Interface orientations are mapped to the unknown devices orientations. And so the behavior in this case is exactly the same as if the user used unknown input.
So either the implementation or the documentation should be changed.
I’m personally more in favor of doing the following change:
* the current method, taking the device orientation as input, would have its documentation changed to note that face up/down are also not authorized input.
* and potentially, split this function in two. One that takes the interface orientation as input and the other one that takes the device orientation as input. The latter would be implemented using the former, and marked as deprecated. The latter would indeed accept any value except for unknown.
An alternative solution would be to state that there is some default interface orientation associated with face up/down. But I don’t think that would be intuitive for the user so I’m slightly against it.
This is related to Chromium bug crbug.com/438558888
Contributor guide
Research direction
Start with the rotateDeviceToOrientation:error: declaration and documentation in TestLib/EarlGreyImpl/EarlGreyImpl.h, then inspect its implementation and the mappings for face up/down and unknown orientations. Resolve whether the API or documentation should change, and verify that the documented accepted inputs match the resulting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c
- Domain
- mobile-dev, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100