talk-android/app/src/test/java/com/nextcloud/talk/utils/AttendeePermissionsUtilTest.kt
Marcel Hibbe d9d6af2b99
add util for permissions
util uses bitwise operations to access every single permission via variable

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
2022-05-11 16:44:05 +02:00

27 lines
1.0 KiB
Kotlin

package com.nextcloud.talk.utils
import junit.framework.TestCase
import org.junit.Test
class AttendeePermissionsUtilTest : TestCase() {
@Test
fun test_areFlagsSet() {
val attendeePermissionsUtil = AttendeePermissionsUtil(
AttendeePermissionsUtil.PUBLISH_SCREEN
or AttendeePermissionsUtil.JOIN_CALL
or AttendeePermissionsUtil.DEFAULT)
assert(attendeePermissionsUtil.canPublishScreen)
assert(attendeePermissionsUtil.canJoinCall)
assert(attendeePermissionsUtil.isDefault) // if AttendeePermissionsUtil.DEFAULT is not set with setFlags and
// checked with assertFalse, the logic fails somehow?!
assertFalse(attendeePermissionsUtil.isCustom)
assertFalse(attendeePermissionsUtil.canStartCall)
assertFalse(attendeePermissionsUtil.canIgnoreLobby)
assertFalse(attendeePermissionsUtil.canPublishAudio)
assertFalse(attendeePermissionsUtil.canPublishVideo)
assertFalse(attendeePermissionsUtil.canPostChatShareItemsDoReaction)
}
}