1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix 64-bit integers being truncated to 32-bit in JNI

This commit is contained in:
Serhii Snitsaruk
2025-10-30 11:32:17 +01:00
parent 07f4c06601
commit b0cb297cde
3 changed files with 17 additions and 5 deletions

View File

@@ -16,6 +16,8 @@ func run_tests():
__exec_test(test_variant_conversion_safe_from_stack_overflow)
__exec_test(test_big_integers)
print("JavaClassWrapper tests finished.")
print("Tests started: " + str(_test_started))
print("Tests completed: " + str(_test_completed))
@@ -134,3 +136,9 @@ func test_variant_conversion_safe_from_stack_overflow():
arr.append(dict)
# The following line will crash with stack overflow if not handled property:
TestClass.testDictionary(dict)
func test_big_integers():
var TestClass: JavaClass = JavaClassWrapper.wrap('com.godot.game.test.javaclasswrapper.TestClass')
assert_equal(TestClass.testArgLong(4242424242), "4242424242")
assert_equal(TestClass.testArgLong(-4242424242), "-4242424242")
assert_equal(TestClass.testDictionary({a = 4242424242, b = -4242424242}), "{a=4242424242, b=-4242424242}")

View File

@@ -103,6 +103,11 @@ class TestClass {
return i
}
@JvmStatic
fun testArgLong(a: Long): String {
return "${a}"
}
@JvmStatic
fun testArgBoolArray(a: BooleanArray): String {
return a.contentToString();