Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AppFileInfo(response: CCloud_AppFileInfo) {
val rawFileSize: Int = response.rawFileSize
val persistState: ECloudStoragePersistState = response.persistState
val platformsToSync: Int = response.platformsToSync
val hasPathPrefixIndex: Boolean = response.hasPathPrefixIndex()
val pathPrefixIndex: Int = response.pathPrefixIndex
val machineNameIndex: Int = response.machineNameIndex
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package `in`.dragonbra.javasteam.steam.handlers.steamcloud

import `in`.dragonbra.javasteam.protobufs.steamclient.SteammessagesCloudSteamclient.CCloud_AppFileInfo
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test

class AppFileInfoTest {

@Test
fun hasPathPrefixIndexIsFalseWhenFieldIsMissing() {
val response = CCloud_AppFileInfo.newBuilder()
.setFileName("save.dat")
.build()

val info = AppFileInfo(response)

assertFalse(info.hasPathPrefixIndex)
}

@Test
fun hasPathPrefixIndexIsTrueWhenIndexIsZero() {
val response = CCloud_AppFileInfo.newBuilder()
.setFileName("save.dat")
.setPathPrefixIndex(0)
.build()

val info = AppFileInfo(response)

assertTrue(info.hasPathPrefixIndex)
assertEquals(0, info.pathPrefixIndex)
}
}
Loading