diff options
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/auto/other/android/tst_android.cpp | 24 |
2 files changed, 21 insertions, 6 deletions
diff --git a/tests/auto/other/CMakeLists.txt b/tests/auto/other/CMakeLists.txt index 6142d086b4..f0cdeec0f2 100644 --- a/tests/auto/other/CMakeLists.txt +++ b/tests/auto/other/CMakeLists.txt @@ -44,9 +44,6 @@ endif() if(embedded) add_subdirectory(qdirectpainter) endif() -if(ANDROID) - add_subdirectory(android) -endif() if(QT_FEATURE_xkbcommon AND TARGET Qt::Gui) add_subdirectory(xkbkeyboard) endif() diff --git a/tests/auto/other/android/tst_android.cpp b/tests/auto/other/android/tst_android.cpp index 6a492e9315..3a00d9414b 100644 --- a/tests/auto/other/android/tst_android.cpp +++ b/tests/auto/other/android/tst_android.cpp @@ -26,7 +26,11 @@ ** ****************************************************************************/ +#include <jni.h> + #include <QTest> +#include <QtCore/qnativeinterface.h> +#include <QtCore/qjniobject.h> class tst_Android : public QObject { @@ -34,18 +38,20 @@ Q_OBJECT private slots: void assetsRead(); void assetsNotWritable(); + void testAndroidSdkVersion(); + void testAndroidActivity(); }; void tst_Android::assetsRead() { { - QFile file("assets:/test.txt"); + QFile file(QStringLiteral("assets:/test.txt")); QVERIFY(file.open(QIODevice::ReadOnly)); QCOMPARE(file.readAll(), QByteArray("FooBar")); } { - QFile file("assets:/test.txt"); + QFile file(QStringLiteral("assets:/test.txt")); QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); QCOMPARE(file.readAll(), QByteArray("FooBar")); } @@ -53,12 +59,24 @@ void tst_Android::assetsRead() void tst_Android::assetsNotWritable() { - QFile file("assets:/test.txt"); + QFile file(QStringLiteral("assets:/test.txt")); QVERIFY(!file.open(QIODevice::WriteOnly)); QVERIFY(!file.open(QIODevice::ReadWrite)); QVERIFY(!file.open(QIODevice::Append)); } +void tst_Android::testAndroidSdkVersion() +{ + QVERIFY(QNativeInterface::QAndroidApplication::sdkVersion() > 0); +} + +void tst_Android::testAndroidActivity() +{ + QJniObject activity = QNativeInterface::QAndroidApplication::context(); + QVERIFY(activity.isValid()); + QVERIFY(activity.callMethod<jboolean>("isTaskRoot")); +} + QTEST_MAIN(tst_Android) #include "tst_android.moc" |