-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into colin/fakes
* main: Update the baseline files. (#1625) Always invoke mkdir when creating DiskCache. (#1626) Update dependency gradle to v8.0.1 (#1623) Fix DiskCache maxSize calculation (#1619) (#1620) Update plugin binaryCompatibility to v0.13.0 (#1621) Update dependency gradle to v8 (#1618) Update dependency androidx.profileinstaller:profileinstaller to v1.3.0-beta01 (#1613) Update Kotlin to 1.8.10. (#1614) Update dependency androidx.exifinterface:exifinterface to v1.3.6 (#1612) Update dependency androidx.appcompat:appcompat-resources to v1.6.1 (#1611) Migrate to collectStableBaselineProfile. (#1607) Update dependency com.android.tools.build:gradle to v7.4.1 (#1608) Fix file:// URI parsing (#1601) Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.24.0 (#1603) Update dependency com.google.android.material:material to v1.8.0 (#1600) Update Kotlin to 1.8. (#1597) Update dependency com.vanniktech:gradle-maven-publish-plugin to v0.23.2 (#1596) Update dependency com.android.tools.build:gradle to v7.4.0 (#1594)
- Loading branch information
Showing
12 changed files
with
958 additions
and
31 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
coil-base/src/androidTest/java/coil/disk/DiskCacheAndroidTest.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,41 @@ | ||
package coil.disk | ||
|
||
import android.content.Context | ||
import androidx.test.core.app.ApplicationProvider | ||
import java.io.File | ||
import kotlin.test.assertEquals | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class DiskCacheAndroidTest { | ||
|
||
private lateinit var context: Context | ||
private lateinit var directory: File | ||
|
||
@Before | ||
fun before() { | ||
context = ApplicationProvider.getApplicationContext() | ||
directory = context.filesDir.resolve("test_dir") | ||
} | ||
|
||
@After | ||
fun after() { | ||
directory.delete() // Ensure we start fresh. | ||
} | ||
|
||
@Test | ||
fun checkMaxSize() { | ||
val minimumMaxSizeBytes = 100L | ||
val maximumMaxSizeBytes = 200L | ||
val maxSizePercent = 0.5 | ||
|
||
val diskCache = DiskCache.Builder().directory(directory) | ||
.maxSizePercent(maxSizePercent) | ||
.minimumMaxSizeBytes(minimumMaxSizeBytes) | ||
.maximumMaxSizeBytes(maximumMaxSizeBytes) | ||
.build() | ||
|
||
assertEquals(maximumMaxSizeBytes, diskCache.maxSize) | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Oops, something went wrong.