Skip to content

Commit

Permalink
Add activityScenario.close() to prevent activity leak
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Dec 16, 2023
1 parent 730f2a8 commit 394a6c7
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ fun captureRoboImage(
val viewRootForTest = composeView.getChildAt(0) as ViewRootForTest
viewRootForTest.view.captureRoboImage(file, roborazziOptions)
}
// Closing the activity is necessary to prevent memory leaks.
// If multiple captureRoboImage calls occur in a single test,
// they can lead to an activity leak.
activityScenario.close()
}

/**
Expand Down

0 comments on commit 394a6c7

Please sign in to comment.