architecture-samples
architecture-samples copied to clipboard
HiltTestActivity missing setTheme()
I was looking at HiltTestActivity comparing to EmptyTestActivity it is missing setTheme() during onCreate() method.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setTheme(
intent.getIntExtra(
"androidx.fragment.app.testing.FragmentScenario.EmptyFragmentActivity.THEME_EXTRAS_BUNDLE_KEY",
R.style.FragmentScenarioEmptyFragmentActivityTheme
)
)
}
This ignores the theme passed to launchFragmentInHiltContainer method
I second this. Without it, my test fails with
You need to use a Theme.AppCompat theme (or descendant) with this activity.
Thanks for the hint @Sserra90