summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp')
-rw-r--r--tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp44
1 files changed, 15 insertions, 29 deletions
diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
index f776e87692..18bcdeca29 100644
--- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
+++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtGui>
@@ -80,7 +55,7 @@ class tst_QAccessibilityLinux : public QObject
public:
tst_QAccessibilityLinux() : m_window(0), root(0), rootApplication(0), mainWindow(0)
{
- qputenv("QT_LINUX_ACCESSIBILITY_ALWAYS_ON", QByteArrayLiteral("1"));
+ qputenv("QT_LINUX_ACCESSIBILITY_ALWAYS_ON", "1");
dbus = new DBusConnection();
}
~tst_QAccessibilityLinux()
@@ -128,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;
@@ -179,6 +154,7 @@ void tst_QAccessibilityLinux::initTestCase()
QVERIFY(!address.isEmpty());
m_window = new AccessibleTestWindow();
+ m_window->setObjectName("mainWindow"_L1);
m_window->show();
QVERIFY(QTest::qWaitForWindowExposed(m_window));
@@ -236,8 +212,11 @@ bool hasState(QDBusInterface *interface, AtspiStateType state)
void tst_QAccessibilityLinux::testLabel()
{
QLabel *l = new QLabel(m_window);
+ l->setObjectName("theObjectName"_L1);
l->setText("Hello A11y");
m_window->addWidget(l);
+ auto a11yEmpty = new QLabel(m_window);
+ m_window->addWidget(l);
// Application
QCOMPARE(getParent(mainWindow), QLatin1String(ATSPI_DBUS_PATH_ROOT));
@@ -249,6 +228,8 @@ void tst_QAccessibilityLinux::testLabel()
QCOMPARE(getChildren(labelInterface).count(), 0);
QCOMPARE(labelInterface->call(QDBus::Block, "GetRoleName").arguments().first().toString(), QLatin1String("label"));
QCOMPARE(labelInterface->call(QDBus::Block, "GetRole").arguments().first().toUInt(), 29u);
+ QCOMPARE(labelInterface->call(QDBus::Block, "GetAccessibleId").arguments().first().toString(),
+ "mainWindow.theObjectName"_L1);
QCOMPARE(getParent(labelInterface), mainWindow->path());
QVERIFY(!hasState(labelInterface, ATSPI_STATE_EDITABLE));
QVERIFY(hasState(labelInterface, ATSPI_STATE_READ_ONLY));
@@ -256,7 +237,12 @@ void tst_QAccessibilityLinux::testLabel()
l->setText("New text");
QCOMPARE(labelInterface->property("Name").toString(), l->text());
+ auto *a11yEmptyInterface = getInterface(children.at(1), "org.a11y.atspi.Accessible");
+ QCOMPARE(a11yEmptyInterface->call(QDBus::Block, "GetAccessibleId").arguments().first().toString(),
+ "mainWindow.QLabel"_L1);
+
m_window->clearChildren();
+ delete a11yEmptyInterface;
delete labelInterface;
}