summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qanystringview/tst_qanystringview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QAnyStringView: use new comparison helper macrosIvan Solovev2024-03-021-37/+90
| | | | | | | | | | | Also extend unit-test to use new test helper functions. Remove the now-redundant test for three-way comparison, because it is covered by the test helper functions. Task-number: QTBUG-117661 Change-Id: I242b560c281245e04e34353c80000a20998fc677 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Bring back QASV::detects_US_ASCII_at_compile_timeIvan Solovev2024-03-011-5/+3
| | | | | | | | | | | | | | Even though undocumented, it's public API, doesn't hurt to carry along, and improves compiler coverage in the test, so let's not remove it. Found in 6.7 API review Amends 95e6fac0a5a1eee3aa23e4da0a93c6c25e32fb98. Pick-to: 6.7 Change-Id: Ia935036a69e0e678f22ac86b48a2c1c5e8c46733 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* QAnyStringView: fix construction from QL1SV for bootstrapped buildsIvan Solovev2023-09-031-0/+28
| | | | | | | | | | | | | | | | | The SizeShift was not taken into account when constructing QASV from QL1SV. This is not an issue in normal Qt builds, because SizeShift == 0 there. But in bootstrapped case (and in future Qt 7) SizeShift changes to 2, and the bug becomes visible. The added test-cases do not really reveal the issue, because we do not run tests in bootstrapped builds, but at least they will help to prevent the issues in Qt 7. Pick-to: 6.6 6.5 6.2 Change-Id: I337b37b5230323a5357f48fd1c9bf799ca507d52 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAnyStringView: add QDebug stream operatorMarc Mutz2023-07-061-0/+73
| | | | | | | | | | | | | | | | When QDebug::quoted(), indicates the encoding using the u/u8 prefixes or the _L1 suffix. This is information that might come in handy, and we plan to make it off-switchable (QTBUG-114936). The default should be true, though, for QAnyStringView, because we should confront users with this feature so they learn it exists. For concrete view types, changing the default behavior is probably not a good idea. [ChangeLog][QtCore][QAnyStringView/QDebug] Can now stream QAnyStringView into QDebug. Fixes: QTBUG-114935 Change-Id: Icd5bf700c8b7958e942468b54248487998f262d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QAnyStringView: test some longer strings and some containing nullsThiago Macieira2023-06-131-35/+102
| | | | | | | | Change-Id: Ieab617d69f3b4b54ab30fffd175c9cbb4f5d19b9 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Short-live qIsConstantEvaluated()Thiago Macieira2023-06-111-1/+5
| | | | | | | | | | | | | | This is not q20::is_constant_evaluated() because it does not replace that for all compilers. Instead, it's our own version of it that may return false even in constant contexts. However, for the majority of our users, it will work even in C++17 mode. Updated QStringView and QAnyStringView to use it, which are the only two places in all of Qt that used std::is_constant_evaluated(). Change-Id: Ieab617d69f3b4b54ab30fffd175c50c517589226 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QAnyStringView: fix warning of unused variable by using itThiago Macieira2023-05-121-1/+3
| | | | | | Pick-to: 6.5 6.2 Change-Id: Ieab617d69f3b4b54ab30fffd175c78ddb5fb919d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* tst_Q(Any)StringView: check conversion from winrt::hstringMarc Mutz2023-03-311-0/+16
| | | | | | | | | | | | | | | | Instead of adding more QString::fromMyFavoriteStringImpl(), just check that QStringView{myFavoriteStringImpl}.toString() works. It does. Pick-to: 6.5 Task-number: QTBUG-111886 Change-Id: I337282611360b4a56a10c8acfd2d7d53ea196d5b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make XmlStringRef convertible to QAnyStringView/QStringViewMarc Mutz2022-11-291-0/+3
| | | | | | | | | | | | | | | | | Both QStringView and QAnyStringView implicitly convert from any container with a fitting value_type, and working std::data, std::size, std::begin and std::end. Add these missing operations (and complementary ones) to XmlStringRef, so it implicitly converts to QStringView and QAnyStringView, too. Add a check to that effect and remove the now-superfluous operator QStringView(). Task-number: QTBUG-103302 Change-Id: I89d586cf64447a82022e06d546d7ee8339fc6dc7 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QAnyStringView: construct from any T implicitly convertible to ↵Marc Mutz2022-09-011-0/+10
| | | | | | | | | | | | | | | | | | | | | QString/QByteArray This includes QDBusReply, QProperty, and QStringBuilder expressions. The new constructor subsumes the QStringBuilder case without requiring jumping though hoops to delay the definition of the ctor the way we had to for the explicit QStringBuilder constructor, so remove the explicit QStringBuilder one again. [ChangeLog][QtCore][QAnyStringView] Can now be constructed from anything that implicitly converts to either QString or QByteArray. Fixes: QTBUG-105389 Change-Id: I0e584dd3e20d591381609a3329ef47cec7356ecc Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* tst_QAnyStringView: explicitly check the spaceship operatorMarc Mutz2022-06-141-0/+31
| | | | | | | | | | | | | | | We implicitly checked it, because, in C++20 builds, the non-equality relational operators are synthesized from it by the compiler, and we test those, but we didn't check that <=> returns strong_ordering. We now do. Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104108 Change-Id: Ieb19a2d4cb2d600d884f4e2e89e98c6187e23872 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-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. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Replace uses of _qs with _s in testsSona Kurazyan2022-04-071-1/+3
| | | | | | Task-number: QTBUG-101408 Change-Id: If092a68828a1e8056259cf90d035d9a87989244b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QAnyStringView: constexpr detect 8-bit ASCII as Latin 1Øystein Heskestad2022-03-211-0/+22
| | | | | | | | | | This has performance benefits when doing comparisons. The check is only performed at compile time. Task-number: QTBUG-101014 Change-Id: I55694b045fe5e75d9671d0a3a70c80d998cf98c8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Short live q20::ssize()!Marc Mutz2021-11-201-13/+1
| | | | | | | | | Extract the definition of q20::ssize() from tst_qanystringview.cpp, where it had to be placed for its backport to 6.2. Change-Id: I3f758c98a4b1efd453f4fc044b8d3f1a89de62d1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QAnyStringView: fix broken implicit conversion from QStringBuilderMarc Mutz2021-11-191-0/+18
| | | | | | | | | | | | | | Need to use QConcatenable<>::ConvertTo for SFINAE, the forwarded type alias in QStringBuilder itself doesn't work. [ChangeLog][QtCore][QAnyStringView/QStringBuilder] Implicit conversion from QStringBuilder to QAnyStringView now works as advertised. Pick-to: 6.2 Fixes: QTBUG-98138 Change-Id: I1c300675cf43b13017bc56398ae5d8c1c51e64fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add an initial tst_QAnyStringViewMarc Mutz2021-11-181-0/+628
It's incomplet, but at least something. Task-number: QTBUG-98138 Pick-to: 6.2 Change-Id: I4630a44b62b190dee8a8cc07822dd6ec67dbdc84 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>