aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols2/qquickiconlabel
Commit message (Collapse)AuthorAgeFilesLines
* QQuickIcon: Resolve source URL relative to outermost property ownerYuya Nishihara2022-02-193-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original attempt, deb238586a "QQuickIcon: Resolve URL relative to current element," works fine for IconLabel itself, but not for Buttons containing IconLabel. // <style>/Button.qml T.Button { id: control icon: // owner: control contentItem: IconLabel { icon: control.icon // owner: this, but should be control } } // user code Button { icon.source: "a.png" } Since IconLabel is an implementation detail of the Button, IconLabel.icon owner needs to point to the Button so the user-specified icon.source can be resolved relative to the user code, not to the <style>/ directory. This patch fixes the problem by explicitly resolving the source URL on setIcon() and propagating the resolved icon object to the inner items. If the relative URL has already been resolved by e.g. Button, the inner IconLabel never resolves the URL again to itself. The problem could be addressed by initializing icon owner only once by Action/Button constructor, but that would lead to dangling owner pointer as icon object could be copied anywhere. So I've added resolvedSource data member in place of the owner pointer. Button { id: dangling } Button { id: victim; icon: dangling.icon } // owner: dangling Component.onCompleted: dangling.destroy() // ... would SEGV (or use after free) if victim.icon.source modified. Fixes: QTBUG-95587 Change-Id: Ibdd07118e79f1e1f36e1faea0289150eca734e27 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit dfc16e40ab43e8062b93c566e4316efe4d4f10a0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Include images to test data and use correct testFileUrl for comparisonAssam Boudjelthia2021-12-242-2/+2
| | | | | | | | | | | | Add the test image a.png to the test data so it can be found by the tests on Android. Task-number: QTBUG-97056 Change-Id: Ida6c3f8ca5e682bda86e879dee558a5465af7cdb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 84877818092bfc3091e4d3daa206d18382d8a463) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQuickIcon: Resolve URL relative to current elementFabian Kosmale2021-09-203-0/+38
| | | | | | | | | | | | | | | | | | If a user passes a relative URL to icon, they probably expect the URL to be handled relative to the current file (like in Qt 5). We restore this behavior by doing the URL resolution in the current QML context. Unfortunately, as a gadget, QQuickIcon does not have its own context. Thus, we need to store (and set) a pointer to its "owner", so that we can retrieve the context for the binding that causes the URL to be set. We adjust the three classes which currently use QQuickIcon to set the owner in their setIcon methods. Task-number: QTBUG-95587 Pick-to: 6.2 Change-Id: Icd1f2ddf65ae7d09ff787a50a01f1db78c571abf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Consolidate test helpers into private librariesMitch Curtis2021-09-132-7/+6
| | | | | | | | | | | | | | | | | | | | Previously each test would include and build sources from the shared folder. Now we make those sources a library, build it once, then have each test link to it instead. We also take the opportunity to move some helpers that qtquickcontrols2 had added into the quicktestutils library where it makes sense, and for the helpers that don't make sense to be there, move them into quickcontrolstestutils. We add the libraries to src/ so that they are internal modules built as part of Qt, rather than tests. That way we can use them in a standalone test outside of qtdeclarative. Task-number: QTBUG-95621 Pick-to: 6.2 Change-Id: I0a2ab3976fdbff2e4414df7bdc0808f16453b80a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix test pathsMitch Curtis2021-07-261-1/+1
| | | | | | | | | | In preparation for merging into qtdeclarative Task-number: QTBUG-95173 Change-Id: I0c91c9af85ca63ca8c7f7184d41f299030e12a0e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Restructure tests in preparation for merging into qtdeclarativeMitch Curtis2021-07-226-0/+646
Task-number: QTBUG-95173 Change-Id: I541dc26cf2cdd6f2640824f693f7d059445367d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>