From 439dfc5cb1136cd0eafaa86a72095f67eae5974b Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 14 Oct 2020 15:36:29 -0700 Subject: [PATCH] For #15644: add comment for why we set the app theme in test. --- .../fenix/helpers/FenixRobolectricTestApplication.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestApplication.kt b/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestApplication.kt index e46c420a6..e1a108743 100644 --- a/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestApplication.kt +++ b/app/src/test/java/org/mozilla/fenix/helpers/FenixRobolectricTestApplication.kt @@ -17,7 +17,7 @@ class FenixRobolectricTestApplication : FenixApplication() { override fun onCreate() { super.onCreate() - setTheme(R.style.NormalTheme) + setApplicationTheme() } override val components = TestComponents(this) @@ -27,4 +27,14 @@ class FenixRobolectricTestApplication : FenixApplication() { override fun setupInAllProcesses() = Unit override fun setupInMainProcessOnly() = Unit + + private fun setApplicationTheme() { + // According to the Robolectric devs, the application context will not have the 's + // theme but will use the platform's default team so we set our theme here. We change it here + // rather than the production application because, upon testing, the production code appears + // appears to be working correctly. Context here: + // https://github.com/mozilla-mobile/fenix/pull/15646#issuecomment-707345798 + // https://github.com/mozilla-mobile/fenix/pull/15646#issuecomment-709411141 + setTheme(R.style.NormalTheme) + } }