Skip to content

Commit bc54e77

Browse files
authored
Merge pull request #386 from anxinxu/master
fix: Add path prefix presence flag and tests for AppFileInfo
2 parents e296231 + 1b13bde commit bc54e77

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/main/java/in/dragonbra/javasteam/steam/handlers/steamcloud/AppFileInfo.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class AppFileInfo(response: CCloud_AppFileInfo) {
1111
val rawFileSize: Int = response.rawFileSize
1212
val persistState: ECloudStoragePersistState = response.persistState
1313
val platformsToSync: Int = response.platformsToSync
14+
val hasPathPrefixIndex: Boolean = response.hasPathPrefixIndex()
1415
val pathPrefixIndex: Int = response.pathPrefixIndex
1516
val machineNameIndex: Int = response.machineNameIndex
1617
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package in.dragonbra.javasteam.steam.handlers.steamcloud;
2+
3+
import in.dragonbra.javasteam.protobufs.steamclient.SteammessagesCloudSteamclient;
4+
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.Test;
6+
7+
public class AppFileInfoTest {
8+
9+
@Test
10+
public void hasPathPrefixIndexIsFalseWhenFieldIsMissing() {
11+
var response = SteammessagesCloudSteamclient.CCloud_AppFileInfo.newBuilder()
12+
.setFileName("save.dat")
13+
.build();
14+
15+
var info = new AppFileInfo(response);
16+
17+
Assertions.assertFalse(info.getHasPathPrefixIndex());
18+
}
19+
20+
@Test
21+
public void hasPathPrefixIndexIsTrueWhenIndexIsZero() {
22+
var response = SteammessagesCloudSteamclient.CCloud_AppFileInfo.newBuilder()
23+
.setFileName("save.dat")
24+
.setPathPrefixIndex(0)
25+
.build();
26+
27+
var info = new AppFileInfo(response);
28+
29+
Assertions.assertTrue(info.getHasPathPrefixIndex());
30+
Assertions.assertEquals(0, info.getPathPrefixIndex());
31+
}
32+
}

0 commit comments

Comments
 (0)