mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03:55 +01:00
Corrected DepictedItem constructor arguments
This commit is contained in:
parent
936e50d327
commit
02655f7d18
3 changed files with 10 additions and 8 deletions
|
|
@ -29,7 +29,7 @@ const val THUMB_IMAGE_SIZE = "70px"
|
||||||
data class DepictedItem constructor(
|
data class DepictedItem constructor(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
val description: String?,
|
val description: String?,
|
||||||
val primaryImage: String?,
|
val imageUrl: String?,
|
||||||
val instanceOfs: List<String>,
|
val instanceOfs: List<String>,
|
||||||
val commonsCategories: List<CategoryItem>,
|
val commonsCategories: List<CategoryItem>,
|
||||||
var isSelected: Boolean,
|
var isSelected: Boolean,
|
||||||
|
|
@ -51,7 +51,9 @@ data class DepictedItem constructor(
|
||||||
constructor(entity: Entities.Entity, name: String, description: String) : this(
|
constructor(entity: Entities.Entity, name: String, description: String) : this(
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
entity[IMAGE].primaryImageValue?.value,
|
entity[IMAGE].primaryImageValue?.let {
|
||||||
|
getImageUrl(it.value, THUMB_IMAGE_SIZE)
|
||||||
|
},
|
||||||
entity[INSTANCE_OF].toIds(),
|
entity[INSTANCE_OF].toIds(),
|
||||||
entity[COMMONS_CATEGORY]?.map {
|
entity[COMMONS_CATEGORY]?.map {
|
||||||
CategoryItem(
|
CategoryItem(
|
||||||
|
|
@ -66,8 +68,8 @@ data class DepictedItem constructor(
|
||||||
entity.id(),
|
entity.id(),
|
||||||
)
|
)
|
||||||
|
|
||||||
val imageUrl: String?
|
val primaryImage: String?
|
||||||
get() = primaryImage?.let { getImageUrl(it, THUMB_IMAGE_SIZE) }
|
get() = imageUrl?.split('-')?.lastOrNull()
|
||||||
|
|
||||||
override fun equals(other: Any?) =
|
override fun equals(other: Any?) =
|
||||||
when {
|
when {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import java.util.Date
|
||||||
fun depictedItem(
|
fun depictedItem(
|
||||||
name: String = "label",
|
name: String = "label",
|
||||||
description: String = "desc",
|
description: String = "desc",
|
||||||
primaryImage: String = "",
|
imageUrl: String = "",
|
||||||
instanceOfs: List<String> = listOf(),
|
instanceOfs: List<String> = listOf(),
|
||||||
commonsCategories: List<CategoryItem> = listOf(),
|
commonsCategories: List<CategoryItem> = listOf(),
|
||||||
isSelected: Boolean = false,
|
isSelected: Boolean = false,
|
||||||
|
|
@ -26,7 +26,7 @@ fun depictedItem(
|
||||||
) = DepictedItem(
|
) = DepictedItem(
|
||||||
name = name,
|
name = name,
|
||||||
description = description,
|
description = description,
|
||||||
primaryImage = primaryImage,
|
imageUrl = imageUrl,
|
||||||
instanceOfs = instanceOfs,
|
instanceOfs = instanceOfs,
|
||||||
commonsCategories = commonsCategories,
|
commonsCategories = commonsCategories,
|
||||||
isSelected = isSelected,
|
isSelected = isSelected,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ class CategoriesModelTest {
|
||||||
)
|
)
|
||||||
val depictedItemWithoutCategories =
|
val depictedItemWithoutCategories =
|
||||||
depictedItem(
|
depictedItem(
|
||||||
primaryImage = "P18"
|
imageUrl = "testUrl"
|
||||||
)
|
)
|
||||||
|
|
||||||
whenever(gpsCategoryModel.categoriesFromLocation)
|
whenever(gpsCategoryModel.categoriesFromLocation)
|
||||||
|
|
@ -167,7 +167,7 @@ class CategoriesModelTest {
|
||||||
)
|
)
|
||||||
whenever(
|
whenever(
|
||||||
categoryClient.getCategoriesOfImage(
|
categoryClient.getCategoriesOfImage(
|
||||||
"P18",
|
"testUrl",
|
||||||
25,
|
25,
|
||||||
),
|
),
|
||||||
).thenReturn(
|
).thenReturn(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue