mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
COntentResolverHelper: sort column must be an array
Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
8860bd4b52
commit
be830a66c8
2 changed files with 6 additions and 2 deletions
|
@ -28,6 +28,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
|||
import androidx.test.filters.SdkSuppress
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import org.junit.Assert.assertArrayEquals
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
@ -60,7 +61,10 @@ class ContentResolverHelperTest {
|
|||
withArg { bundle ->
|
||||
assertEquals(bundle.getString(ContentResolver.QUERY_ARG_SQL_SELECTION), SELECTION)
|
||||
assertEquals(bundle.getInt(ContentResolver.QUERY_ARG_LIMIT), LIMIT)
|
||||
assertEquals(bundle.getString(ContentResolver.QUERY_ARG_SORT_COLUMNS), SORT_COLUMN)
|
||||
assertArrayEquals(
|
||||
bundle.getStringArray(ContentResolver.QUERY_ARG_SORT_COLUMNS),
|
||||
arrayOf(SORT_COLUMN)
|
||||
)
|
||||
assertEquals(bundle.getInt(ContentResolver.QUERY_ARG_SORT_DIRECTION), SORT_DIRECTION_INT)
|
||||
},
|
||||
null
|
||||
|
|
|
@ -98,7 +98,7 @@ object ContentResolverHelper {
|
|||
putString(ContentResolver.QUERY_ARG_SQL_SELECTION, selection)
|
||||
}
|
||||
if (sortColumn != null) {
|
||||
putString(ContentResolver.QUERY_ARG_SORT_COLUMNS, sortColumn)
|
||||
putStringArray(ContentResolver.QUERY_ARG_SORT_COLUMNS, arrayOf(sortColumn))
|
||||
val direction = when (sortDirection) {
|
||||
SORT_DIRECTION_ASCENDING -> ContentResolver.QUERY_SORT_DIRECTION_ASCENDING
|
||||
else -> ContentResolver.QUERY_SORT_DIRECTION_DESCENDING
|
||||
|
|
Loading…
Reference in a new issue