aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols2/qquickcontrol/tst_qquickcontrol.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove "2" from Qt Quick Controls directoriesMitch Curtis2022-12-011-111/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Qt Quick Controls 2 was named that way because it was a follow-up to Qt Quick Controls 1.x. Now that Qt Quick Controls 1 is no longer supported, we don't need to have "2" in the name. Work on this was already started for the documentation in 1abdfe5d5a052f2298b7bf657513dfa7e0c66a56. By doing this renaming a few weeks before feature freeze, it won't affect the release but still results in as little time possible spent manually fixing conflicts in cherry-picks from non-LTS releases as a result of the renaming. This patch does the following: - Renames directories. - Adapts CMakeLists.txt and other files to account for the new paths. A follow-up patch will handle documentation. It does not touch library names or other user-facing stuff, as that will have to be done in Qt 7. Task-number: QTBUG-95413 Change-Id: I170d8db19033ee71e495ff0c5c1a517a41ed7634 Reviewed-by: Mitch Curtis <[email protected]>
* Port from container::count() and length() to size()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <[email protected]>
* Remove warning about inability to defer propertiesFabian Kosmale2022-06-231-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is generally not actionalbe. In QQC2, we mark properties as deferred, so that users can replace them with their own custom elements. We however really don't care about the replacement not being deferrable, as it will be needed in any case (e.g., Control will create its contentItem and background in componentComplete if they do not exist yet). Thus, there is zero gain in ensuring that the replacement is deferrable. There are cases where this is not the case: You might want to create a whole new style, and in turn allow users to override elements there. Or there might be an item where deferring indeed makes sense. However, we cannot distinguish those cases so far, and as long as that is the case, we should not confuse users by complaining about a concept which is mostly engine internal (the only public documentation about deferred properties is https://doc.qt.io/qt-6/qtquickcontrols2-customize.html#considerations-for-custom-styles and that does not mention the word deferred), where fixing the warning might not even given them any benefit. Checking that our standard controls do not prevent deferring is better checked in tst_sanity statically via qmllint. Pick-to: 6.4 Fixes: QTBUG-98964 Change-Id: I030e2a2c2a1d99c9cc6cf0d892e0a1d17e048b6a Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-06-111-27/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <[email protected]>
* QQuickControlPrivate::resizeBackground: preserve geometry bindingFabian Kosmale2022-06-091-0/+18
| | | | | | | | | | | | | | | | | | | | When resizing the background, use setSize instead of setWidth and setHeight to reduce the number of geometryChange calls when both width and height get resized. Additionally, setSize preserves bindings, which fixes the linked bug: We would resize the background even when we have binding on height/width, which would later overwrite the value again. With the porting to bindable properties, the setWidth/Height calls would have destroyed that binding. setSize avoids that issue. Lastly, do not even attempt to overwrite the binding when we detect that it exists. Pick-to: 6.2 6.3 6.4 Fixes: QTBUG-102136 Change-Id: I16a99fd9f7d56f84b423b477d373e265e39d4094 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
* tst_QQuickControl::flickable: prove touch move after pressDelay is OKShawn Rutledge2022-04-111-2/+5
| | | | | | | | | | | | | | | | | This test was added to prove that a control (such as a Button) receives the touch release even when the touch was converted to a mouse event by going through Flickable's delayed press logic. In Qt 6, that replays an authentic delayed touch event; so the test continued to pass. Now we extend it to prove that even if the touch point "wiggles" a little before the release, it's OK: the Control keeps the grab, so it gets the touch release. We are no longer relying on the workaround from 025f938c1b4676782674d54375e1e4e560e4b6cd to compare the press and release positions. Task-number: QTBUG-102036 Task-number: QTBUG-102037 Change-Id: I27b528b4d1180a2557c2c24874e780c26780c4dd Reviewed-by: Mitch Curtis <[email protected]>
* QQuickText: fix fractional pointSize rounding error bugOliver Eftevaag2022-03-021-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The layout is initialized with a copy of the current font before the laying out begins. In cases when setupTextLayout() iterates through the main loop multiple times, it will update the layout font, if it differs. (See code below) if (!once) { if (pixelSize) scaledFont.setPixelSize(scaledFontSize); else scaledFont.setPointSizeF(scaledFontSize); if (layout.font() != scaledFont) layout.setFont(scaledFont); } The whole reason why we might update the font in the first place, is because the QQuickText has a fontSizeMode property which can be set to e.g. HorizontalFit, which will cause the layouting to downscale the font in order to fit (assuming the text doesn't fit the space available), instead of eliding. The problem here is that QFont internally uses a float to store the point size, and we would convert that value to an int when temporarily storing it on the stack. This would modify the pointSize value in cases where the pointSize is fractional, and cause a mismatch between the QQuickText and QTextLayout. The lineWidth is set only during the first loop iteration. During successive iterations of the main loop, the layout's font would be updated to one that has either a floored or ceiled pointSize. If the pointSize is a fractional value, and is ceiled when being updated during the second loop iteration, the layout would use a larger font value, which would cause the QTextLayout::naturalTextWidth() to return a larger value than that of the lineWidth, triggering eliding. Solution: Keep the font precision, by storing the values as floats instead of ints. Fixes: QTBUG-92006 Pick-to: 6.2 6.3 Change-Id: Ibf64ac2dfbf262c6aae05b8eb8251d2f5a869b69 Reviewed-by: Jan Arve Sæther <[email protected]>
* Fix license of tests from LGPL3 to GPL-EXCEPTKai Köhne2021-11-291-17/+9
| | | | | | | | | | | | Autotests in Qt are usually GPL3, or BSD. No point in using the LGPL here. This also gets rid of last references to LICENSE.LGPLv3 in this repository, so we can delete both LICENSE.LGPLv3 and LICENSE.GPLv3, which it references. Change-Id: Idbdefe0c68cc8047ede72b439a4d7ff40dfd71b6 Reviewed-by: Volker Hilsheimer <[email protected]>
* Consolidate test helpers into private librariesMitch Curtis2021-09-131-4/+11
| | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* Restructure tests in preparation for merging into qtdeclarativeMitch Curtis2021-07-221-0/+99
Task-number: QTBUG-95173 Change-Id: I541dc26cf2cdd6f2640824f693f7d059445367d9 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>