Skip to content

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

@saket

Description

@saket

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))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions