Skip to content

Commit

Permalink
Use captureScreenRoboImage for dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Dec 13, 2024
1 parent b648545 commit c6e8413
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewRootForTest
import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso
import org.robolectric.Shadows
import java.io.File


Expand Down Expand Up @@ -117,8 +115,10 @@ private fun ActivityScenario<out ComponentActivity>.captureRoboImage(
val viewRootForTest = composeView.getChildAt(0) as ViewRootForTest
viewRootForTest.view.captureRoboImage(file, roborazziOptions)
} else {
// For dialogs
captureRootsInternal(windowRoots.drop(1), roborazziOptions, file)
// Dialog case
roborazziReportLog("It seems that there are multiple windows." +
"We merge all windows using captureScreenRoboImage().")
captureScreenRoboImage(file, roborazziOptions)
}
}
}

0 comments on commit c6e8413

Please sign in to comment.