Skip to content

Commit

Permalink
Just pass already
Browse files Browse the repository at this point in the history
  • Loading branch information
saket committed Feb 16, 2024
1 parent f767fb9 commit 27e206d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.gradle.kotlin.dsl.closureOf
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.exclude
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerArgumentsProducer.ArgumentType.Companion.all
import wtf.emulator.EwExtension
import java.time.Duration
import com.android.build.api.dsl.LibraryExtension as AndroidLibraryExtension
Expand Down Expand Up @@ -48,6 +49,10 @@ class AndroidTestConventionPlugin : Plugin<Project> {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
})
}
configurations.configureEach {
// What the hell google https://stackoverflow.com/q/56639529.
exclude(group = "com.google.guava", module = "listenablefuture")
}

emulatorwtf {
devices.set(
Expand Down
8 changes: 6 additions & 2 deletions test-util/build.gradle → test-util/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ plugins {
}

android {
namespace "me.saket.telephoto.testutil"
namespace = "me.saket.telephoto.testutil"
}

dependencies {
implementation(libs.dropshots)
implementation(libs.dropshots) {
// Gradle fails to override this transitive dependency's version
// with the one used by telephoto. Not sure why this is needed.
exclude(group = "androidx.test")
}
implementation(libs.dropboxDiffer)
implementation(libs.compose.ui.test.junit)
implementation(libs.androidx.test.runner) // Needed for Screenshot.capture().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import app.cash.molecule.launchMolecule
import app.cash.turbine.test
import assertk.assertThat
import assertk.assertions.isEqualTo
import assertk.assertions.isInstanceOf
import assertk.assertions.isNotInstanceOf
import assertk.assertions.isNotNull
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestBuilder
Expand All @@ -31,7 +33,6 @@ import com.dropbox.dropshots.Dropshots
import com.google.testing.junit.testparameterinjector.TestParameter
import com.google.testing.junit.testparameterinjector.TestParameterInjector
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestScope
Expand Down Expand Up @@ -70,7 +71,6 @@ import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds

/** Note to self: this should ideally be a junit test, but Glide was unable to decode HTTP responses in a fake environment. */
@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(TestParameterInjector::class)
class GlideImageSourceTest {
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
Expand Down Expand Up @@ -122,7 +122,7 @@ class GlideImageSourceTest {
requestBuilder = { it.diskCacheStrategy(strategyParam.strategy) }
).test {
skipItems(1) // Default item.
assertThat(awaitItem().delegate).isInstanceOf(SubSamplingDelegate::class.java)
assertThat(awaitItem().delegate!!).isInstanceOf(SubSamplingDelegate::class.java)
}
}

Expand Down Expand Up @@ -245,7 +245,7 @@ class GlideImageSourceTest {
model = serverRule.server.url("animated_image.gif").toString()
).test {
skipItems(1) // Default item.
assertThat(awaitItem().delegate).isNotInstanceOf(SubSamplingDelegate::class.java)
assertThat(awaitItem().delegate!!).isNotInstanceOf(SubSamplingDelegate::class.java)
}
}

Expand Down

0 comments on commit 27e206d

Please sign in to comment.