summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring
Commit message (Collapse)AuthorAgeFilesLines
* Re-enable casting to and from "ASCII" on tst_qstring.cppThiago Macieira2012-04-281-33/+13
| | | | | | | | | | Turns out that we've had some old unit tests commented out that did not compile. QString does not have a std::string constructor nor overloads to many other methods. And std::string does not cast to char* on its own. So these tests need to be removed. Change-Id: I22df66fc3ccc68bc2840f2d83747234418e480f5 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Force tst_qstring to use fromLatin1 where it has Latin 1 literalsThiago Macieira2012-04-271-37/+39
| | | | | Change-Id: I941d20733da2987ca7ced14c314adebaf6a431f6 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesOswald Buddenhagen2012-04-101-0/+9
|\ | | | | | | | | | | | | | | | | | | Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
| * Fix some compiler warnings in tests.Friedemann Kleint2012-03-271-0/+9
| | | | | | | | | | | | | | | | - Unused variables - Deprecated conversion from const char * to char *. Change-Id: Iea0b9c4613ea74cead6d95ba12ad1028f531cbff Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* | Remove references to QT_NO_STL from QtCoreThiago Macieira2012-04-071-8/+0
| | | | | | | | | | | | | | | | QT_NO_STL is now no longer defined, so remove the conditionals and select the STL side. Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* | Add test for qHash(QString) / qHash(QStringRef)Giuseppe D'Angelo2012-04-061-0/+8
| | | | | | | | | | | | | | Two equal strings / stringrefs must return the same hash. Change-Id: I2af9a11ab721ca25f4039048a7e5f260e6ff0148 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add zero-termination checks to QString and QByteArray testsJoão Abecasis2012-04-051-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses an alternative approach to the testing formerly introduced in 4ef5a626. Zero-termination tests are injected into all QCOMPARE/QTEST invocations. This makes such testing more thorough and widespread, and gets seamlessly extended by future tests. It also fixes an issue uncovered by the test where using a past-the-end position with QString::insert(pos, char), could move uninitialized data and clobber the null-terminator. Change-Id: I7392580245b419ee65c3ae6f261b6e851d66dd4f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* | QRegularExpression: support for QString overloadsGiuseppe D'Angelo2012-03-151-27/+83
| | | | | | | | | | | | | | | | Added support for QString overloads taking a QRegularExpression. Change-Id: I8608ab0b66e5fdd2e966992e1072cf1ef7883c8e Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix QString:mid and midRef, againJoão Abecasis2012-03-121-8/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 75286739 it was assumed that negative positions shouldn't influence the size of the returned substring. That however changes behaviour that was depended on even inside Qt. With this change, the old behaviour is reestablished. A negative value of n is still taken to mean "all the way to the end", regardless of position, and overflows are still avoided. Change-Id: I7d6ed17cc5e274c7c7ddf0eb0c3238e1159ec4f6 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-10/+1
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * Remove ARMFPA support and Q_DOUBLE_FORMAT detectionBradley T. Hughes2012-03-011-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the -armfpa option the config.tests/unix/doubleformat* detection. The places where we used QT_ARMFPA and Q_DOUBLE_FORMAT has been removed as well. Rationale: ARM FPA with GCC does not work with EABI. Qt currently does not support compiling without EABI, making ARM FPA an impossibility. It is unknown whether other compilers provide ARM FPA support with EABI. Support for ARM FPA can be re-added in the future should the need arise, but since ARM VFP is available for ARMv5 and up, we should encourage implementors to instead use soft-floats or VFP. Change-Id: I3671aba575118ae3e3e6d769759301c8f2f496f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-291-16/+2
|\| | | | | | | Change-Id: I97ba222435ff50a9e5422e6f2c73e4bb8d1b865c
| * Remove custom text codec for C strings.Robin Burchell2012-02-221-16/+2
| | | | | | | | | | | | | | | | | | | | This setting is extremely harmful, as code cannot know whether or not to expect it. It also made the behaviour of QString::fromAscii and ::toAscii unintuitive, and caused a lot of people to make mistakes with it. Change-Id: I2f429fa7ef93bd75bb93a7f64c56db15b7283388 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Change meaning of offset in QStringDataJoão Abecasis2012-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It used to be an index into the first element in 'd' that came after 'offset'. It is now the byte offset from the beginning of the QStringData structure. By no longer using an actual array to access characters, we also steer clear of GCC bug #43247: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247 This aligns this data structure with QArrayData. The intention is to have QVector, QString and QByteArray share the same memory layout and possibly code. Change-Id: I4850813e1bd47c3cb670c50c9a8ccc1bff2e8597 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-211-29/+29
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h Change-Id: I03b1f3e05c9b7a45130887c522fcd9b7aa387129
| * Eliminate duplicate data row names from corelib autotests.Jason McDonald2012-02-141-29/+29
| | | | | | | | | | Change-Id: I57a37f19746b76c6c9c3534f5c66c5a5478dae24 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Fix and simplify QString::midJoão Abecasis2012-02-141-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'position' was being used to initialize 'n' before being fully validated. To compensate for this, the code attempted to fix 'n' once 'position' was found to be invalid (negative). This would, however, also attempt to "fix" a perfectly valid value of 'n'. By fully validating 'position' beforehand we avoid this trap and can safely use it to validate and reset 'n', as needed. Arithmetic for boundary conditions of 'n' was rearranged to avoid triggering integer overflow. Removed explicit check for shared_null, as the same behaviour can be supported without it. Change-Id: Ie9bff7b8137a74f55c7dcfe629bd569045e28f3c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-052-153/+234
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
| * QString: Make convert to number methods only use C localeJohn Layt2012-02-051-149/+88
| | | | | | | | | | | | | | | | Ensure consistent conversions by not using the system default locale. Change-Id: I60db9fc4f465c0254f3213419e57d7879aaddd65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Fix QString::operator=(QLatin1String) for substringsKent Hansen2012-02-021-0/+23
| | | | | | | | | | | | | | | | | | QLatin1String now has a constructor that takes explicit length, which makes it possible to create a QLatin1String that isn't null-terminated. Made QString::operator=(QLatin1String) work in that case. Change-Id: Ie77eabd2f8f036531d67cd8051a7b6305b386ccf Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Fix QString(QLatin1String) constructor for substringsKent Hansen2012-02-021-0/+9
| | | | | | | | | | | | | | | | | | QLatin1String now has a constructor that takes explicit length, which makes it possible to create a QLatin1String that isn't null-terminated. Made the QString(QLatin1String) constructor work in that case. Change-Id: I4f4f07a956144b7ea4aa9c58a61c755fb99ef1b3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Fix operator==(QLatin1String, QLatin1String) and friends for substringsKent Hansen2012-02-021-0/+83
| | | | | | | | | | | | | | | | | | QLatin1String now has a constructor that takes explicit length, which makes it possible to create a QLatin1String that isn't null-terminated. Made the QLatin1String comparison operators work in that case. Change-Id: I234ba851e67a6f5cfbb46fb6f0b22623ce40be28 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Fix bugs when using a non 0 terminated QLatin1StringLars Knoll2012-01-301-0/+7
| | | | | | | | | | | | | | | | | | | | A few methods in QString still assumed that QLatin1String is always 0 terminated. Change this to rely on the size provided by QLatin1String instead. Change-Id: I9145a46e52ed8811f3b4e3d72d8a81a12588760a Reviewed-by: Kevin Simons <kevin.simons@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Remove "All rights reserved" line from license headers.Jason McDonald2012-01-302-2/+2
| | | | | | | | | | | | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
| * Fixed QString::operator<(QLatin1String)Denis Dzyubenko2012-01-261-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QLatin1String now has a constructor that takes explicit length, which makes it possible to create QLatin1String that do not have null-termination character. Fixed QString::operator> and < to be safe in that case. In the same patch fixed qtjson which had operator< implemented in the same way. QString::compare(QLatin1String) is still broken and will be fixed separately. Change-Id: I48ec1183a6f44034129cc17312af854795085408 Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Make mid() and midRef() properly return empty, non-null objectsGiuseppe D'Angelo2012-01-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | If we request a substring starting at the very end of the string, QString::mid should return an empty string, not a null string. For instance, QString("abc").mid(3, 0) used to return a null one, while this patch makes it return an empty one. The same thing applies to QString::midRef() and QByteArray::mid(). Change-Id: Ie9efd7a0622d429efd0fb682c19856c19e9469af Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * Update contact information in license headers.Jason McDonald2012-01-232-2/+2
| | | | | | | | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Don't use RefCount int operatorsJoão Abecasis2012-01-241-1/+1
|/ | | | | | | The previous patch missed this, which was hidden inside #ifdefs. Change-Id: Iba1417d4191b6931afb549022768f3e3a2cf727d Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-052-2/+2
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* add tests and benchmarks for QString::toLower()/toUpper()/toCaseFolded()Konstantin Ritt2011-12-251-5/+87
| | | | | | | | | Merge-request: 70 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Change-Id: I3929d4d8963c3cef6d2c6420d8ad1f7a45f7e042 Reviewed-by: Olivier Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove QT_NO_STL_WCHAR hackHarald Fernengel2011-12-221-7/+1
| | | | | | | We don't support gcc 2.95 any more. Change-Id: I842f1f8ac64b9006516c104add0991830ac9a46a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove TESTED_CLASS/TESTED_FILES comments from tests.Jason McDonald2011-12-061-3/+0
| | | | | | | | | These comments were mostly empty or inaccurate. Appropriate naming of tests and appropriate placement of tests within the directory tree provide more reliable indicators of what is being tested. Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improve QString autotest.Jason McDonald2011-12-011-8/+7
| | | | | | | | | | | | | | | The QString autotest shares test data between the remove() and replace() tests because those functions are very similar. Unfortunately, when an integer overflow bug was found in remove() the regression test was not shared with replace(), which prevented the same integer overflow bug from being discovered in replace(). This commit improves the test by sharing the overflow test data between both functions, thus demonstrating the remaining bug. Task-number: QTBUG-22967 Change-Id: I2778249800f74799d890eefa9227ca8ddd8fbaa3 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-301-20/+18
| | | | | | | | Remove references to the old bug tracker. The data from the old bug tracker is no longer accessible, so these markers are meaningless. Change-Id: Ib9d029d52b70fd0a512b9532d65f03763eabfe57 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-251-4/+4
| | | | | | | | | | Bug trackers come and go, so using bug identifiers in function and test case names will ensure that those names eventually become meaningless. It is better to choose a meaningful name and provide explanatory comments where appropriate. Change-Id: I67c27782ef21b5d4eaab4854079a043c8ef6957b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Restore commented-out data in QString test.Jason McDonald2011-11-221-2/+2
| | | | | | | | | The restored test data was commented-out before the tests were imported into the Qt repository in 2006, but appears to be valid and passes on Linux. Change-Id: I75795bf2b0b45fc2331bca6ac8d89f57cf12ed3d Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* qtbase tests: Fix some warningsFriedemann Kleint2011-11-211-5/+4
| | | | | | | | - Fix warnings about QAtomicPointer/Int usage - Fix some gcc 4.6 warnings about assigned/unused variables Change-Id: Ib4dbf9110f0dad93ad48e97278310f05fad3a82a Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't depend on moc to disable test functions.Jason McDonald2011-11-181-29/+31
| | | | | | | | | | | | | | | | | | | | | The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-111-6/+2
| | | | | | | | | | | | | Tidy the autotest .pro files. Most autotest .pro files should look like this: CONFIG += testcase TARGET = tst_something QT = core testlib SOURCES = tst_something.cpp Change-Id: I877c2194e9fa9dd13478d117895e1e255a948ad7 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-101-198/+196
| | | | | | | Remove literal tabs. Change-Id: I210a0259773cceb20d35ebc80b889e3ebb88b540 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-071-13/+0
| | | | | | | Remove redundant empty constructors, destructors and test functions. Change-Id: Idb51368895e67ec3fc0345a9a5d33d77730c051b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove disabled code from QString autotest.Jason McDonald2011-10-311-49/+0
| | | | | | | | | The removed code was disabled before the tests were imported into the Qt repository in 2006, so its meaning or usefulness is lost in the mists of time. Change-Id: I3108a1a1d86cd135886608f47dcd88bf49f2d3fd Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Doc: Fixing typoSergio Ahumada2011-10-261-1/+1
| | | | | | | Fix typos I was able to find in `tests/auto' directory. Change-Id: Id0bfcc18301381ac8b1ca8d5af17bd926e5913d4 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* corelib: eliminated usage of qttest_p4.prfRohan McGovern2011-10-251-2/+3
| | | | | | | | | qttest_p4.prf was added as a convenience for Qt's own autotests in Qt4. It enables various crufty undocumented magic, of dubious value. Stop using it, and explicitly enable the things from it which we want. Change-Id: I7c1ffe9c8c294dbdc988e1582e580b1ed3f4593e Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Remove SkipMode parameter from QSKIP calls.Jason McDonald2011-10-211-4/+2
| | | | | | | | | The previous commit removed SkipMode from the testlib APi. This commit removes the parameter from all calls to QSKIP. Task-number: QTBUG-21851, QTBUG-21652 Change-Id: I21c0ee6731c1bc6ac6d962590d9b31d7459dfbc5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Avoid using QSKIP in lieu of compile-time checksJason McDonald2011-10-071-4/+2
| | | | | | | | | | | | | | | | QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: I95feba3edbfa092c0ef4d85bb8c6877bd6be698e Reviewed-on: http://codereview.qt-project.org/6128 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Avoid using QSKIP in lieu of compile-time checksJason McDonald2011-10-051-31/+29
| | | | | | | | | | | | | | | | QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9 Reviewed-on: http://codereview.qt-project.org/5942 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Tests: Fix compilation on Windows.Friedemann Kleint2011-10-031-3/+3
| | | | | | | | | Replace Q_WS_... by Q_OS_... in corelib tests. Change-Id: I14c41dca1ec490b3c49ba2c24e60def14c6de9da Reviewed-on: http://codereview.qt-project.org/5778 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Rename Qt::escape to QString::toHtmlEscaped, add compat methodDavid Faure2011-09-291-0/+22
| | | | | | | | | Merge-request: 56 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com> Change-Id: I46bbb2df10968e88b5eb5ef8dae182a651b622b8 Reviewed-on: http://codereview.qt-project.org/5793 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* Remove Symbian-specific code from tests.Jason McDonald2011-09-292-6/+0
| | | | | | | | | Symbian is not a supported platform for Qt5, so this code is no longer required. Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa Reviewed-on: http://codereview.qt-project.org/5657 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>