Retain elements when storing them in the cache, so that they only get destroyed when they are neither stored as rows/columns, and removed from the cache. If storing an element in the cache replaces a different element with the same ID, release that before retaining the new one. Give the insertElement() function a bool return value so that callers know whether the element has been retained, so that they can correctly release their own reference. Release elements when they are removed from the cache so that it's easier to see that the calls are balanced. For that to work, forward declare QMacAccessibilityElement as an NSObject type. A special case are place-holder cell elements. Those are not inserted into the cache until the interface is requested, so when those get inserted into the cache, we don't have a local reference to release - it's the reference held by the rows/columns array. However, we don't want stale elements in the cache, so when we release the rows and columns arrays, also remove all cell entries from the cache. Otherwise we end up with stale elements reporting outdated values. As this might invalidate references that our test object holds, refresh the test object when triggering a model update. Amends 1f7e926411d1e0d958c37dc597f24101d410c46b. Pick-to: 6.8 Fixes: QTBUG-134784 Change-Id: Ib3cce35058e4c80e3edc97ae578584610ee93487 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit b1ed5f656f064e553b33752f8e87d2f5b9553e38) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This directory contains autotests and benchmarks based on Qt Test. In order to run the autotests reliably, you need to configure a desktop to match the test environment that these tests are written for. Linux X11: * The user must be logged in to an active desktop; you can't run the autotests without a valid DISPLAY that allows X11 connections. * The tests are run against a KDE3 or KDE4 desktop. * Window manager uses "click to focus", and not "focus follows mouse". Many tests move the mouse cursor around and expect this to not affect focus and activation. * Disable "click to activate", i.e., when a window is opened, the window manager should automatically activate it (give it input focus) and not wait for the user to click the window.