Skip to content

Commit

Permalink
ANDROID-13796 add dark mode tests for classic views
Browse files Browse the repository at this point in the history
  • Loading branch information
jeprubio committed Oct 13, 2023
1 parent 601dca0 commit c24fc2a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added library/screenshots/check_TextInput_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config

@RunWith(RobolectricTestRunner::class)
internal class TextInputTest: ScreenshotsTest() {
Expand All @@ -22,20 +23,42 @@ internal class TextInputTest: ScreenshotsTest() {
checkTextInput()
}

@Config(qualifiers = "+night")
@Test
fun `check TextInput dark`() {
checkTextInput()
}

@Test
fun `check TextInputWithError`() {
checkTextInput {
error = "Whatever error"
}
}

@Config(qualifiers = "+night")
@Test
fun `check TextInputWithError dark`() {
checkTextInput {
error = "Whatever error"
}
}

@Test
fun `check TextInputDisabled`() {
checkTextInput {
isEnabled = false
}
}

@Config(qualifiers = "+night")
@Test
fun `check TextInputDisabled dark`() {
checkTextInput {
isEnabled = false
}
}

private fun checkTextInput(onTextInput: TextInput.() -> Unit = {}) {
rule.scenario.onActivity { activity ->
val wrapper: FrameLayout = activity.findViewById(R.id.dummy_activity_wrapper)
Expand Down

0 comments on commit c24fc2a

Please sign in to comment.