Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScreenOrientationRule does not restore the orientation if a test fails #2308

Open
saket opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@saket
Copy link

saket commented Nov 8, 2024

Does ScreenOrientationRule need a try block around its statement evaluation?

Current:

val orientationToRestore = defaultOrientation ?: getCurrentOrientation()
statement.evaluate()
onDevice().perform(setScreenOrientation(orientationToRestore))

Proposed:

val orientationToRestore = defaultOrientation ?: getCurrentOrientation()
try {
  statement.evaluate()
} finally {
  onDevice().perform(setScreenOrientation(orientationToRestore))
}
saket added a commit to saket/telephoto that referenced this issue Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant