6.5.3 clean

This commit is contained in:
kleuter
2023-11-01 18:02:52 +01:00
parent bbe896803b
commit 7018d9e6c8
2170 changed files with 57471 additions and 43550 deletions

View File

@ -5,58 +5,3 @@ ubuntu-22.04 ci
ubuntu-20.04
ubuntu-22.04 ci
# QTBUG-108402
[gestureOverChildGraphicsItem]
macOS arm
# QTBUG-108402
[conflictingGesturesInGraphicsView]
macOS arm
# QTBUG-108402
[graphicsItemGesture]
macOS arm
# QTBUG-108402
[graphicsView]
macOS arm
# QTBUG-108402
[graphicsItemTreeGesture]
macOS arm
# QTBUG-108402
[explicitGraphicsObjectTarget]
macOS arm
# QTBUG-108402
[gestureOverChildGraphicsItem]
macOS arm
# QTBUG-108402
[autoCancelGestures2]
macOS arm
# QTBUG-108402
[graphicsViewParentPropagation]
macOS arm
# QTBUG-108402
[panelPropagation]
macOS arm
# QTBUG-108402
[panelStacksBehindParent]
macOS arm
# QTBUG-108402
[viewportCoordinates]
macOS arm
# QTBUG-108402
[partialGesturePropagation]
macOS arm
# QTBUG-108402
[testReuseCanceledGestures]
macOS arm

View File

@ -191,7 +191,7 @@ void ModelMoveCommand::doCommand()
return;
for (int column = 0; column < m_numCols; ++column) {
QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(
const QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(
m_startRow, m_endRow - m_startRow + 1);
for (int i = m_startRow; i <= m_endRow; i++)
@ -206,7 +206,7 @@ void ModelMoveCommand::doCommand()
d = m_destRow;
}
foreach (const qint64 id, l)
for (qint64 id : l)
m_model->m_childItems[destParent.internalId()][column].insert(d++, id);
}
@ -283,9 +283,7 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
const QPersistentModelIndex parent1 = findIndex(m_rowNumbers);
const QPersistentModelIndex parent2 = findIndex(m_secondRowNumbers);
QList<QPersistentModelIndex> parents;
parents << parent1;
parents << parent2;
const QList<QPersistentModelIndex> parents = { parent1, parent2 };
emit m_model->layoutAboutToBeChanged(parents);
@ -309,13 +307,13 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
// changing any children of that parent. The reason is that we're keeping parent1 and parent2
// around as QPersistentModelIndex instances, and we query idx.parent() in the loop.
QModelIndexList persistent = m_model->persistentIndexList();
foreach (const QModelIndex &parent, parents) {
for (const QModelIndex &parent : parents) {
int idx = persistent.indexOf(parent);
if (idx != -1)
persistent.move(idx, 0);
}
foreach (const QModelIndex &idx, persistent) {
for (const QModelIndex &idx : std::as_const(persistent)) {
if (idx.parent() == parent1) {
if (idx.row() == rowSize1 - 1) {
m_model->changePersistentIndex(idx,

View File

@ -40,6 +40,7 @@
#include <QtTest/private/qtesthelpers_p.h>
using namespace QTestPrivate;
using namespace Qt::StringLiterals;
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
int index, const QRect &domain)
@ -214,6 +215,7 @@ private slots:
void listTest();
void treeTest();
void tableTest();
void rootIndexView();
void uniqueIdTest();
void calendarWidgetTest();
@ -2868,6 +2870,12 @@ void tst_QAccessibility::listTest()
QCOMPARE(iface->indexOfChild(child3), 2);
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
}
// Check that application is accessible parent, since it's a top-level widget
QAccessibleInterface *parentIface = iface->parent();
QVERIFY(parentIface);
QVERIFY(parentIface->role() == QAccessible::Application);
QTestAccessibility::clearEvents();
// Check for events
@ -3390,6 +3398,51 @@ void tst_QAccessibility::tableTest()
QTestAccessibility::clearEvents();
}
void tst_QAccessibility::rootIndexView()
{
QStandardItemModel model;
for (int i = 0; i < 2; ++i) {
QStandardItem *item = new QStandardItem(u"root %1"_s.arg(i));
for (int j = 0; j < 5 * (i + 1); ++j) {
switch (i) {
case 0:
item->appendRow(new QStandardItem(u"child0/%1"_s.arg(j)));
break;
case 1:
item->appendRow({new QStandardItem(u"column0 1/%1"_s.arg(j)),
new QStandardItem(u"column1 1/%1"_s.arg(j))
});
break;
}
}
model.appendRow(item);
}
QListView view;
view.setModel(&model);
QTestAccessibility::clearEvents();
QAccessibleInterface *accView = QAccessible::queryAccessibleInterface(&view);
QVERIFY(accView);
QAccessibleTableInterface *accTable = accView->tableInterface();
QVERIFY(accTable);
QCOMPARE(accTable->rowCount(), 2);
QCOMPARE(accTable->columnCount(), 1);
view.setRootIndex(model.index(0, 0));
QAccessibleTableModelChangeEvent resetEvent(&view, QAccessibleTableModelChangeEvent::ModelReset);
QVERIFY(QTestAccessibility::containsEvent(&resetEvent));
QCOMPARE(accTable->rowCount(), 5);
QCOMPARE(accTable->columnCount(), 1);
view.setRootIndex(model.index(1, 0));
QCOMPARE(accTable->rowCount(), 10);
QCOMPARE(accTable->columnCount(), 2);
QTestAccessibility::clearEvents();
}
void tst_QAccessibility::uniqueIdTest()
{
// Test that an ID isn't reassigned to another interface right away when an accessible interface

View File

@ -103,7 +103,7 @@ QStringList tst_QAccessibilityLinux::getChildren(QDBusInterface *interface)
Q_ASSERT(interface->property("ChildCount").toInt() == list.count());
QStringList children;
Q_FOREACH (const QSpiObjectReference &ref, list)
for (const QSpiObjectReference &ref : std::as_const(list))
children << ref.path.path();
return children;

View File

@ -62,6 +62,7 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
@interface TestAXObject : NSObject
{
AXUIElementRef reference;
bool axError;
}
@property (readonly) NSString *role;
@property (readonly) NSString *title;
@ -77,11 +78,13 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
if ((self = [super init])) {
reference = ref;
axError = false;
}
return self;
}
- (AXUIElementRef) ref { return reference; }
- (bool)errorOccurred { return axError; }
- (void) print {
NSLog(@"Accessible Object role: '%@', title: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.title, self.description, self.value, NSStringFromRect(NSRectFromCGRect(self.rect)));
NSLog(@" Children: %ld", [[self childList] count]);
@ -225,8 +228,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
CFTypeRef value = NULL;
AXError err;
if (kAXErrorSuccess != (err = AXUIElementCopyAttributeValue(reference, attribute, &value)))
{
if (kAXErrorSuccess != (err = AXUIElementCopyAttributeValue(reference, attribute, &value))) {
axError = true;
qDebug() << "AXUIElementCopyAttributeValue(" << QString::fromCFString(attribute) << ") returned error = " << AXErrorTag(err);
}
return value;
@ -272,8 +275,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
CFTypeRef value = NULL;
AXError err;
if (kAXErrorSuccess != (err = AXUIElementCopyParameterizedAttributeValue(reference, attribute, parameter, &value)))
{
if (kAXErrorSuccess != (err = AXUIElementCopyParameterizedAttributeValue(reference, attribute, parameter, &value))) {
axError = true;
CFStringRef description = CFCopyDescription(parameter);
qDebug() << "AXUIElementCopyParameterizedAttributeValue(" << QString::fromCFString(attribute) << ", parameter=" << QString::fromCFString(description) << ") returned error = " << AXErrorTag(err);
CFRelease(description);
@ -311,8 +314,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
AXError err;
CFArrayRef actions;
if (kAXErrorSuccess != (err = AXUIElementCopyActionNames(reference, &actions)))
{
if (kAXErrorSuccess != (err = AXUIElementCopyActionNames(reference, &actions))) {
axError = true;
qDebug() << "AXUIElementCopyActionNames(...) returned error = " << AXErrorTag(err);
}
@ -323,8 +326,8 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
{
AXError err;
if (kAXErrorSuccess != (err = AXUIElementPerformAction(reference, action)))
{
if (kAXErrorSuccess != (err = AXUIElementPerformAction(reference, action))) {
axError = true;
qDebug() << "AXUIElementPerformAction(" << QString::fromCFString(action) << ") returned error = " << AXErrorTag(err);
}
}
@ -407,6 +410,7 @@ private Q_SLOTS:
void notificationsTest();
void checkBoxTest();
void tableViewTest();
void treeViewTest();
private:
AccessibleTestWindow *m_window;
@ -416,7 +420,7 @@ private:
void tst_QAccessibilityMac::init()
{
m_window = new AccessibleTestWindow();
m_window->setWindowTitle("Test window");
m_window->setWindowTitle(QString("Test window - %1").arg(QTest::currentTestFunction()));
m_window->show();
m_window->resize(400, 400);
@ -481,7 +485,7 @@ void tst_QAccessibilityMac::lineEditTest()
// height of window includes title bar
QVERIFY([window rect].size.height >= 400);
QVERIFY([window.title isEqualToString:@"Test window"]);
QVERIFY([window.title isEqualToString:@"Test window - lineEditTest"]);
// children of window:
AXUIElementRef lineEditElement = [window findDirectChildByRole: kAXTextFieldRole];
@ -732,5 +736,73 @@ void tst_QAccessibilityMac::tableViewTest()
}
}
void tst_QAccessibilityMac::treeViewTest()
{
QTreeWidget *tw = new QTreeWidget;
tw->setColumnCount(2);
QTreeWidgetItem *root = new QTreeWidgetItem(tw, {"/", "0"});
root->setExpanded(false);
QTreeWidgetItem *users = new QTreeWidgetItem(root,{ "Users", "1"});
(void)new QTreeWidgetItem(root, {"Applications", "2"});
QTreeWidgetItem *lastChild = new QTreeWidgetItem(root, {"Libraries", "3"});
m_window->addWidget(tw);
QVERIFY(QTest::qWaitForWindowExposed(m_window));
QCoreApplication::processEvents();
TestAXObject *appObject = [TestAXObject getApplicationAXObject];
QVERIFY(appObject);
NSArray *windowList = [appObject windowList];
// one window
QVERIFY([windowList count] == 1);
AXUIElementRef windowRef = (AXUIElementRef)[windowList objectAtIndex:0];
QVERIFY(windowRef != nil);
TestAXObject *window = [[TestAXObject alloc] initWithAXUIElementRef:windowRef];
// children of window
AXUIElementRef treeView = [window findDirectChildByRole:kAXOutlineRole];
QVERIFY(treeView != nil);
TestAXObject *tv = [[TestAXObject alloc] initWithAXUIElementRef:treeView];
// here start actual treeview tests. NSAccessibilityOutline is a specialization
// of NSAccessibilityTable, and we represent trees as tables.
// Should have 2 columns
const unsigned int columnCount = 2;
NSArray *columnArray = [tv tableColumns];
QCOMPARE([columnArray count], columnCount);
// should have 1 row for now - as long as the root item is not expanded
NSArray *rowArray = [tv tableRows];
QCOMPARE(int([rowArray count]), 1);
root->setExpanded(true);
rowArray = [tv tableRows];
QCOMPARE(int([rowArray count]), root->childCount() + 1);
// this should not trigger any assert
tw->setCurrentItem(lastChild);
bool errorOccurred = false;
const auto cellText = [rowArray, &errorOccurred](int rowIndex, int columnIndex) -> QString {
TestAXObject *row = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)rowArray[rowIndex]];
Q_ASSERT(row);
TestAXObject *cell = [[TestAXObject alloc] initWithAXUIElementRef:(AXUIElementRef)[row childList][columnIndex]];
Q_ASSERT(cell);
const QString result = QString::fromNSString(cell.title);
errorOccurred = cell.errorOccurred;
return result;
};
QString text = cellText(0, 0);
if (errorOccurred)
QSKIP("Cocoa Accessibility API error, aborting");
QCOMPARE(text, root->text(0));
QCOMPARE(cellText(1, 0), users->text(0));
QCOMPARE(cellText(1, 1), users->text(1));
}
QTEST_MAIN(tst_QAccessibilityMac)
#include "tst_qaccessibilitymac.moc"