mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-04 16:25:27 +08:00
qt 6.6.0 clean
This commit is contained in:
@ -35,10 +35,10 @@ if(QT_FEATURE_process AND TARGET Qt::Gui AND NOT ANDROID)
|
||||
add_subdirectory(qprocess_and_guieventloop)
|
||||
endif()
|
||||
if(QT_FEATURE_accessibility_atspi_bridge AND TARGET Qt::Gui AND TARGET Qt::Widgets)
|
||||
#add_subdirectory(qaccessibilitylinux) # special case # This test is broken
|
||||
#add_subdirectory(qaccessibilitylinux) # TODO: This test is broken
|
||||
endif()
|
||||
if(MACOS AND TARGET Qt::Gui)
|
||||
# add_subdirectory(macnativeevents) # special case it's disabled in qmake too
|
||||
# add_subdirectory(macnativeevents) # TODO: it's disabled in qmake too
|
||||
endif()
|
||||
if(embedded)
|
||||
add_subdirectory(qdirectpainter)
|
||||
@ -46,3 +46,7 @@ endif()
|
||||
if(QT_FEATURE_xkbcommon AND TARGET Qt::Gui)
|
||||
add_subdirectory(xkbkeyboard)
|
||||
endif()
|
||||
|
||||
if(ANDROID AND QT_BUILD_STANDALONE_TESTS)
|
||||
add_subdirectory(android_deployment_settings)
|
||||
endif()
|
||||
|
85
tests/auto/other/android_deployment_settings/CMakeLists.txt
Normal file
85
tests/auto/other/android_deployment_settings/CMakeLists.txt
Normal file
@ -0,0 +1,85 @@
|
||||
# Copyright (C) 2023 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(tst_android_deployment_settings LANGUAGES CXX)
|
||||
find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
|
||||
endif()
|
||||
|
||||
function(tst_generate_android_deployment_setting target)
|
||||
# Qt build always use new property format that supports generator expressions. In this test we
|
||||
# want to test user scenario so disable all Qt specific options to make sure that
|
||||
# qt6_android_generate_deployment_settings behave like in user projects.
|
||||
set(QT_BUILD_STANDALONE_TESTS FALSE)
|
||||
set(QT_BUILDING_QT FALSE)
|
||||
set(QT_INTERNAL_IS_STANDALONE_TEST FALSE)
|
||||
|
||||
qt6_android_generate_deployment_settings(${target})
|
||||
endfunction()
|
||||
|
||||
qt6_policy(SET QTP0002 NEW)
|
||||
|
||||
set(target tst_android_deployment_settings_new)
|
||||
qt6_add_executable(${target} MANUAL_FINALIZATION EXCLUDE_FROM_ALL noop.cpp)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
my_package_source_dir "path/to/source/dir"
|
||||
my_libs_property "some/path/to/lib2.so;some/path/to/lib3.so"
|
||||
my_plugins_property "some/path/to/plugin2.so;some/path/to/plugin3.so"
|
||||
|
||||
QT_ANDROID_SDK_BUILD_TOOLS_REVISION "23.0.2"
|
||||
QT_ANDROID_MIN_SDK_VERSION "1"
|
||||
QT_ANDROID_TARGET_SDK_VERSION "2"
|
||||
QT_ANDROID_DEPLOYMENT_DEPENDENCIES "dep1.so;dep2.so;dep3.so"
|
||||
QT_ANDROID_DEPLOYMENT_SETTINGS_FILE "attempt_to_rewrite.json"
|
||||
QT_ANDROID_EXTRA_LIBS
|
||||
"some/path/to/lib1.so;$<TARGET_PROPERTY:${target},my_libs_property>;some/path/to/lib4.so"
|
||||
QT_ANDROID_EXTRA_PLUGINS
|
||||
"some/path/to/plugin1.so;$<TARGET_PROPERTY:${target},my_plugins_property>"
|
||||
QT_ANDROID_PACKAGE_SOURCE_DIR "$<TARGET_PROPERTY:${target},my_package_source_dir>"
|
||||
QT_ANDROID_SYSTEM_LIBS_PREFIX "myLibPrefix"
|
||||
|
||||
# Make sure that this property is overwritten by
|
||||
# qt6_android_generate_deployment_settings
|
||||
QT_ANDROID_DEPLOYMENT_SETTINGS_FILE "custom_deployment_settings.json"
|
||||
)
|
||||
tst_generate_android_deployment_setting(${target})
|
||||
|
||||
qt6_policy(SET QTP0002 OLD)
|
||||
|
||||
set(target tst_android_deployment_settings_old)
|
||||
qt6_add_executable(${target} MANUAL_FINALIZATION EXCLUDE_FROM_ALL noop.cpp)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
QT_ANDROID_SDK_BUILD_TOOLS_REVISION "23.0.2"
|
||||
QT_ANDROID_MIN_SDK_VERSION "1"
|
||||
QT_ANDROID_TARGET_SDK_VERSION "2"
|
||||
QT_ANDROID_DEPLOYMENT_DEPENDENCIES "dep1.so;dep2.so;dep3.so"
|
||||
QT_ANDROID_EXTRA_LIBS
|
||||
"some/path/to/lib1.so;some/path\\to/lib2.so;some\\path\\to\\lib3.so;some/path/to/lib4.so"
|
||||
QT_ANDROID_EXTRA_PLUGINS
|
||||
"some\\path\\to\\plugin1.so;some/path\\to/plugin2.so;some/path/to/plugin3.so"
|
||||
QT_ANDROID_PACKAGE_SOURCE_DIR "path\\to/source\\dir"
|
||||
QT_ANDROID_SYSTEM_LIBS_PREFIX "myLibPrefix"
|
||||
)
|
||||
tst_generate_android_deployment_setting(${target})
|
||||
|
||||
get_target_property(new_settings
|
||||
tst_android_deployment_settings_new QT_ANDROID_DEPLOYMENT_SETTINGS_FILE)
|
||||
get_target_property(old_settings
|
||||
tst_android_deployment_settings_old QT_ANDROID_DEPLOYMENT_SETTINGS_FILE)
|
||||
set_source_files_properties("${new_settings}" PROPERTIES QT_RESOURCE_ALIAS "new_settings.json")
|
||||
set_source_files_properties("${old_settings}" PROPERTIES QT_RESOURCE_ALIAS "old_settings.json")
|
||||
qt_internal_add_test(tst_android_deployment_settings
|
||||
SOURCES
|
||||
tst_android_deployment_settings.cpp
|
||||
DEFINES
|
||||
DEFAULT_ABI="${CMAKE_ANDROID_ARCH_ABI}"
|
||||
)
|
||||
qt6_add_resources(tst_android_deployment_settings
|
||||
"deployment_settings_res"
|
||||
PREFIX
|
||||
"/"
|
||||
FILES
|
||||
"${new_settings}"
|
||||
"${old_settings}"
|
||||
)
|
7
tests/auto/other/android_deployment_settings/noop.cpp
Normal file
7
tests/auto/other/android_deployment_settings/noop.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
int main(int, char *[])
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QFile>
|
||||
#include <QTest>
|
||||
#include <QLibraryInfo>
|
||||
#include <QDir>
|
||||
|
||||
class tst_android_deployment_settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase_data();
|
||||
void init();
|
||||
|
||||
void DeploymentSettings_data();
|
||||
void DeploymentSettings();
|
||||
|
||||
void QtPaths_data();
|
||||
void QtPaths();
|
||||
|
||||
private:
|
||||
static QString makePath(QLibraryInfo::LibraryLocation loc);
|
||||
QJsonDocument jsonDoc;
|
||||
};
|
||||
|
||||
QString tst_android_deployment_settings::makePath(QLibraryInfo::LibraryLocation loc)
|
||||
{
|
||||
const auto prefix = QLibraryInfo::path(QLibraryInfo::PrefixPath);
|
||||
auto path = QLibraryInfo::path(loc);
|
||||
path.remove(0, prefix.size() + 1);
|
||||
if (path.isEmpty()) // Assume that if path is empty it's '.'
|
||||
path = ".";
|
||||
return path;
|
||||
}
|
||||
|
||||
void tst_android_deployment_settings::initTestCase_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::newRow("old") << ":/old_settings.json";
|
||||
QTest::newRow("new") << ":/new_settings.json";
|
||||
}
|
||||
|
||||
void tst_android_deployment_settings::init()
|
||||
{
|
||||
QFETCH_GLOBAL(QString, file);
|
||||
QFile settings(file);
|
||||
QVERIFY(settings.open(QIODeviceBase::ReadOnly));
|
||||
jsonDoc = QJsonDocument::fromJson(settings.readAll());
|
||||
QVERIFY(!jsonDoc.isNull());
|
||||
}
|
||||
|
||||
void tst_android_deployment_settings::DeploymentSettings_data()
|
||||
{
|
||||
QTest::addColumn<QString>("key");
|
||||
QTest::addColumn<QString>("value");
|
||||
|
||||
QTest::newRow("sdkBuildToolsRevision") << "sdkBuildToolsRevision"
|
||||
<< "23.0.2";
|
||||
QTest::newRow("deployment-dependencies") << "deployment-dependencies"
|
||||
<< "dep1.so,dep2.so,dep3.so";
|
||||
QTest::newRow("android-extra-plugins")
|
||||
<< "android-extra-plugins"
|
||||
<< "some/path/to/plugin1.so,some/path/to/plugin2.so,some/path/to/plugin3.so";
|
||||
QTest::newRow("android-extra-libs") << "android-extra-libs"
|
||||
<< "some/path/to/lib1.so,some/path/to/lib2.so,some/path/to/"
|
||||
"lib3.so,some/path/to/lib4.so";
|
||||
QTest::newRow("android-system-libs-prefix") << "android-system-libs-prefix"
|
||||
<< "myLibPrefix";
|
||||
QTest::newRow("android-package-source-directory") << "android-package-source-directory"
|
||||
<< "path/to/source/dir";
|
||||
QTest::newRow("android-min-sdk-version") << "android-min-sdk-version"
|
||||
<< "1";
|
||||
QTest::newRow("android-target-sdk-version") << "android-target-sdk-version"
|
||||
<< "2";
|
||||
}
|
||||
|
||||
void tst_android_deployment_settings::DeploymentSettings()
|
||||
{
|
||||
QFETCH(QString, key);
|
||||
QFETCH(QString, value);
|
||||
QCOMPARE(jsonDoc[key].toString(), value);
|
||||
}
|
||||
|
||||
void tst_android_deployment_settings::QtPaths_data()
|
||||
{
|
||||
QTest::addColumn<QString>("key");
|
||||
QTest::addColumn<QString>("value");
|
||||
|
||||
QTest::newRow("qtDataDirectory") << "qtDataDirectory" << makePath(QLibraryInfo::DataPath);
|
||||
QTest::newRow("qtLibExecsDirectory")
|
||||
<< "qtLibExecsDirectory" << makePath(QLibraryInfo::LibraryExecutablesPath);
|
||||
QTest::newRow("qtLibsDirectory") << "qtLibsDirectory" << makePath(QLibraryInfo::LibrariesPath);
|
||||
QTest::newRow("qtPluginsDirectory")
|
||||
<< "qtPluginsDirectory" << makePath(QLibraryInfo::PluginsPath);
|
||||
QTest::newRow("qtQmlDirectory") << "qtQmlDirectory" << makePath(QLibraryInfo::QmlImportsPath);
|
||||
}
|
||||
|
||||
void tst_android_deployment_settings::QtPaths()
|
||||
{
|
||||
QFETCH(QString, key);
|
||||
QFETCH(QString, value);
|
||||
QCOMPARE(QDir::cleanPath(jsonDoc[key].toObject()[DEFAULT_ABI].toString()),
|
||||
QDir::cleanPath(value));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_android_deployment_settings)
|
||||
|
||||
#include "tst_android_deployment_settings.moc"
|
@ -224,6 +224,7 @@ private slots:
|
||||
void accessibleName();
|
||||
#if QT_CONFIG(shortcut)
|
||||
void labelTest();
|
||||
void relationTest();
|
||||
void accelerators();
|
||||
#endif
|
||||
void bridgeTest();
|
||||
@ -1119,7 +1120,10 @@ void tst_QAccessibility::buttonTest()
|
||||
interface = QAccessible::queryAccessibleInterface(&toggleButton);
|
||||
actionInterface = interface->actionInterface();
|
||||
QCOMPARE(interface->role(), QAccessible::CheckBox);
|
||||
QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
|
||||
QCOMPARE(actionInterface->actionNames(),
|
||||
QStringList() << QAccessibleActionInterface::toggleAction()
|
||||
<< QAccessibleActionInterface::pressAction()
|
||||
<< QAccessibleActionInterface::setFocusAction());
|
||||
QCOMPARE(actionInterface->localizedActionDescription(QAccessibleActionInterface::toggleAction()), QString("Toggles the state"));
|
||||
QVERIFY(!toggleButton.isChecked());
|
||||
QVERIFY(!interface->state().checked);
|
||||
@ -1155,12 +1159,18 @@ void tst_QAccessibility::buttonTest()
|
||||
interface = QAccessible::queryAccessibleInterface(&checkBox);
|
||||
actionInterface = interface->actionInterface();
|
||||
QCOMPARE(interface->role(), QAccessible::CheckBox);
|
||||
QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
|
||||
QCOMPARE(actionInterface->actionNames(),
|
||||
QStringList() << QAccessibleActionInterface::toggleAction()
|
||||
<< QAccessibleActionInterface::pressAction()
|
||||
<< QAccessibleActionInterface::setFocusAction());
|
||||
QVERIFY(!interface->state().checked);
|
||||
actionInterface->doAction(QAccessibleActionInterface::toggleAction());
|
||||
|
||||
QTest::qWait(500);
|
||||
QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
|
||||
QCOMPARE(actionInterface->actionNames(),
|
||||
QStringList() << QAccessibleActionInterface::toggleAction()
|
||||
<< QAccessibleActionInterface::pressAction()
|
||||
<< QAccessibleActionInterface::setFocusAction());
|
||||
QVERIFY(interface->state().checked);
|
||||
QVERIFY(checkBox.isChecked());
|
||||
QAccessible::State st;
|
||||
@ -3741,6 +3751,69 @@ void tst_QAccessibility::comboBoxTest()
|
||||
QTestAccessibility::clearEvents();
|
||||
}
|
||||
|
||||
void tst_QAccessibility::relationTest()
|
||||
{
|
||||
auto windowHolder = std::make_unique<QWidget>();
|
||||
auto window = windowHolder.get();
|
||||
QString text = "Hello World";
|
||||
QLabel *label = new QLabel(text, window);
|
||||
setFrameless(label);
|
||||
QSpinBox *spinBox = new QSpinBox(window);
|
||||
label->setBuddy(spinBox);
|
||||
QProgressBar *pb = new QProgressBar(window);
|
||||
pb->setRange(0, 99);
|
||||
connect(spinBox, SIGNAL(valueChanged(int)), pb, SLOT(setValue(int)));
|
||||
|
||||
window->resize(320, 200);
|
||||
window->show();
|
||||
|
||||
QVERIFY(QTest::qWaitForWindowExposed(window));
|
||||
#if defined(Q_OS_UNIX)
|
||||
QCoreApplication::processEvents();
|
||||
#endif
|
||||
QTest::qWait(100);
|
||||
|
||||
QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(label);
|
||||
QVERIFY(acc_label);
|
||||
QAccessibleInterface *acc_spinBox = QAccessible::queryAccessibleInterface(spinBox);
|
||||
QVERIFY(acc_spinBox);
|
||||
QAccessibleInterface *acc_pb = QAccessible::queryAccessibleInterface(pb);
|
||||
QVERIFY(acc_pb);
|
||||
|
||||
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
|
||||
{
|
||||
const QList<RelationPair> rels = acc_label->relations(QAccessible::Labelled);
|
||||
QCOMPARE(rels.size(), 1);
|
||||
const RelationPair relPair = rels.first();
|
||||
|
||||
// spinBox is Labelled by acc_label
|
||||
QCOMPARE(relPair.first->object(), spinBox);
|
||||
QCOMPARE(relPair.second, QAccessible::Labelled);
|
||||
}
|
||||
|
||||
{
|
||||
// Test multiple relations (spinBox have two)
|
||||
const QList<RelationPair> rels = acc_spinBox->relations();
|
||||
QCOMPARE(rels.size(), 2);
|
||||
int visitCount = 0;
|
||||
for (const auto &relPair : rels) {
|
||||
if (relPair.second & QAccessible::Label) {
|
||||
// label is the Label of spinBox
|
||||
QCOMPARE(relPair.first->object(), label);
|
||||
++visitCount;
|
||||
} else if (relPair.second & QAccessible::Controlled) {
|
||||
// progressbar is Controlled by the spinBox
|
||||
QCOMPARE(relPair.first->object(), pb);
|
||||
++visitCount;
|
||||
}
|
||||
}
|
||||
QCOMPARE(visitCount, rels.size());
|
||||
}
|
||||
|
||||
windowHolder.reset();
|
||||
QTestAccessibility::clearEvents();
|
||||
}
|
||||
|
||||
#if QT_CONFIG(shortcut)
|
||||
|
||||
void tst_QAccessibility::labelTest()
|
||||
@ -3763,6 +3836,8 @@ void tst_QAccessibility::labelTest()
|
||||
|
||||
QAccessibleInterface *acc_label = QAccessible::queryAccessibleInterface(label);
|
||||
QVERIFY(acc_label);
|
||||
QAccessibleInterface *acc_lineEdit = QAccessible::queryAccessibleInterface(buddy);
|
||||
QVERIFY(acc_lineEdit);
|
||||
|
||||
QCOMPARE(acc_label->text(QAccessible::Name), text);
|
||||
QCOMPARE(acc_label->state().editable, false);
|
||||
@ -3772,13 +3847,23 @@ void tst_QAccessibility::labelTest()
|
||||
QCOMPARE(acc_label->state().focusable, false);
|
||||
QCOMPARE(acc_label->state().readOnly, true);
|
||||
|
||||
QList<QPair<QAccessibleInterface *, QAccessible::Relation>> rels = acc_label->relations();
|
||||
QCOMPARE(rels.size(), 1);
|
||||
QAccessibleInterface *iface = rels.first().first;
|
||||
QAccessible::Relation rel = rels.first().second;
|
||||
|
||||
QCOMPARE(rel, QAccessible::Labelled);
|
||||
QCOMPARE(iface->role(), QAccessible::EditableText);
|
||||
typedef QPair<QAccessibleInterface*, QAccessible::Relation> RelationPair;
|
||||
{
|
||||
const QList<RelationPair> rels = acc_label->relations(QAccessible::Labelled);
|
||||
QCOMPARE(rels.size(), 1);
|
||||
const RelationPair relPair = rels.first();
|
||||
QCOMPARE(relPair.first->object(), buddy);
|
||||
QCOMPARE(relPair.second, QAccessible::Labelled);
|
||||
}
|
||||
|
||||
{
|
||||
const QList<RelationPair> rels = acc_lineEdit->relations(QAccessible::Label);
|
||||
QCOMPARE(rels.size(), 1);
|
||||
const RelationPair relPair = rels.first();
|
||||
QCOMPARE(relPair.first->object(), label);
|
||||
QCOMPARE(relPair.second, QAccessible::Label);
|
||||
}
|
||||
|
||||
windowHolder.reset();
|
||||
QTestAccessibility::clearEvents();
|
||||
|
@ -12,3 +12,4 @@ qt_internal_add_test(tst_qprocess_and_guieventloop
|
||||
Qt::Gui
|
||||
)
|
||||
add_subdirectory(write-read-write)
|
||||
add_dependencies(tst_qprocess_and_guieventloop write-read-write)
|
||||
|
Reference in New Issue
Block a user