JNI: Fix QJniObject::callback test case

Don't call the native function directly, call the Java function that
calls the native function.

Change-Id: Icdcf250313a38f6e4bc2b90fb7b0adbfa5a890fb
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit cfcd56a78fae5d4f4c79f9e76d6bcd57f8a3cde2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2024-01-31 09:49:54 +01:00 committed by Qt Cherry-pick Bot
parent bf6b4167bc
commit ed07354be6

View File

@ -1977,7 +1977,7 @@ void tst_QJniObject::callback()
QVERIFY(TestClass::registerNativeMethods({
Q_JNI_NATIVE_METHOD(callbackWithByte)
}));
result = testObject.callMethod<int>("callbackWithByte", jbyte(123));
result = testObject.callMethod<int>("callMeBackWithByte", jbyte(123));
QVERIFY(calledWithByte);
QCOMPARE(calledWithByte.value(), 123);
break;
@ -1985,7 +1985,7 @@ void tst_QJniObject::callback()
QVERIFY(TestClass::registerNativeMethods({
Q_JNI_NATIVE_METHOD(callbackWithBoolean)
}));
result = testObject.callMethod<int>("callbackWithBoolean", true);
result = testObject.callMethod<int>("callMeBackWithBoolean", true);
QVERIFY(calledWithBoolean);
QCOMPARE(calledWithBoolean.value(), true);
break;
@ -1993,7 +1993,7 @@ void tst_QJniObject::callback()
QVERIFY(TestClass::registerNativeMethods({
Q_JNI_NATIVE_METHOD(callbackWithInt)
}));
result = testObject.callMethod<int>("callbackWithInt", 12345);
result = testObject.callMethod<int>("callMeBackWithInt", 12345);
QVERIFY(calledWithInt);
QCOMPARE(calledWithInt.value(), 12345);
break;
@ -2001,7 +2001,7 @@ void tst_QJniObject::callback()
QVERIFY(TestClass::registerNativeMethods({
Q_JNI_NATIVE_METHOD(callbackWithDouble)
}));
result = testObject.callMethod<int>("callbackWithDouble", 1.2345);
result = testObject.callMethod<int>("callMeBackWithDouble", 1.2345);
QVERIFY(calledWithDouble);
QCOMPARE(calledWithDouble.value(), 1.2345);
break;