diff options
author | Christian Strømme <christian.stromme@theqtcompany.com> | 2015-03-03 13:48:14 +0100 |
---|---|---|
committer | Christian Stromme <christian.stromme@theqtcompany.com> | 2015-09-18 12:40:01 +0000 |
commit | 44e67c8c7ee0c82156a43d5088dc97c9b0f47ffc (patch) | |
tree | 5a09d365aefe7d65d860f70614f85fc4b8f3f7be /tests | |
parent | 5f638401d50c7f5f5118955b3ac75873907bf74f (diff) |
Add fromLocalRef() to QAndroidJniObject
This makes it more convenient to transfer the ownership of the local
JNI reference to QAndroidJniObject. Before this change user would need
to manually delete the local ref. after creating a QAndroidJniObject.
Change-Id: Iebae7829773d1b783dc0982de92c51b4c6b0abd1
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp b/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp index c46a03a..73674f8 100644 --- a/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp +++ b/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp @@ -105,6 +105,7 @@ private slots: void getIntField(); void templateApiCheck(); void isClassAvailable(); + void fromLocalRef(); void cleanupTestCase(); }; @@ -1046,6 +1047,14 @@ void tst_QAndroidJniObject::isClassAvailable() QVERIFY(QAndroidJniObject::isClassAvailable("org/qtproject/qt5/android/QtActivityDelegate")); } +void tst_QAndroidJniObject::fromLocalRef() +{ + const int limit = 512 + 1; + QAndroidJniEnvironment env; + for (int i = 0; i != limit; ++i) + QAndroidJniObject o = QAndroidJniObject::fromLocalRef(env->FindClass("java/lang/String")); +} + QTEST_APPLESS_MAIN(tst_QAndroidJniObject) #include "tst_qandroidjniobject.moc" |