summaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
* a11y: Return correct string information for item viewsIngo Klöcker6 hours1-0/+7
| | | | | | | | | | | | | | | | | This fixes the problem that accessible name was returned as string information for all types of accessible string information (except Description), i.e. Name, Help, Value, Accelerator, etc. This made some screen readers speak the accessible name multiple times when an item view got focus. After 9fa1b691c88a4b928d3c1814a15bcab0e329222e QAccessibleTable is a subclass of QAccessibleWidget(V2) which provides suitable default implementations. Remove the override of the text() getter. Fixes: QTBUG-141051 Change-Id: I443145b97d8546fc6c80689bae50cb896e29cfd1 Reviewed-by: Michael Weghorn <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* a11y: Make QSidebar keyboard-navigableMichael Weghorn6 hours1-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSidebar::selectUrl calls QItemSelectionModel::clear, which clears both, the selection and the current index. After that, it was only setting the selection, but no new current index, i.e. no entry was considered as having focus. As a result, navigating between entries using the keyboard didn't work, because the logic in QAbstractItemView::keyPressEvent/QListView::moveCursor didn't have a valid index to start from and therefore always set focus to the first entry. Fix this by also setting the current index again in QSidebar::selectUrl. Move emission of the QSidebar::goToUrl signal from QSidebar::clicked down into QSidebar::selectUrl to ensure this gets called when the URL/current index is set programatically by calling QSidebar::selectUrl directly instead of indirectly via QSidebar::clicked due to user action. (As an example, tst_QFileDialog2::task251321_sideBarHiddenEntries calls this directly, and the emulated mouse click now no longer triggers the QItemSelectionModel::currentChanged signal as the current index was already set by the previous call to QSidebar::selectUrl, and therefore the connected QSidebar::clicked slot is also no longer triggered.) Adjust the existing tst_qsidebar tests related to the QSidebar::goToUrl signal to the fact that this now gets emitted from QSidebar::selectUrl. (Since QSidebar isn't part of the public API, there's no need to keep the exact semantic of when the signal gets emitted unchanged.) Also switch the test to use PMF-style syntax to e.g. simplify finding those occurences using an IDE's "Find Usages" feature in the future. Fixes: QTBUG-141644 Change-Id: I872698de81912225cd42a5df3752d2693ac6b9ee Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Don't emit QFileDialog::directoryEntered when not changing dirMichael Weghorn6 hours1-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | In QFileDialogPrivate::enterDirectory, return early if the directory to enter is already the current directory. This prevents emitting the QFileDialog::directoryEntered signal when no new directory was actually entered. Extend tst_QFiledialog::directoryEnteredSignal accordingly. This prepares for an upcoming fix for QTBUG-141644 where the fact that QFileDialogPrivate::enterDirectory was called again with the same path resulted in the signal getting emitted twice and therefore causing the existing QCOMPARE(spyDirectoryEntered.size(), 1); check in tst_QFiledialog::directoryEnteredSignal to fail. Task-number: QTBUG-141644 Change-Id: I3359f9f8af3ce03c7b32c040a92d4bf09e065e85 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Http: Set error to 'TimeoutError' for a transfer timeoutMårten Nordheim34 hours1-1/+1
| | | | | | | | | | | | | | | | | | When transferTimeout was added for QNAM it was implemented in terms of calling abort(), which is fine, it does what it needs to do. But it sets OperationCanceledError, which is correct but misleading since it's the same as for a user-initiated abort. [ChangeLog][QtNetwork][QNetworkAccessManager] The error set when a request times out due to QNetworkRequest::setTransferTimeout() has been changed to QNetworkReply::TimeoutError, to disambiguate from the previously used QNetworkReply::OperationCanceledError. Pick-to: 6.10 Fixes: QTBUG-96165 Change-Id: Ibb2f28637f034190fb125630f96aa004c3634fef Reviewed-by: Mate Barany <[email protected]> Reviewed-by: Edward Welbourne <[email protected]>
* Make QTZP::findLongNamePrefix() cope with zones unknown to CLDREdward Welbourne34 hours1-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | The backend may know about zones for which our most recent CLDR update lacked data, for example because one has been added to the IANA database recently, as has happened for America/Coyhaique in release 2025b. Because findLongNamePrefix() was working with a local sui generis type to hold details by which to look up an IANA ID in the CLDR tables, if it found a zone that matched for the locale's region format, it had to find the index of that zone in the tables to fill in the sui generis type's field, even though that was only used to look up the IANA ID later. That lookup failed if the IANA ID wasn't in the CLDR tables. So switch to using a NamePrefixMatch to hold details in the final region format search, so that we can simply store the ID rather than an index that might not exist. Add the new zone that triggered this to test data and fix alphabetic order in its list while I'm about it. Amends commit 2edd9286cf386675be76032424248e60216f6331 (6.10). Pick-to: 6.10 Change-Id: I7c4850f8d368460852c7d19801ee80cf25ccf7e8 Reviewed-by: Thiago Macieira <[email protected]>
* QUtcTimeZonePrivate: use OffsetName rather than ShortName in fallbackEdward Welbourne34 hours1-1/+1
| | | | | | | | | | | | | | | | | | | | | When we don't find the given offset in the utcDataTable[], we fall back on usign isoOffsetFormat(). We've previously been using ShortName, which drops all :00 fields from the name. However, utcDataTable[] gives whole-hour offsets with their minutes field, despite it being :00. Thus a 15-or-16 hour offset was skipping its minutes field (as the utcDataTable[] has no entry for them) but all smaller offsets included their zero minutes field. Make the handling of these outliers more compatible with utcDataTable[] by switching to OffsetName, which still omits the :00 seconds field, for whole-minute offsets, while including the :00 minutes field for whole-hour offsets. [ChangeLog][QtCore][QTimeZone] Fixed-offset zones with non-standard offsets are now named more compatibly with those with standard offsets. This should only be visible for whole-hour extreme offsets (over 14 hours, not used by any real zone since the 1800s). Change-Id: I06eda4f3cb88fb00106aee7ed5b7f499106b51b0 Reviewed-by: Thiago Macieira <[email protected]>
* Break out QTimeZone's testing of internals to a separate test directoryEdward Welbourne34 hours4-771/+821
| | | | | | | | | | | | | | | | Several whole tests depend on feature timezone and QT_BUILD_INTERNAL. Move them out to a separate directory, ready for the addition of more tests of QTZP features used by other parts of core. This should not change what gets tested in any build, it just shifts the decision as to what to test from compile-time to configure-time (and breaks a large chunk out of one compilation unit into another). Some tests mix testing of QTZ with testing of its backend; leave those in the QTZ test, so their public-API tests remain tested also in non-developer builds. Change-Id: I03f173a012aeae5a8bbbc7f29022cc460554afe6 Reviewed-by: Thiago Macieira <[email protected]>
* Android: fix tst_http2.cpp compilation errorRami Potinkara38 hours1-2/+4
| | | | | | | | Fixes: QTBUG-141745 Pick-to: 6.10 Change-Id: I862f078c76cd8f451a9ba3e752df3d0e816539e1 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Assam Boudjelthia <[email protected]>
* Core: Provide non-broken implementation of QVariant{Ref|Pointer}Ulf Hermann2 days1-0/+70
| | | | | | | | | | We need to store the pointed-to value so that it stays stable even if the original is iterated further. Task-number: QTBUG-140181 Pick-to: 6.10 6.8 Change-Id: I59891210577e58f7360019d436b3985b4f9a4cd1 Reviewed-by: Volker Hilsheimer <[email protected]>
* CMake: Add initial Cyclone DX v1.6 SBOM generation supportAlexandru Croitor2 days12-12/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds initial Cyclone DX v1.6 SBOM generation support for CMake-based Qt projects. Cyclone DX generation is enabled by default for all Qt repos, as long as the required Python dependencies are found. If needed, it can be explicitly enabled by configuring the qt repo project with: -sbom -sbom-cyclonedx-v1_6 or a generic CMake project with -DQT_GENERATE_SBOM=ON -DQT_SBOM_GENERATE_CYDX_V1_6=ON. Disabling can be done with -no-sbom-cyclonedx-v1_6 or -DQT_SBOM_GENERATE_CYDX_V1_6=OFF respectively. Note that if the required python dependencies are not found, the generation will be silently skipped. To ensure cmake configuration fails if SBOM dependencies are missing, pass: -sbom-cyclonedx-v1_6-required or -DQT_SBOM_REQUIRE_GENERATE_CYDX_V1_6=ON To ensure the generated document is valid according to the Cyclone DX schema, pass: -sbom-cyclonedx-v1_6-verify-required or -DQT_SBOM_REQUIRE_VERIFY_CYDX_V1_6=ON Cyclone DX generation requires a Python 3.9 interpreter in PATH and the `cyclonedx-python-lib` and 'tomli' Python packages to be installed. The packages can be installed via pip: pip install 'cyclonedx-python-lib[json-validation]' tomli ideally in a Python virtual environment. If using Python 3.11, tomli is not required. If using Python 3.9 or 3.10, and pip is available, the code will try to use the toml library bundled with pip, in which case `tomli` is not required to be installed separately. Generated Cyclone DX documents are installed in the same `sbom` directory under the prefix. For example when building and installing qtbase, the generated Cyclone DX document will be installed to: $qt_prefix/sbom/qtbase-$version.cdx.json The commit title mentions "minimal" Cyclone DX support. Minimal support means that not all features of the equivalent SPDX generation are implemented. List of implemented features: - CMake target information included as Cyclone DX components with information like name, version, supplier, download location, CPE and PURL - attribution information - license information (ids and texts, without OR/AND structure) - dependencies between components in the same document - dependencies between components in different documents List of missing features: - partial license information (pending v1.7 spec support, currently any license expression with a LicenseRef- has its structure lost, so OR and AND gets removed, and the result is just a flat list of license ids and texts) - binary file, source file, and custom file information (unclear if there's a good way to represent these in the spec) - checksums for components, files and sbom documents (also unclear how to represent, because the spec has a 'hashes' key, but it doesn't say what does it apply to) - relationship information (the Cyclone DX spec doesn't support relationships like DEPENDS_ON or CONTAINS, only dependencies) - detailed component types (only application and library are supported currently) - custom added relationship / dependency info - qtwebengine / Chromium enablers - probably other things Implementation details. Cyclone DX doesn't have a tag:value format like SPDX v2.3, so there isn't an easy way to generate Cyclone DX directly in CMake. Instead, an intermediate TOML file is generated in CMake, which is then fed to a custom Python script that generates the final Cyclone DX document in JSON format. TOML is a much easier format to generate in CMake compared to JSON, and is easy to read for humans and to parse in Python. Note that some of the TOML fields are wrapped in literal multi-line strings aka ''' foo ''' rather than non-literal ones, aka """ foo """. That's to avoid the need for escaping backslashes for content like configure arguments in the description field (Windows is notorious for trailing backslashes in paths). The python script is located in util/sbom/cyclonedx/qt_cyclonedx_generator. It is installed into $qt_prefix/libexec so it can be used for other qt repos and projects. Development of the script is done using the `uv` tool and a pyproject.toml project, but `uv` is not required for installation and usage of the script itself. The script parses the TOML file and serializes the Cyclone DX document into the JSON format, while also syntactically validating it. Cyclone DX and SPDX differences. Cyclone DX has the concept of `bom-ref` which is similar to SPDX IDs and SPDX references. We reuse the SPDX ids like SPDXRef-Package-Foo as bom-refs to allow cross-referencing between repo BOM documents, but it also allows easier comparison with the SPDX documents. SPDX mostly operates on the concept of packages and files, whereas Cyclone DX uses components. We map CMake targets to Cyclone DX components. CycloneDX has one notable difference to SPDX. External dependencies whose full BOM is located in a different document, must still be represented as components in the current document, but with an external BOM link, which is why we need to track such components. This is achieved by exporting the spdx id, bom serial number, etc as CMake target properties, to then partially recreate the components in the currently processed document. Note that the QT_GENERATE_SBOM option is now a main toggle for SBOM generation, instead of being specific to SPDX generation. Various other variables that were SPDX v2.3 specific but had generic names have been deprecated, and new ones introduced to make it clearer that they are SPDX specific, and to allow further evolution for SPDX v3 and Cyclone DX 1.7 while being backwards compatible. Adjusted tests to generate SPDX and Cyclone DX SBOMs together, separately, or not at all. And to check for the existence of the installed sbom files. As well as the computed generation options in case dependencies are missing. [ChangeLog][Build System] A new -sbom-cyclonedx-v1_6 configure option can be used to generate and install a CycloneDX v1.6 SBOM (Software Bill of Materials) file for each built Qt repository. Task-number: QTBUG-129598 Change-Id: If20a45083a70b01668f52023053b75f520129381 Reviewed-by: Joerg Bornemann <[email protected]>
* Remove feature conditioning from qtimezone/ testsEdward Welbourne2 days2-9/+17
| | | | | | | | | | | | | | | | | | QTimeZone has existed even without the feature since 6.5 and its testing then added (most of) the needed #if QT_CONIFG(timezone) checks. I missed the CMake config when doing that, though, so its testing was still suppressed when the feature was disabled. This revealed that I'd missed some of the #if-ery needed in its tests, so add what was still missing. As a drive-by, drop one #if-check from the body of specificTransition_data(), since the whole test lies within an outer block conditioned on the feature. Amends commit ae6186c7e8cfdb9420b9119f5affbba7d069598d Pick-to: 6.10 6.8 6.5 Change-Id: I0672e126cb8862563e9222fcf176ca26ac204f31 Reviewed-by: Thiago Macieira <[email protected]>
* a11y: Report editable/readonly state for QAbstractSpinBoxMichael Weghorn2 days1-0/+9
| | | | | | | | | | | | | | | | | | | | Depending on whether a QAbstractSpinBox is readonly, either report QAccessible::State::readOnly or QAccessible::State::editable. Reporting the editable state also prevents the Orca screen reader on Linux from announcing an obsolete cached value when the spin box value changes, as Orca doesn't cache and reuse the text if the object is editable. [1] Extend the existing spinbox a11y test accordingly. [1] https://gitlab.gnome.org/GNOME/orca/-/blob/be3ca7e458291e73c2551b8b575a684462b9ead2/src/orca/generator.py#L1087-1096 Fixes: QTBUG-141245 Pick-to: 6.10 Change-Id: I85011e157df98a4b8735ed5b3c60adbe34a9d950 Reviewed-by: Morten Johan Sørvig <[email protected]>
* Bump MSVC ICE workaround in tests to VS2026Mårten Nordheim2 days2-2/+2
| | | | | | | | It is still failing to compile. Pick-to: 6.10 6.8 Change-Id: I5674fb0fab5ef45b862506aa013cb42041beafcf Reviewed-by: Thiago Macieira <[email protected]>
* Add QDateTime and QTimeZone support to VxWorksKarim Pinter2 days2-5/+6
| | | | | | | | | | | | | VxWorks has ICU and through that the QDateTIme and QTimeZone can be supported. The change modifies the CMakeFile so the qtimezoneprovate_icu.cpp is built on VxWorks. Also changes the necessary ifdefs. Adds TZ=UTC env var to COIN. Fixes: QTBUG-131115 Pick-to: 6.8 6.10 Change-Id: Ib2ffacdb93117e203a0192741e0dc4b62388eada Reviewed-by: Edward Welbourne <[email protected]>
* Fix tst_QComboBox::virtualAutocompletion()Christian Kandeler2 days1-1/+1
| | | | | | | | | Increase waiting time to fix flakiness. Amends 33b153c10429e2e342d7d3f429184e54ca59125e. Fixes: QTBUG-141640 Change-Id: I787270d78abcaf0e06280c10d2535af2d043abac Reviewed-by: Marc Mutz <[email protected]>
* Tests: tst_QGetPutEnv - prepare expected environment for the testsTim Blechmann2 days1-5/+17
| | | | | | | | | | `should_not_exist` should not exist. While we could simply qunsetenv the env, it is safer to generate a unique name that we can use for the tests. Fixes test failure when running unit tests with -repeat Change-Id: Iba9995a28d54c42ff0eebac6e2d482e6a67167c8 Reviewed-by: Thiago Macieira <[email protected]>
* Fix flaky tst_QComboBox::virtualAutoCompletion on Ubuntu 24.04Frederic Lefebvre3 days1-1/+1
| | | | | | | | | | | | | Move QTest::qWait(QApplication::keyboardInputInterval) to after the keyPress event kp3 to ensure the corresponding keyRelease event kr3 has been properly processed. Previously, the QTest::qWait was placed before the kp3, which prevented it from having the intended effect. Pick-to: 6.10 Change-Id: I00797032eca1425e043521890b4be5cd952cd829 Reviewed-by: Richard Moe Gustavsen <[email protected]> Reviewed-by: Mitch Curtis <[email protected]>
* a11y: Set buddies in QFileDialogMichael Weghorn3 days2-4/+4
| | | | | | | | | | | | | | | | | This allows quickly navigating to the combo boxes labelled by the "Look in:" and "Files of type:" labels and makes sure the accessible relations between the label and the comboboxes are set. This makes screen readers like Orca on Linux announce the label texts when the comboboxes receive focus, so the meaning of the comboboxes becomes clear. Update tst_QFiledialog::labelText to include the newly set shortcut keys in the expected label texts. Fixes: QTBUG-141641 Change-Id: I8bc156d5e8d9b337a2a7ff34fe93ff1dda393de9 Reviewed-by: Volker Hilsheimer <[email protected]>
* tst_QComboBox: fix memleak in ignoreWheelEvents()Marc Mutz3 days1-1/+2
| | | | | | | | | | | | | | | | | QWidget::setStyle() does not take ownership of its argument, which also doesn't have a QObject-owner, so creating it on the heap leaks the object. Found by ASAN. Fix by allocating it on the stack instead. Amends 9c966d837fe33b1e32f5e95f29a380dd3063055b. Pick-to: 6.10 6.8 Change-Id: I08cb5a377bb0db34ec38f7c2cef8dfafc31525f7 Reviewed-by: Sebastian Beckmann <[email protected]> Reviewed-by: Volker Hilsheimer <[email protected]>
* tests: QDebug - fix threadSafety for repeated invocationsTim Blechmann3 days1-0/+2
| | | | | | | | | `threadSafety` assumes that the s_messages list is empty. Re-initializing it in the threadSafety prefix code fixes failures with -repeat Change-Id: I67f62fb387c2a548286d0f99ef1194560b815481 Reviewed-by: Tor Arne Vestbø <[email protected]>
* tests: QObject - fix repeated emitToDestroyedClassTim Blechmann3 days1-0/+3
| | | | | | | | | emitToDestroyedClass relies on global static variables. They should be initialized for every invocation to prevent unit test failures with -repeat. Change-Id: Ic7c04567e51c8aa57263d44cc2bbf1a4c8f1fc32 Reviewed-by: Tor Arne Vestbø <[email protected]>
* test: QGlobal - clear state before qCoreAppStartupFunctionTim Blechmann3 days1-1/+1
| | | | | | | | | `qCoreAppStartupFunction` expected that `qStartupFunctionValue` was zero. This is not the case when calling `qCoreAppStartupFunction` multiple times via `-repeat` Change-Id: I12834a6500f10421104c41a82da3cc0822a957d3 Reviewed-by: Tor Arne Vestbø <[email protected]>
* tests: QThreadOnce - tests on repeated invocationsTim Blechmann3 days1-0/+46
| | | | | | | | All QThreadOnce tests can only be executed once per process. Skipping them in repeated invocations fixes test failures with -repeat Change-Id: I72390ad1780a76773a9a8a35186a6fe26d66aa5b Reviewed-by: Thiago Macieira <[email protected]>
* test: QMetaProperty - run readAndWriteWithLazyRegistration only onceTim Blechmann3 days1-0/+7
| | | | | | | | | readAndWriteWithLazyRegistration fails during repeated invocations, because the lazy initialization only occurs once per process. So we skip the test during repeated invocations. Change-Id: Id3c46546c4203528fcf659ab224f9bdc06a670ed Reviewed-by: Thiago Macieira <[email protected]>
* tst_QChronoTimer: fix overflow in chrono durationAhmad Samir3 days1-1/+1
| | | | | | | | | | | | | | | | /usr/include/c++/15/bits/chrono.h:231:38: runtime error: signed integer overflow: -9223372036854775808 * 1000000 cannot be represented in type 'long int' The warning is correct; use nanoseconds::min() instead. Found in an asan build. Amends bd764cc1ca578759f16fbe292fbe14a243b7d263. Pick-to: 6.10 6.8 Change-Id: I2d61fc88c0ded706d1c15c8b95769d8c07cb8329 Reviewed-by: Thiago Macieira <[email protected]>
* tst_QTimer: fix memory leakAhmad Samir3 days1-2/+2
| | | | | | | | | | | | | | | | | | | | | Amends c8d3d7a7af73d97e0415b99df8d8378edb3117f5. Found with ASAN. 31: ================================================================= 31: ==57131==ERROR: LeakSanitizer: detected memory leaks 31: 31: Indirect leak of 200 byte(s) in 1 object(s) allocated from: 31: #0 0x7f605b12273b in operator new(unsigned long) (/lib64/libasan.so.8+0x12273b) (BuildId: cbfe49f3b7600c4f194d4c54774c977296e9d98a) 31: #1 0x7f60548502d5 in QThread::QThread(QObject*) src/corelib/thread/qthread.cpp:429 31: #2 0x7f605485ff24 in QThreadCreateThread::QThreadCreateThread(std::future<void>&&) src/corelib/thread/qthread.cpp:1376 31: #3 0x7f605485bc07 in QThread::createThreadImpl(std::future<void>&&) src/corelib/thread/qthread.cpp:1398 31: #4 0x56094bb83cd5 in create<tst_QTimer::singleShotDestructionBeforeEventDispatcher()::<lambda()> > src/corelib/thread/qthread.h:142 31: #5 0x56094bb66b9e in tst_QTimer::singleShotDestructionBeforeEventDispatcher() tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp:1205 Pick-to: 6.10 6.8 Change-Id: I96341096d6ba2468f1c8dde42d7a97c415986963 Reviewed-by: Giuseppe D'Angelo <[email protected]>
* tests: tst_QLoggingRegistry - guard against test failures with -repeatTim Blechmann7 days1-0/+6
| | | | | | | repeated invocations of QLoggingRegistry_environment seems to fail. Change-Id: Ic54fc06f43339a17e874d4ad0d0308fed393fde5 Reviewed-by: Thiago Macieira <[email protected]>
* Tests: QMetaType - fix tests with -repeatTim Blechmann7 days3-10/+32
| | | | | | | | | | | convertCustomType_data / customDebugStream can only be called once, since register converters globally. tst_QMetaType::properties used to mutate the tst_QMetaType object. Introducing a separate object that can be used for testing helps with the separation between test runner and system under test Change-Id: I0b059cfd0c9eb8c7c40f196990be076f11dab0c4 Reviewed-by: Thiago Macieira <[email protected]>
* QLibrary: expose QLibraryPrivate::unload to autotestsTim Blechmann8 days3-3/+11
| | | | | | | | | | | | | tst_QLibrary::cleanup did not have any effect, as QLibrary::unload does not unload anything, if the library has not been loaded via this instances. There is no public API to "attach" a QLibrary instance to a library. Exposing QLibraryPrivate::unload will allow us to unload libraries that the unit tests might be leaking. Pick-to: 6.10 Change-Id: I0ac32ac5dcf681f117e88890eb529000b7d583e6 Reviewed-by: Thiago Macieira <[email protected]>
* tst_QVariant: fix Clang -Wunused-const-variableMarc Mutz8 days1-1/+0
| | | | | | | | | Amends 42e0f9811095fc73c5c1209632247446e6229b3a, which removed the (last) user of the variable. Pick-to: 6.10 6.8 6.5 Change-Id: If8fa5150cc936ddda2bdccb9d7e400c631831e3a Reviewed-by: Ahmad Samir <[email protected]>
* a11y: Fix cursor-based text{Before,After}OffsetMichael Weghorn8 days1-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, qt_accTextBeforeOffsetHelper and qt_accTextAfterOffsetHelper (used by QAccessibleTextWidget and QAccessibleQuickItem) were not consistently returning text items of the given boundary type that is completely *before* or *after* the given index, but could e.g. return the word in whose middle the offset is when using QAccessible::WordBoundary. This could for example break an assistive technology feature of navigating through a text by word if it relies on those methods. Adjust the implementations to prevent that from happening, by calling QAccessible::qAccessibleTextBoundaryHelper again with an index moved by one character until either a result before/after the given index is returned or the start/end of the text has been reached. Extend the existing QTextEdit a11y test by a few cases that would previously fail. (Note: Depending on the text granularity used, not every character in the text is necessarily considered part of any text item: E.g., when using QAccessible::WordBoundary, space characters in between words are not, at least not for the QTextCursor logic as used in QTextEdit or qtdeclarative's QQuickTextEdit). Fixes: QTBUG-140504 Task-number: QTBUG-139943 Change-Id: Ie6f0f2b2579237f42964d2498c818d1f02bf4bb8 Reviewed-by: Morten Johan Sørvig <[email protected]>
* a11y: Don't assert on text existing before indexMichael Weghorn8 days1-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | As the QAccessibleTextInterface::textBeforeOffset doc says: > Returns the text item of type boundaryType that is close to offset > offset and sets startOffset and endOffset values to the start and end > positions of that item; returns an empty string if there is no such an > item. Sets startOffset and endOffset values to -1 on error. Therefore, return an empty string and set indices to -1 if there is no text item of the given boundary type before the given index in QAccessibleTextInterface::textBeforeOffset instead of asserting, since this is a valid result and this code path can e.g. get called by platform a11y bridge implementations like the one for the AT-SPI Text interface's GetTextBeforeOffset method. Extend the existing QLineEdit a11y test accordingly. Fixes: QTBUG-140467 Pick-to: 6.10 6.9 6.8 Change-Id: Ibc8d7b4f65ae7787cad8eeebc85b99fd0fb43503 Reviewed-by: Timon Sassor <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
* tst_QVariant: fix unit tests for repeated invocationsTim Blechmann9 days1-4/+22
| | | | | | | | | * some tests reference stack variables, leading to stack-use-after-scope * some tests perform metatype registrations, which fail the second time the test is invoked Change-Id: Icaeef15adebedc547cbe6a4150fa0584bcb4f4bc Reviewed-by: Thiago Macieira <[email protected]>
* Test: QParallelAnimationGroup - increase timeoutTim Blechmann9 days1-6/+7
| | | | | | | | | | | | deleteChildrenWithRunningGroup has an 80ms timeout. This does not seem to be enough when running the tests with -repeat 2 -recreate-app-instance. Also silencing some warnings about extra semicolons. Pick-to: 6.10 Change-Id: Ibc42f82eaa5db9145a2843eda044e6a49a43222c Reviewed-by: Thiago Macieira <[email protected]>
* Tests: QCommandLineParser - clean up test caseTim Blechmann9 days1-0/+6
| | | | | | | | implement cleanupTestCase to be symmetric with initTestCase. This fixes an assertion failure when calling the test with -repeat Change-Id: I4162e4c6a1088f62a9ca097791ea8ac030f3ad5a Reviewed-by: Thiago Macieira <[email protected]>
* tst_QHeaderView: remove unused static istr()Marc Mutz10 days1-9/+0
| | | | | | | | | | Amends 3692f14a3000ead3e92cf6fa63cb8b9b3250e6ef, which removed the last callers. Pick-to: 6.10 Change-Id: Iaf78024a70623a7dc47516cd87f4552bdbbf3d1c Reviewed-by: Christian Ehrlicher <[email protected]> Reviewed-by: Thorbjørn Lund Martsum <[email protected]>
* tst_Collections: fix Clang -Wuninitialized-const-pointerMarc Mutz10 days1-2/+2
| | | | | | | | | | | | | | | | | Says Clang: tst_collections.cpp:661:22: warning: variable 'i' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer] 661 | list.append(&i); | ^ Fix by initializing the variables. The test does not depend on the `i`s to be uninitialized, so this will change nothing, except execute a bit slower and throw no warning. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: I8e8b36be484eefc6a18cf9b2d9a0c504b324aef8 Reviewed-by: Ahmad Samir <[email protected]>
* tst_QFileDialog2: fix -Wunused-functionMarc Mutz10 days1-0/+1
| | | | | | | | | | | | | | | These days, the msgDoesNotExist() function is only called from Q_OS_WIN-scoped code, prompting -Wunused-function on non-Windows platforms. To fix, add [[maybe_unused]]. The alternative, #fidef Q_OS_WIN, has the disadvantage of limiting compiler coverage of the function. Amends 7432082333294091a88f9dd8b84d8fd10f68b10a, which moved the last caller into a Q_OS_WIN scope. Change-Id: I3895a6974d767c76ebd1d0a8c78adddde2a5abc1 Reviewed-by: Thiago Macieira <[email protected]>
* Narrow eccentric usage of QLocale::FormatType to one compilation unitEdward Welbourne10 days1-1/+1
| | | | | | | | | | | | | | | | | In qtimezonelocale.cpp some functions use QLocale::FormatType with a locally-defined eccentric meaning. I'd made the mistake of letting that infect a QTimeZonePrivate method's signature, even though its callers only ever passed NarrowFormat and its name said it was for narrow usage. I managed thereby to mislead myself as to what it would do for other format types. Instead, drop this parameter, pass NarrowFormat to an internal helper of the implementation where the argument was previously passed, and save the two callers and the stub implementation from carrying a misleading distraction. Amends commit d13e9a1ae53ee53c4929bc88d578a02eec4b2dc4 Change-Id: I819a87a1b04f6509adffc66bd2c81150667b208a Reviewed-by: Thiago Macieira <[email protected]>
* QUnicodeTools: don't look up surrogate line-break propertiesMarc Mutz10 days1-0/+12
| | | | | | | | | | | | | | We know they're SG, so don't go through the properties trie, hard-code the result. As a defense against changes, add checks to the generator and tst_QUnicodeTools. This is in preparation of porting getLineBreaks() to QStringIterator. Pick-to: 6.10 6.8 6.5 Change-Id: Ib3567398ba56f7ad3ce6fbca81f6b0f40379ee7d Reviewed-by: Mårten Nordheim <[email protected]>
* a11y: Report QAbstractSlider orientationMichael Weghorn11 days1-0/+5
| | | | | | | | | | | | | | | | Support QAccessible::Attribute::Orientation newly introduced in a previous commit in QAccessibleAbstractSlider, the accessible implementation for QAbstractSlider. This e.g. makes the orientation available for QScrollBar. Extend an existing QScrollbar accessibility test accordingly. Fixes: QTBUG-140769 Change-Id: I8ac32116ed175b3b6760e5d1577e78180849e0e7 Reviewed-by: Volker Hilsheimer <[email protected]> Reviewed-by: MohammadHossein Qanbari <[email protected]>
* QSaveFile: add std::filesystem::path supportThiago Macieira11 days1-0/+39
| | | | | | | Fixes: QTBUG-141433 Change-Id: I8fbc9a78026237e0e823fffd1760cff3adf0bd40 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
* tests: build qrangemodel test only if Gui is availableSamuli Piippo11 days1-1/+1
| | | | | | | | The test has dependency to Qt::Gui. Pick-to: 6.10 Change-Id: I0dc0b113291439803f5968cee21b72330b76bf9e Reviewed-by: Thiago Macieira <[email protected]>
* QStringIterator: add nextOrRawCodeUnit()Marc Mutz11 days1-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While fixing Clang 21 -Wcharacter-conversion warnings, I came across many code snippets that used a pattern like char32_t ucs4 = string[i]; if (QChar::isHighSurrogate(ucs4) && i + 1 != len) { ushort low = string[i + 1]; if (QChar::isLowSurrogate(low)) { ucs4 = QChar::surrogateToUcs4(ucs4, low); ++i; } } (this one from qunicodetools.cpp) The natural question is why this was never ported to QStringIterator, and the answer is: because QStringIterator doesn't support this. Add new functions nextOrRawCodeUnit() (and previousOrRawCodeUnit()), to fix this shortcoming. The name of the functions is chosen so that it will work also in a future UTF-8 string iterator. Add tests that verify that the old code and the new functions produce the same series of code points. Pick-to: 6.10 6.8 6.5 Change-Id: I34ba8e416ee290badc1c16e33b46a17d56741574 Reviewed-by: Ahmad Samir <[email protected]> Reviewed-by: Thiago Macieira <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]>
* Add test for focus chain when reparenting *within* the same hierarchyJan Arve Sæther11 days1-18/+77
| | | | | | | | | | | | | | For the record, focus chain is not affected by reparenting within the window. Qt docs says: "Tab generally moves focus in the order of widget construction" (The exception is when a widget is moved to a separate QWidget-tree (usually another window). This is already covered by the tst_QWidget::focusChainOnReparent() autotest) Change-Id: I6312b86bb81307ba11a40b6c303364056bd3d714 Reviewed-by: Richard Moe Gustavsen <[email protected]>
* Remove redundant calls in tst_QWindow::enterLeaveOnWindowShowHideFrédéric Lefebvre12 days1-1/+0
| | | | | | | | | | | | | tst_QWindow::enterLeaveOnWindowShowHide include multiple calls to requestActivate() after a window is shown. This call is superfluous for the current test and should be removed. Remove the unnecessary requestActivate() calls to simplify the code. Amends 79ac43053798763828d51c79f6368465b1db1c87. Task-number: QTBUG-139705 Pick-to: 6.10 6.8 6.5 Change-Id: I69549e67ce621d5e933d3049491be28062cc4993 Reviewed-by: Volker Hilsheimer <[email protected]>
* Remove redundant calls in tst_QFocusEvent to requestActivateFrédéric Lefebvre12 days1-2/+0
| | | | | | | | | | | | | tst_QFocusEvent::checkReason_ActiveWindow include two calls to requestActivate() after a window is shown. These calls are redundant as show() already activates the windows. Remove the unnecessary requestActivate() calls to simplify the code. Task-number: QTBUG-139705 Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I978bec6cae5a297afc0a200af55d11caa7c74815 Reviewed-by: Axel Spoerl <[email protected]>
* QByteArray: percentDecoded/fromPercentEncoding: add rvalue overloadsAhmad Samir12 days1-0/+7
| | | | | | | | | | | | | | For the rvalue overload the changes are done in-place unless the byte array is shared, in which case the changes are written to a new array to prevent detaching. One immediate beneficiary of this overload is qDecodeDataUrl(). [ChangeLog][QtCore][QByteArray] Added rvalue overloads of percentDecoded() and fromPercentEncoding(). Change-Id: I2aadfbf93f06a72460ec04692355f73a6c892e30 Reviewed-by: Thiago Macieira <[email protected]>
* tst_qgraphicsview: Make testdata names uniqueChristian Ehrlicher14 days1-51/+43
| | | | | | | | | | | Make the names of the data for the tests unique to avoid runtime warnings. Also make sure the widget is really visible in some tests by waiting with QTest::qWaitForWindowActive() Task-number: QTBUG-141079 Pick-to: 6.10 6.8 Change-Id: Ia50a6f2a46a3d2e0651124167111644019304aad Reviewed-by: Axel Spoerl <[email protected]>
* Add macOS backend for QRandomAccessAsyncFileIvan Solovev2025-10-241-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The backend uses Grand Central Dispatch to perform async IO. One complication is that the GCD APIs do not allow to cancel a signle IO read/write operation, instead it's only possilbe to close the related IO channel. Luckily, it's possible to have multiple IO channels referencing the same file descriptor. As a result, we end up duplicating IO channels for each async operation, which makes the code a bit more complicated. The implementation uses QWaitCondition to make sure that the async operation is completed or canceled before removing the relevant QIOOperation or QRandomAcessAsyncFile instance. Another tricky part was the implementation of flush(). The docs for dispatch_io_barrier claim that it applies to a file descriptor, not a specific channel, and thus acts as a barrier across all channels that share the same file descriptor. However, in practice it does not work! As a result, the patch implements an operation queue, and schedules the barrier operations only when all previous operations are completed. Similarly, no new operations are scheduled until the barrier operation is completed. The same logic is applied to the async open() operations that are also considered to be barrier operations. Fixes: QTBUG-139005 Change-Id: Iac448d9460c64dd18dc3b15fc13d5145895a3c3b Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>