mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-10 17:03:50 +01:00
Fix test compilation
This commit is contained in:
parent
57e9e4474e
commit
7910e84d8e
@ -42,7 +42,6 @@ import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.session.space.SpaceService
|
||||
import org.matrix.android.sdk.common.CommonTestHelper
|
||||
import org.matrix.android.sdk.common.SessionTestParams
|
||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
@ -84,12 +83,12 @@ class SpaceCreationTest : InstrumentedTest {
|
||||
}
|
||||
assertEquals(100, powerLevelsContent?.eventsDefault, "Space-rooms should be created with a power level for events_default of 100")
|
||||
|
||||
val guestAccess = syncedSpace.asRoom().getStateEvent(EventType.STATE_ROOM_GUEST_ACCESS)?.content
|
||||
val guestAccess = syncedSpace.asRoom().getStateEvent(EventType.STATE_ROOM_GUEST_ACCESS)?.content
|
||||
?.toModel<RoomGuestAccessContent>()?.guestAccess
|
||||
|
||||
assertEquals(GuestAccess.CanJoin, guestAccess, "Public space room should be peekable by guest")
|
||||
|
||||
val historyVisibility = syncedSpace.asRoom().getStateEvent(EventType.STATE_ROOM_HISTORY_VISIBILITY)?.content
|
||||
val historyVisibility = syncedSpace.asRoom().getStateEvent(EventType.STATE_ROOM_HISTORY_VISIBILITY)?.content
|
||||
?.toModel<RoomHistoryVisibilityContent>()?.historyVisibility
|
||||
|
||||
assertEquals(RoomHistoryVisibility.WORLD_READABLE, historyVisibility, "Public space room should be world readable")
|
||||
@ -141,13 +140,11 @@ class SpaceCreationTest : InstrumentedTest {
|
||||
|
||||
// create a room
|
||||
val firstChild: String = runBlocking {
|
||||
awaitCallback<String> {
|
||||
aliceSession.createRoom(CreateRoomParams().apply {
|
||||
this.name = "FirstRoom"
|
||||
this.topic = "Description of first room"
|
||||
this.preset = CreateRoomPreset.PRESET_PUBLIC_CHAT
|
||||
}, it)
|
||||
}
|
||||
aliceSession.createRoom(CreateRoomParams().apply {
|
||||
this.name = "FirstRoom"
|
||||
this.topic = "Description of first room"
|
||||
this.preset = CreateRoomPreset.PRESET_PUBLIC_CHAT
|
||||
})
|
||||
}
|
||||
|
||||
runBlocking {
|
||||
@ -155,13 +152,11 @@ class SpaceCreationTest : InstrumentedTest {
|
||||
}
|
||||
|
||||
val secondChild: String = runBlocking {
|
||||
awaitCallback {
|
||||
aliceSession.createRoom(CreateRoomParams().apply {
|
||||
this.name = "SecondRoom"
|
||||
this.topic = "Description of second room"
|
||||
this.preset = CreateRoomPreset.PRESET_PUBLIC_CHAT
|
||||
}, it)
|
||||
}
|
||||
aliceSession.createRoom(CreateRoomParams().apply {
|
||||
this.name = "SecondRoom"
|
||||
this.topic = "Description of second room"
|
||||
this.preset = CreateRoomPreset.PRESET_PUBLIC_CHAT
|
||||
})
|
||||
}
|
||||
|
||||
runBlocking {
|
||||
|
@ -60,8 +60,8 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||
|
||||
val syncedSpace = session.spaceService().getSpace(spaceId)
|
||||
|
||||
val roomId = commonTestHelper.doSync<String> {
|
||||
session.createRoom(CreateRoomParams().apply { name = "General" }, it)
|
||||
val roomId = runBlocking {
|
||||
session.createRoom(CreateRoomParams().apply { name = "General" })
|
||||
}
|
||||
|
||||
val viaServers = listOf(session.sessionParams.homeServerHost ?: "")
|
||||
@ -108,8 +108,8 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||
val children = listOf("General" to true /*canonical*/, "Random" to false)
|
||||
|
||||
val roomIdList = children.map {
|
||||
commonTestHelper.doSync<String> { cb ->
|
||||
session.createRoom(CreateRoomParams().apply { name = it.first }, cb)
|
||||
runBlocking {
|
||||
session.createRoom(CreateRoomParams().apply { name = it.first })
|
||||
} to it.second
|
||||
}
|
||||
|
||||
@ -169,11 +169,11 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||
|
||||
// Create orphan rooms
|
||||
|
||||
val orphan1 = commonTestHelper.doSync<String> { cb ->
|
||||
session.createRoom(CreateRoomParams().apply { name = "O1" }, cb)
|
||||
val orphan1 = runBlocking {
|
||||
session.createRoom(CreateRoomParams().apply { name = "O1" })
|
||||
}
|
||||
val orphan2 = commonTestHelper.doSync<String> { cb ->
|
||||
session.createRoom(CreateRoomParams().apply { name = "O2" }, cb)
|
||||
val orphan2 = runBlocking {
|
||||
session.createRoom(CreateRoomParams().apply { name = "O2" })
|
||||
}
|
||||
|
||||
val allRooms = session.getRoomSummaries(roomSummaryQueryParams { excludeType = listOf(RoomType.SPACE) })
|
||||
@ -195,8 +195,8 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||
assertTrue(aChildren.indexOfFirst { it.name == "C2" } != -1, "A1 should be a grand child of A")
|
||||
|
||||
// Add a non canonical child and check that it does not appear as orphan
|
||||
val a3 = commonTestHelper.doSync<String> { cb ->
|
||||
session.createRoom(CreateRoomParams().apply { name = "A3" }, cb)
|
||||
val a3 = runBlocking {
|
||||
session.createRoom(CreateRoomParams().apply { name = "A3" })
|
||||
}
|
||||
runBlocking {
|
||||
spaceA!!.addChildren(a3, viaServers, null, false)
|
||||
@ -354,8 +354,8 @@ class SpaceHierarchyTest : InstrumentedTest {
|
||||
|
||||
val roomIds =
|
||||
childInfo.map { entry ->
|
||||
commonTestHelper.doSync<String> { cb ->
|
||||
session.createRoom(CreateRoomParams().apply { name = entry.first }, cb)
|
||||
runBlocking {
|
||||
session.createRoom(CreateRoomParams().apply { name = entry.first })
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user