Add regression test for month header

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-02-28 14:52:24 +05:30
parent 799dd5adbe
commit f15f609832
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,39 @@
package dev.msfjarvis.lobsters.ui.posts
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.asAndroidBitmap
import androidx.compose.ui.test.captureToImage
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onRoot
import com.karumi.shot.ScreenshotTest
import dev.msfjarvis.lobsters.ui.DarkTestTheme
import java.time.Month
import org.junit.Rule
import org.junit.Test
class HeaderTest : ScreenshotTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun headerDoesNotHaveATransparentBackground() {
composeTestRule.setContent {
DarkTestTheme {
Box(
modifier = Modifier
.background(color = Color(0xffffff))
.fillMaxWidth()
.fillMaxHeight(),
) {
MonthHeader(month = Month.AUGUST)
}
}
}
compareScreenshot(composeTestRule.onRoot().captureToImage().asAndroidBitmap())
}
}