Fix test compilation issue (no detected since Olm was not available)

This commit is contained in:
Benoit Marty 2020-09-24 12:46:14 +02:00
parent 2e95c78f4e
commit 31029e90cc
2 changed files with 25 additions and 21 deletions

View File

@ -18,6 +18,7 @@ package im.vector.app.features.home.room.detail.timeline.helper
import androidx.annotation.ColorInt
import androidx.annotation.ColorRes
import androidx.annotation.VisibleForTesting
import im.vector.app.R
import im.vector.app.core.resources.ColorProvider
import org.matrix.android.sdk.api.util.MatrixItem
@ -43,8 +44,10 @@ class MatrixItemColorProvider @Inject constructor(
}
}
companion object {
@ColorRes
private fun getColorFromUserId(userId: String?): Int {
@VisibleForTesting
fun getColorFromUserId(userId: String?): Int {
var hash = 0
userId?.toList()?.map { chr -> hash = (hash shl 5) - hash + chr.toInt() }
@ -69,4 +72,5 @@ class MatrixItemColorProvider @Inject constructor(
else -> R.color.riotx_avatar_fill_1
}
}
}
}

View File

@ -17,7 +17,7 @@
package im.vector.app.features.home
import im.vector.app.R
import im.vector.app.core.utils.getColorFromUserId
import im.vector.app.features.home.room.detail.timeline.helper.MatrixItemColorProvider.Companion.getColorFromUserId
import org.junit.Assert.assertEquals
import org.junit.Test