diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-04-27 18:04:24 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-04-28 17:20:52 +0200 |
commit | 22d708697f62d2fbd69b57fd8bc3423af76d27ca (patch) | |
tree | 1da38a62142821d1499938b34d8416efdeb4e7ca /tests | |
parent | 1dcd4ff086f55392f7d194e2e4a9e4cff599d0f6 (diff) |
Gracefully handle Accessible attached property on non-items
Attaching to e.g. a ApplicationWindow will result in corrupting the
window's private data and subsequent crashes.
Fixes: QTBUG-83738
Change-Id: Ia708edf29a0356a858ac27ff70125fc38932ba78
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index 061d5f8a1a..0e6c3b3ad9 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -169,9 +169,22 @@ void tst_QQuickAccessible::quickAttachedProperties() delete object; } - // Attached property + // Attaching to non-item { QObject parent; + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Accessible must be attached to an Item"); + QQuickAccessibleAttached *attachedObj = new QQuickAccessibleAttached(&parent); + + QCOMPARE(attachedObj->ignored(), false); + attachedObj->setIgnored(true); + QCOMPARE(attachedObj->ignored(), false); + attachedObj->setIgnored(false); + QCOMPARE(attachedObj->ignored(), false); + } + + // Attached property + { + QQuickItem parent; QQuickAccessibleAttached *attachedObj = new QQuickAccessibleAttached(&parent); attachedObj->name(); |