summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstringapisymmetry
Commit message (Collapse)AuthorAgeFilesLines
* QStringRef: add missing relational operators against QByteArrayMarc Mutz2016-06-081-3/+0
| | | | | | | | | | | | | | | | | | | | | QStringRef op QByteArray was ambiguous between bool QStringRef::operator op(const char*) const bool operator op(const QStringRef&, const QString&) QByteArray op QStringRef was ambiguous between bool operator op(const QString&, const QStringRef&) bool operator op(const char*, const QStringRef&) Fix by providing more overloads. [ChangeLog][QtCore] Disambiguated the relational operators comparing QByteArray with QStringRef (and vice versa). Change-Id: I1cfa9ecfdd8b4102e652593faf35f6098289bc34 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: fix QChar <> QLatin1String relational operators for non-US-ASCIIMarc Mutz2016-06-081-11/+15
| | | | | | | | | | | | | The implementation used the QString::compare_helper(QChar*, int, char*, int) overload, which, however, interprets the rhs as a UTF-8 sequence, not as Latin-1. Fix by using the (QChar*, int, QLatin1String) overload. Extend the test to cover this case, too. Change-Id: I59b26d63d0caec036b80ef8818c75d0cebe519d2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qstringapisymmetry: cover QByteArray, const char*, tooMarc Mutz2016-06-081-2/+87
| | | | | | | | | As in 032efc2cb20e163a2daf8aef9eb8df2b757d17dc, which added the API-symmetry test, define the missing relational operators locally in the test harness until they are fixed in the library. Change-Id: Ic2688e6b6b3e028a9c29f1a5eb01058375ef3fe9 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QChar: optimize comparison with QString{,Ref}Marc Mutz2016-04-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Instead of relying on the QString relational operators to implicitly convert the QChar to a QString, add relational operator overloads that compare the QChar without first turning it into a QString, saving one memory allocation per comparison, and allowing to mark the operation as nothrow. Consequently, in tst_QStringBinOps, verify now that all relational operations are noexcept. The added overloads make QChar ==/!= int comparisons ambiguous. De-ambiguate by providing a constrained template that matches int and nothing but int (otherwise, the QChar and the int versions would compete for a QChar::SpecialCharacter argument, and end up creating new ambiguities). This solution may not be perfect, but it can be easily extended should more ambiguities crop up. The existing overload deals with all patterns found in qtbase. Change-Id: I4156d918e9b9134c1da684b8b69e0ee526ad24e3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QChar: add missing relational operators against QLatin1String/QStringRefMarc Mutz2016-04-051-22/+0
| | | | | | | | | | | | | | | | | | | | | For QChar <> QStringRef, equality and inequality were already provided (via QChar -> QString implicit conversions, to be fixed in a separate patch). Missing were the less/greater than (or equal) operators. Added. For QChar <> QLatin1String, all relational operators were missing. Added, too. [ChangeLog][QtCore][QChar] Added missing operator{<,>,<=,>=} comparing against QLatin1String and QStringRef. [ChangeLog][QtCore][QChar] Added missing operator{==,!=} comparing against QLatin1String. Change-Id: I9941fe7e7281ea560b3bd5970cb9651ffadc1495 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QStringRef: add missing relational operators against QLatin1String/QStringMarc Mutz2016-03-161-6/+0
| | | | | | | | | | | | | | | | Equality and inequality were already provided. Missing were the less/greater than (or equal) operators. Added. Moved existing functions around and more similar to the new ones, to make the whole code section a bit more manageable. [ChangeLog][QtCore][QStringRef] Added missing operator{<,>,<=,>=} comparing against QLatin1String and QString. Change-Id: Idb3c4fa9b38421637987226f3cc1b77f5d4a6309 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add test for API symmetry of QString/Ref, QLatin1String, QCharMarc Mutz2016-03-153-0/+203
At the moment, only checks the relational operators, where it already found some which do not compile. In order to simplify the test, the missing operators are supplied by the test harness until they are fixed in the library. Change-Id: Ief5daefa68f15de5f8e559c9378ed83b715b69ee Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>