-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix flaky network image tests and refactor test packages
- Loading branch information
Showing
9 changed files
with
44 additions
and
27 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...esting/src/main/java/io/github/droidkaigi/confsched/testing/DroidKaigiKmpPreviewTester.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
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
24 changes: 24 additions & 0 deletions
24
core/testing/src/main/java/io/github/droidkaigi/confsched/testing/rules/CoilRule.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,24 @@ | ||
package io.github.droidkaigi.confsched.testing.rules | ||
|
||
import android.graphics.drawable.ColorDrawable | ||
import androidx.test.core.app.ApplicationProvider | ||
import coil3.ImageLoader | ||
import coil3.SingletonImageLoader | ||
import coil3.test.FakeImageLoaderEngine | ||
import coil3.test.default | ||
import org.junit.rules.TestWatcher | ||
import org.junit.runner.Description | ||
|
||
class CoilRule : TestWatcher() { | ||
override fun starting(description: Description?) { | ||
super.starting(description) | ||
val engine = FakeImageLoaderEngine.Builder() | ||
.default(ColorDrawable(android.graphics.Color.BLUE)) | ||
.build() | ||
val imageLoader = | ||
ImageLoader.Builder(ApplicationProvider.getApplicationContext()) | ||
.components { add(engine) } | ||
.build() | ||
SingletonImageLoader.setUnsafe(imageLoader) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...i/confsched/testing/CoroutinesTestRule.kt → ...sched/testing/rules/CoroutinesTestRule.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
2 changes: 1 addition & 1 deletion
2
...ched/testing/HiltAndroidAutoInjectRule.kt → ...esting/rules/HiltAndroidAutoInjectRule.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
2 changes: 1 addition & 1 deletion
2
...kaigi/confsched/testing/HiltInjectRule.kt → ...confsched/testing/rules/HiltInjectRule.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
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
2 changes: 1 addition & 1 deletion
2
...igi/confsched/testing/TimeZoneTestRule.kt → ...nfsched/testing/rules/TimeZoneTestRule.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
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