From 04a97e21f508beb06d6b29f8ed9fff7e481f1cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20Alaj=C3=A4rvi?= Date: Wed, 11 Jun 2025 09:53:03 +0300 Subject: [PATCH] Android: auto-tests: Add missing lib to tst_qapplication Android apk tst_qapplication is missing the modal_helper executable from the apk. Set the libmodal_helper.so as a target property for the tst_qapplication with QT_ANDROID_EXTRA_LIBS property. Change the name of qtbug_12673() test function to modalDialog(), I think this better represents what's being tested. The bug ticket representing qtbug_12673() can be found from the ticket linked to this commit. Construct a full path to the modal_helper.so and pass that to QProcess.start instead of relative path to filename when targeting Android. Add a shared utility function androidAbi() that returns the currently defined Android ABI. Change the function name in BLACKLIST file. Task-number: QTQAINFRA-6908 Pick-to: 6.8 6.9 6.10 Change-Id: I13904acda0f5608ea31df49bd95824e1412f2786 Reviewed-by: Assam Boudjelthia --- .../kernel/qapplication/CMakeLists.txt | 3 +++ .../kernel/qapplication/test/BLACKLIST | 2 +- .../kernel/qapplication/tst_qapplication.cpp | 19 ++++++++++++++++--- tests/shared/androidutils.h | 18 ++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 tests/shared/androidutils.h diff --git a/tests/auto/widgets/kernel/qapplication/CMakeLists.txt b/tests/auto/widgets/kernel/qapplication/CMakeLists.txt index b9d0ce3c67e..717daf4bcd2 100644 --- a/tests/auto/widgets/kernel/qapplication/CMakeLists.txt +++ b/tests/auto/widgets/kernel/qapplication/CMakeLists.txt @@ -21,6 +21,9 @@ qt_internal_add_executable(apphelper_widgets Qt::Widgets ) set_target_properties(apphelper_widgets PROPERTIES OUTPUT_NAME apphelper) +set_target_properties(tst_qapplication PROPERTIES + QT_ANDROID_EXTRA_LIBS ${CMAKE_CURRENT_BINARY_DIR}/libmodal_helper_${ANDROID_ABI}.so +) if(QT_FEATURE_library) qt_internal_add_cmake_library(apphelper_widgets_plugin diff --git a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST b/tests/auto/widgets/kernel/qapplication/test/BLACKLIST index 3a454dfa03e..b725839047d 100644 --- a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST +++ b/tests/auto/widgets/kernel/qapplication/test/BLACKLIST @@ -13,5 +13,5 @@ android android [wheelEventPropagation] android -[qtbug_12673] +[modalDialog] android diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 056d47e1d7d..f75f0daeddc 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -48,6 +48,7 @@ #include #include "../../../corelib/kernel/qcoreapplication/apphelper.h" +#include "../../../../../shared/androidutils.h" #include @@ -132,7 +133,7 @@ private slots: void wheelEventPropagation_data(); void wheelEventPropagation(); - void qtbug_12673(); + void modalDialog(); void qtbug_103611(); void noQuitOnHide(); @@ -2434,12 +2435,24 @@ void tst_QApplication::wheelEventPropagation() } } -void tst_QApplication::qtbug_12673() +QString modalHelperPath() +{ +#ifdef Q_OS_ANDROID + int argc = 1; + QApplication app(argc, &argv0); + return app.applicationDirPath() + QString("/libmodal_helper_%1.so").arg(androidAbi()); +#else + return "./modal_helper"; +#endif +} + +// QTBUG-133037, QTBUG-12673 +void tst_QApplication::modalDialog() { #if QT_CONFIG(process) QProcess testProcess; QStringList arguments; - testProcess.start("./modal_helper", arguments); + testProcess.start(modalHelperPath(), arguments); QVERIFY2(testProcess.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start 'modal_helper': %1").arg(testProcess.errorString()))); QVERIFY(testProcess.waitForFinished(20000)); diff --git a/tests/shared/androidutils.h b/tests/shared/androidutils.h new file mode 100644 index 00000000000..48deb6fc0f0 --- /dev/null +++ b/tests/shared/androidutils.h @@ -0,0 +1,18 @@ +// Copyright (C) 2025 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +#include + +inline QString androidAbi() +{ +#if defined(__aarch64__) + return "arm64-v8a"; +#elif defined(__arm__) + return "armeabi-v7a"; +#elif defined(__i386__) + return "x86"; +#elif defined(__x86_64__) + return "x86_64"; +#endif +} +