Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version: v0.2.2 #81

Merged
merged 10 commits into from Sep 16, 2020
Expand Up @@ -58,8 +58,8 @@ object Libs {

object Compose {
const val snapshot = ""
const val version = "1.0.0-alpha02"
const val version = "1.0.0-alpha03"

const val runtime = "androidx.compose.runtime:runtime:$version"
const val foundation = "androidx.compose.foundation:foundation:${version}"
const val layout = "androidx.compose.foundation:foundation-layout:${version}"
Expand Down
Expand Up @@ -91,7 +91,7 @@ class CoilTest {
// Wait for the Coil request listener to release the latch
latch.await(5, TimeUnit.SECONDS)

runOnIdle {
composeTestRule.runOnIdle {
// And assert that we got a single successful result
assertThat(results).hasSize(1)
assertThat(results[0]).isInstanceOf(SuccessResult::class.java)
Expand All @@ -113,7 +113,7 @@ class CoilTest {
// Wait for the onRequestCompleted to release the latch
latch.await(5, TimeUnit.SECONDS)

onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertIsDisplayed()
.assertWidthIsEqualTo(128.dp)
.assertHeightIsEqualTo(128.dp)
Expand All @@ -135,7 +135,7 @@ class CoilTest {
// Wait for the onRequestCompleted to release the latch
latch.await(5, TimeUnit.SECONDS)

onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertWidthIsEqualTo(128.dp)
.assertHeightIsEqualTo(128.dp)
.assertIsDisplayed()
Expand Down Expand Up @@ -194,7 +194,7 @@ class CoilTest {
}

// Assert that the content is completely Red
onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertWidthIsEqualTo(128.dp)
.assertHeightIsEqualTo(128.dp)
.assertIsDisplayed()
Expand All @@ -208,7 +208,7 @@ class CoilTest {
runBlocking { loadCompleteSignal.receive() }

// Assert that the content is completely Blue
onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertWidthIsEqualTo(128.dp)
.assertHeightIsEqualTo(128.dp)
.assertIsDisplayed()
Expand Down Expand Up @@ -267,7 +267,7 @@ class CoilTest {
// Wait for the onRequestCompleted to release the latch
latch.await(5, TimeUnit.SECONDS)

onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertWidthIsAtLeast(1.dp)
.assertHeightIsAtLeast(1.dp)
.assertIsDisplayed()
Expand All @@ -294,7 +294,7 @@ class CoilTest {
latch.await(5, TimeUnit.SECONDS)

// Assert that the whole layout is drawn cyan
onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertIsDisplayed()
.captureToBitmap()
.assertPixels { Color.Cyan }
Expand All @@ -316,7 +316,7 @@ class CoilTest {
latch.await(5, TimeUnit.SECONDS)

// Assert that the layout is in the tree and has the correct size
onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertIsDisplayed()
.assertWidthIsEqualTo(128.dp)
.assertHeightIsEqualTo(128.dp)
Expand Down Expand Up @@ -347,7 +347,7 @@ class CoilTest {
}

// Assert that the loading component is displayed
onNodeWithText("Loading").assertIsDisplayed()
composeTestRule.onNodeWithText("Loading").assertIsDisplayed()

// Now resume the dispatcher to start the Coil request
dispatcher.resumeDispatcher()
Expand All @@ -357,7 +357,7 @@ class CoilTest {
loadLatch.await(5, TimeUnit.SECONDS)

// And assert that the loading component no longer exists
onNodeWithText("Loading").assertDoesNotExist()
composeTestRule.onNodeWithText("Loading").assertDoesNotExist()
}

@Test
Expand All @@ -381,7 +381,7 @@ class CoilTest {
latch.await(5, TimeUnit.SECONDS)

// Assert that the whole layout is drawn red
onNodeWithTag(CoilTestTags.Image)
composeTestRule.onNodeWithTag(CoilTestTags.Image)
.assertIsDisplayed()
.captureToBitmap()
.assertPixels { Color.Red }
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -21,7 +21,7 @@ android.useAndroidX=true
systemProp.org.gradle.internal.publish.checksums.insecure=true

GROUP=dev.chrisbanes.accompanist
VERSION_NAME=0.2.1
VERSION_NAME=0.2.2

POM_DESCRIPTION=A collection of utilities for Jetpack Compose

Expand Down
Expand Up @@ -95,7 +95,7 @@ private fun Sample() {
data = randomSampleImageUrl(),
loading = {
Stack(Modifier.fillMaxSize()) {
CircularProgressIndicator(Modifier.gravity(Alignment.Center))
CircularProgressIndicator(Modifier.align(Alignment.Center))
}
},
modifier = Modifier.preferredSize(128.dp)
Expand All @@ -121,7 +121,7 @@ private fun Sample() {
data = randomSampleImageUrl(),
loading = {
Stack(Modifier.fillMaxSize()) {
CircularProgressIndicator(Modifier.gravity(Alignment.Center))
CircularProgressIndicator(Modifier.align(Alignment.Center))
}
},
modifier = Modifier.preferredSize(128.dp)
Expand All @@ -132,7 +132,7 @@ private fun Sample() {
data = randomSampleImageUrl(),
loading = {
Stack(Modifier.fillMaxSize()) {
CircularProgressIndicator(Modifier.gravity(Alignment.Center))
CircularProgressIndicator(Modifier.align(Alignment.Center))
}
}
)
Expand Down
Expand Up @@ -82,7 +82,7 @@ private fun Sample() {
Text(
text = "Text",
style = MaterialTheme.typography.subtitle2,
modifier = Modifier.weight(1f).gravity(Alignment.CenterVertically)
modifier = Modifier.weight(1f).align(Alignment.CenterVertically)
)
}
}
Expand Down