summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/platform/android/tst_android.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Android: skip tst_android::orientationChange() for Android 9Assam Boudjelthia7 days1-0/+3
| | | | | | | | | Android 9 emulator seems quite buggy with sending the orientation changes callbacks. Task-number: QTBUG-124890 Change-Id: Ifb52d2eea4221d1759a04ca1d7e74e60620a3804 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: fix 180 degree orientation issueLauri Pohjanheimo2024-04-121-5/+35
| | | | | | | | | | | | | | | | On android documentation orientation changes are sent via onConfigurationChanged callback. Previous implementation based orientation detection to onSizeChanged callback. That callback is not called when orientation turns 180 degrees. i.e. between landscape and inverted landscape. This fix adds detection to on onConfigurationChanged to catch those cases. Fixes: QTBUG-118887 Fixes: QTBUG-118236 Pick-to: 6.7 6.5 Change-Id: Ie2f81798de97e460de839f7ebfde9a9efa25909f Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Android: Add a context delegate for embedding QML to native AndroidTinja Paavoseppä2024-01-211-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | When we are embedding a QML view to a non-Qt Android app, there are a lot of functionalities that are shared with the refular Qt Android app, but some are not. We should not, for example, try to control the hosting Activity. Create a base class that both the QtActivityDelegate, used for the standard Qt for Android app, and the delegate for the embedding case can extend. In this commit, the QtEmbeddedDelegate is very simple, the biggest difference to QtActivityDelegate being it does not create a QtLayout or instantiate a QtAccessibilityDelegate. It does start the Qt app, without waiting for a layout, and register to listen for changes in the state of the Qt app. Taking the embedded delegate into use, loading the embedded QML views and their handling is added in a follow up commit. Task-number: QTBUG-118872 Pick-to: 6.7 Change-Id: Id390a2b35c70b35880523886bf6fcf59d420cb42 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: fix and simplify the orientation change logicAssam Boudjelthia2023-12-051-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the orientation change handling to the display manager and call it from the relevant places to repeated and scattered code for the same functionality. Bring back part of 072387edecb2269097821e35f1f232da6c657650 which checks discard a resize event that's not valid that reports not up to date layout size. If DisplayManager.DisplayListener.onDisplay() initiates the orientation change, handle it immediately if we don't expect the size to change, i.e. if the orientation is changing from portrait to inverted portrait and vise versa for landscape. Otherwise, expect the change to be initiated again shortly after from QtLayout.onSizeChanged(). Also, add improve the unit test of the orientation change, and test for the widget size after such changes to make sure QTBUG-94459 is not reached again. Fixes: QTBUG-119430 Task-number: QTBUG-115019 Task-number: QTBUG-94459 Change-Id: I5f060d91531af677ddf891f2af360d5f399e26e5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: set displayManager listener after QtLayout is initializedAssam Boudjelthia2023-11-151-0/+21
| | | | | | | | | | | | the QtDisplayManager listener uses m_layout but it can be called before m_layout is actually initialized, so set the listener after the layout has been initialized. Task-number: QTBUG-118077 Fixes: QTBUG-119007 Fixes: QTBUG-119134 Change-Id: Icebc350f09210c12dbd011f86ce88a90b6f27d12 Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
* Android: don't call delegates outside of the ActivityAssam Boudjelthia2023-11-101-2/+5
| | | | | | | | | | | | | | | | | | | | | The delegate classes shouldn't be used outside of the Activity/Service classes, since they're practically private implementation, so don't use them anywhere outside Activity/Service. Since Qt Android apps still mainly support having one QtActivity/ QtService, QtNative heavily uses those objects to do various operations. For that reason, we still need to use the delegate there. The aim is to change that in future patches and do the operations where they make more sense for example directly under QtActivityBase/QtActivityDelegate or Service counterpart. The QtServiceDelegate is used no where and have no special implementation, so it's removed here. Task-number: QTBUG-118077 Change-Id: I5e106318169be19fec8163e8e500ee573af0e1bc Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Don't add prefix for BaseNameBogDan Vatra2023-06-161-3/+9
| | | | | | | | | | | | | | Adding the "assets:" prefix to BaseName leads to wrong names returned by QFileInfo{"assets:/path/to/file"}.fileName(). Instead to return "file" it returns "assets:/file" which is not the expected result. Fixes: QTBUG-114576 Fixes: QTBUG-114219 Fixes: QTBUG-112261 Pick-to: 6.6 6.5 6.5.2 Change-Id: I574bf325300c0aedef68b1b183fa837144ad63c6 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: fix Android assets handler not listing dirs with only sub dirsBartlomiej Moskal2022-12-131-0/+24
| | | | | | | | | | | | | | | | | | | | | It looks like AAssetDir_getNextFileName is not enough. Directories that contain only other directories (no files) were not listed. On the other hand, AAssetManager_openDir() will always return a pointer to initialized object (even if the specified directory does not exists), so we can't just leave only it here. Using FolderIterator as a last resort. This approach should not be too time consuming. As part of this fix, add some unit tests to cover/ensure assets listing/iterating works as expected. Fixes: QTBUG-107627 Pick-to: 6.4 6.2 5.15 Change-Id: Id375fe8f99f4ca3f8cad4756f783ffafe5c074df Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: Fix incorrect fullscreen dimensionsSamuel Mira2022-11-071-0/+102
| | | | | | | | | | | | | | The insets used to calculate the correct height were not the best choice. It used display cutout insets which would work correctly on most devices, but in the case of an emulator or a device without a camera, it could fail to calculate correctly. Task-number: QTBUG-107604 Task-number: QTBUG-107709 Task-number: QTBUG-107523 Pick-to: 6.4 6.4.1 6.2 5.15 Change-Id: I8c4da83ae7359a0c133dbeb02dbd2cd260565f78 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Revert "Android: fix Android assets handler not listing dirs with only sub dirs"Jani Heikkinen2022-10-251-23/+0
| | | | | | | | | | | This reverts commit 89f89cedc0e62f4b66de340da57d6c56dc61baf0. Reason for revert: QTBUG-107879 Task-number: QTBUG-107627 Fixes: QTBUG-107879 Change-Id: I31ceec5156837281b25fd17024c01e3477550ce0 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Android: fix Android assets handler not listing dirs with only sub dirsAssam Boudjelthia2022-10-211-0/+23
| | | | | | | | | | | | | | | | | | Amends edd983071e0a90ee8665d2f45916fb575fc25857. Remove redundant calls to AAssetDir_getNextFileName() in AndroidAbstractFileEngine::setFileName(). It's enough to check if AAssetManager_open() returns null and AAssetManager_openDir() is valid for the provided asset file name. As part of this fix, add some unit tests to cover/ensure assets listing/iterating works as expected. Fixes: QTBUG-107627 Pick-to: 6.4 6.2 5.15 Change-Id: I37ae9cb64fbbc60699bb748895f77fd6a34fae1f Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Android: Add runOnMainAndroidThread() under QNativeInterfaceAssam Boudjelthia2021-05-261-0/+112
| | | | | | | | | | | | This replaces QtAndroidPrivate::runOnAndroidThread{Sync} calls. This also now allows passing std::function<> that can return values, and not only an std::function<void()>. This adds some tests for this calls as well. Fixes: QTBUG-90501 Change-Id: I138d2aae64be17347f7ff712d8a86edb49ea8350 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add tests for QAndroidApplication's sdkVersion and activityAssam Boudjelthia2021-05-131-0/+82
While at it, move tst_android under corelib/platform/android. Change-Id: Icf91cd75cb5e04d03fe6a81d52fba52a485ca41f Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>