diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-01-04 21:21:43 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-01-04 21:21:43 +0200 |
commit | 4e158f6bfa7d0747d8da70b3b15a44b52e35bb8a (patch) | |
tree | 84e20982138de5c9b6d319bf83ac79bd672f918f /tests/auto/other/android | |
parent | e4391422574aa9aa89fece74f16c07c609cbbae2 (diff) | |
parent | a13fd415d689be046c13cc562cbbbb5df0e6506a (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.13' into tqtc/lts-5.15-opensourcev5.15.13-lts-lgpl
Change-Id: Ie9df84af22570d601db002e391a1a0d97e7cd9e1
Diffstat (limited to 'tests/auto/other/android')
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt b/tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt new file mode 100644 index 0000000000..87b10bd8e6 --- /dev/null +++ b/tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt @@ -0,0 +1 @@ +FooBar diff --git a/tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt b/tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt new file mode 100644 index 0000000000..87b10bd8e6 --- /dev/null +++ b/tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt @@ -0,0 +1 @@ +FooBar diff --git a/tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt b/tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt new file mode 100644 index 0000000000..87b10bd8e6 --- /dev/null +++ b/tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt @@ -0,0 +1 @@ +FooBar diff --git a/tests/auto/other/android/tst_android.cpp b/tests/auto/other/android/tst_android.cpp index 57d592d45f..389d465427 100644 --- a/tests/auto/other/android/tst_android.cpp +++ b/tests/auto/other/android/tst_android.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QtTest/QtTest> +#include <QtCore/qdiriterator.h> class tst_Android : public QObject { @@ -34,6 +35,7 @@ Q_OBJECT private slots: void assetsRead(); void assetsNotWritable(); + void assetsIterating(); }; void tst_Android::assetsRead() @@ -59,6 +61,25 @@ void tst_Android::assetsNotWritable() QVERIFY(!file.open(QIODevice::Append)); } +void tst_Android::assetsIterating() +{ + QStringList assets = {"assets:/top_level_dir/file_in_top_dir.txt", + "assets:/top_level_dir/sub_dir", + "assets:/top_level_dir/sub_dir/file_in_sub_dir.txt", + "assets:/top_level_dir/sub_dir/sub_dir_2", + "assets:/top_level_dir/sub_dir/sub_dir_2/sub_dir_3", + "assets:/top_level_dir/sub_dir/sub_dir_2/sub_dir_3/file_in_sub_dir_3.txt"}; + // Note that we have an "assets:/top_level_dir/sub_dir/empty_sub_dir" in the test's + // assets physical directory, but empty folders are not packaged in the built apk, + // so it's expected to not have such folder be listed in the assets on runtime + QDirIterator it("assets:/top_level_dir", QDirIterator::Subdirectories); + QStringList iteratorAssets; + while (it.hasNext()) + iteratorAssets.append(it.next()); + QVERIFY(assets == iteratorAssets); +} + + QTEST_MAIN(tst_Android) #include "tst_android.moc" |