This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
components/support/ktx/src/androidTest/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="mozilla.components.support.ktx"> | ||
|
||
<application> | ||
<activity | ||
android:name=".TestActivity" | ||
android:exported="false" /> | ||
</application> | ||
|
||
</manifest> |
12 changes: 12 additions & 0 deletions
12
components/support/ktx/src/androidTest/java/mozilla/components/support/ktx/TestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package mozilla.components.support.ktx | ||
|
||
import android.app.Activity | ||
|
||
/** | ||
* Empty activity only to be used in UI tests. | ||
*/ | ||
internal class TestActivity : Activity() |
54 changes: 54 additions & 0 deletions
54
...port/ktx/src/androidTest/java/mozilla/components/support/ktx/android/view/WindowKtTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package mozilla.components.support.ktx.android.view | ||
|
||
import android.graphics.Color | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import mozilla.components.support.ktx.TestActivity | ||
import org.junit.Assert.assertFalse | ||
import org.junit.Assert.assertTrue | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class WindowKtTest { | ||
@get:Rule | ||
internal val activityRule: ActivityScenarioRule<TestActivity> = ActivityScenarioRule(TestActivity::class.java) | ||
|
||
@Test | ||
fun whenALightColorIsAppliedToStatusBarThenSetIsAppearanceLightStatusBarsToTrue() { | ||
activityRule.scenario.onActivity { | ||
it.window.setStatusBarTheme(Color.WHITE) | ||
|
||
assertTrue(it.window.getWindowInsetsController().isAppearanceLightStatusBars) | ||
} | ||
} | ||
|
||
@Test | ||
fun whenADarkColorIsAppliedToStatusBarThenSetIsAppearanceLightStatusBarsToFalse() { | ||
activityRule.scenario.onActivity { | ||
it.window.setStatusBarTheme(Color.BLACK) | ||
|
||
assertFalse(it.window.getWindowInsetsController().isAppearanceLightStatusBars) | ||
} | ||
} | ||
|
||
@Test | ||
fun whenALightColorIsAppliedToNavigationBarThemeThenSetIsAppearanceLightNavigationBarsToTrue() { | ||
activityRule.scenario.onActivity { | ||
it.window.setNavigationBarTheme(Color.WHITE) | ||
|
||
assertTrue(it.window.getWindowInsetsController().isAppearanceLightNavigationBars) | ||
} | ||
} | ||
|
||
@Test | ||
fun whenADarkColorIsAppliedToNavigationBarThemeThenSetIsAppearanceLightNavigationBarsToFalse() { | ||
activityRule.scenario.onActivity { | ||
it.window.setNavigationBarTheme(Color.BLACK) | ||
|
||
assertFalse(it.window.getWindowInsetsController().isAppearanceLightNavigationBars) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters