mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-21 07:18:05 -04:00
Change repo attribute icons to be localized
This affects anti-features and categories. Reflection diffing has been made more robust in the process with the earlier FileV2 hack removed and better error messages.
This commit is contained in:
committed by
Hans-Christoph Steiner
parent
3eca9402fe
commit
e86063937a
@@ -11,7 +11,7 @@ import org.fdroid.index.v2.ReleaseChannelV2
|
||||
import org.fdroid.index.v2.RepoV2
|
||||
import org.fdroid.test.DiffUtils.applyDiff
|
||||
import org.fdroid.test.DiffUtils.randomDiff
|
||||
import org.fdroid.test.TestRepoUtils.getRandomFileV2
|
||||
import org.fdroid.test.TestRepoUtils.getRandomLocalizedFileV2
|
||||
import org.fdroid.test.TestRepoUtils.getRandomLocalizedTextV2
|
||||
import org.fdroid.test.TestRepoUtils.getRandomMirror
|
||||
import org.fdroid.test.TestRepoUtils.getRandomRepo
|
||||
@@ -116,13 +116,17 @@ internal class RepositoryDiffTest : DbTest() {
|
||||
fun antiFeaturesDiff() {
|
||||
val repo = getRandomRepo().copy(antiFeatures = getRandomMap {
|
||||
getRandomString() to AntiFeatureV2(
|
||||
icon = getRandomFileV2(),
|
||||
icon = getRandomLocalizedFileV2(),
|
||||
name = getRandomLocalizedTextV2(),
|
||||
description = getRandomLocalizedTextV2(),
|
||||
)
|
||||
})
|
||||
val antiFeatures = repo.antiFeatures.randomDiff {
|
||||
AntiFeatureV2(getRandomFileV2(), getRandomLocalizedTextV2(), getRandomLocalizedTextV2())
|
||||
AntiFeatureV2(
|
||||
icon = getRandomLocalizedFileV2(),
|
||||
name = getRandomLocalizedTextV2(),
|
||||
description = getRandomLocalizedTextV2(),
|
||||
)
|
||||
}
|
||||
val json = """
|
||||
{
|
||||
@@ -141,7 +145,7 @@ internal class RepositoryDiffTest : DbTest() {
|
||||
fun antiFeatureKeyChangeDiff() {
|
||||
val antiFeatureKey = getRandomString()
|
||||
val antiFeature = AntiFeatureV2(
|
||||
icon = getRandomFileV2(),
|
||||
icon = getRandomLocalizedFileV2(),
|
||||
name = getRandomLocalizedTextV2(),
|
||||
description = getRandomLocalizedTextV2(),
|
||||
)
|
||||
@@ -150,7 +154,7 @@ internal class RepositoryDiffTest : DbTest() {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val newAntiFeatures = mapOf(antiFeatureKey to antiFeature.copy(
|
||||
icon = null,
|
||||
icon = emptyMap(),
|
||||
name = getRandomLocalizedTextV2(),
|
||||
description = getRandomLocalizedTextV2(),
|
||||
))
|
||||
@@ -173,13 +177,17 @@ internal class RepositoryDiffTest : DbTest() {
|
||||
fun categoriesDiff() {
|
||||
val repo = getRandomRepo().copy(categories = getRandomMap {
|
||||
getRandomString() to CategoryV2(
|
||||
icon = getRandomFileV2(),
|
||||
icon = getRandomLocalizedFileV2(),
|
||||
name = getRandomLocalizedTextV2(),
|
||||
description = getRandomLocalizedTextV2(),
|
||||
)
|
||||
})
|
||||
val categories = repo.categories.randomDiff {
|
||||
CategoryV2(getRandomFileV2(), getRandomLocalizedTextV2(), getRandomLocalizedTextV2())
|
||||
CategoryV2(
|
||||
icon = getRandomLocalizedFileV2(),
|
||||
name = getRandomLocalizedTextV2(),
|
||||
description = getRandomLocalizedTextV2(),
|
||||
)
|
||||
}
|
||||
val json = """
|
||||
{
|
||||
|
||||
@@ -31,8 +31,8 @@ internal object TestUtils {
|
||||
val expectedAntiFeatures = repoV2.antiFeatures.toRepoAntiFeatures(repoId).toSet()
|
||||
assertEquals(expectedAntiFeatures, repo.antiFeatures.toSet())
|
||||
// categories
|
||||
val expectedCategories = repoV2.categories.toRepoCategories(repoId).toSet()
|
||||
assertEquals(expectedCategories, repo.categories.toSet())
|
||||
val expectedCategories = repoV2.categories.toRepoCategories(repoId).sortedBy { it.id }
|
||||
assertEquals(expectedCategories, repo.categories.sortedBy { it.id })
|
||||
// release channels
|
||||
val expectedReleaseChannels = repoV2.releaseChannels.toRepoReleaseChannel(repoId).toSet()
|
||||
assertEquals(expectedReleaseChannels, repo.releaseChannels.toSet())
|
||||
|
||||
Reference in New Issue
Block a user