Fix locale-dependent code in GameTest ()

Co-authored-by: modmuss <modmuss50@gmail.com>
This commit is contained in:
apple502j 2025-02-21 02:55:24 +09:00 committed by GitHub
parent fd5bf1a075
commit cb3258dead
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions
fabric-client-gametest-api-v1/src/client/java/net/fabricmc/fabric/impl/client/gametest/context
fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric/impl/gametest

View file

@ -20,6 +20,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
@ -427,7 +428,7 @@ public final class ClientGameTestContextImpl implements ClientGameTestContext {
throw new AssertionError("Failed to create screenshots directory", e);
}
String counterPrefix = options.counterPrefix ? "%04d_".formatted(screenshotCounter++) : "";
String counterPrefix = options.counterPrefix ? String.format(Locale.ROOT, "%04d_", screenshotCounter++) : "";
Path screenshotFile = destinationDir.resolve(counterPrefix + fileName + ".png");
try {

View file

@ -20,6 +20,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.function.Consumer;
import org.slf4j.Logger;
@ -150,7 +151,7 @@ final class TestAnnotationLocator {
}
private static String camelToSnake(String input) {
return input.replaceAll("([a-z])([A-Z])", "$1_$2").toLowerCase();
return input.replaceAll("([a-z])([A-Z])", "$1_$2").toLowerCase(Locale.ROOT);
}
}
}