1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Android: Fix memory issues in _variant_to_jvalue()

This commit is contained in:
David Snopek
2025-11-25 13:32:07 -06:00
parent 9dd6c4dbac
commit c2f8d1a29b
7 changed files with 70 additions and 77 deletions

View File

@@ -42,3 +42,10 @@ func assert_equal(actual, expected):
else:
__assert_fail()
print (" |-> Expected '%s' but got '%s'" % [expected, actual])
func assert_true(value):
if value:
__assert_pass()
else:
__assert_fail()
print (" |-> Expected '%s' to be truthy" % value)

View File

@@ -18,6 +18,8 @@ func run_tests():
__exec_test(test_big_integers)
__exec_test(test_callable)
print("JavaClassWrapper tests finished.")
print("Tests started: " + str(_test_started))
print("Tests completed: " + str(_test_completed))
@@ -142,3 +144,14 @@ func test_big_integers():
assert_equal(TestClass.testArgLong(4242424242), "4242424242")
assert_equal(TestClass.testArgLong(-4242424242), "-4242424242")
assert_equal(TestClass.testDictionary({a = 4242424242, b = -4242424242}), "{a=4242424242, b=-4242424242}")
func test_callable():
var android_runtime = Engine.get_singleton("AndroidRuntime")
assert_true(android_runtime != null)
var cb1_data := {called = false}
var cb1 = func():
cb1_data['called'] = true
return null
android_runtime.createRunnableFromGodotCallable(cb1).run()
assert_equal(cb1_data['called'], true)