summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move text-related code out of corelib/tools/ to corelib/text/Edward Welbourne2019-07-101-3001/+0
| | | | | | | | This includes byte array, string, char, unicode, locale, collation and regular expressions. Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Tests: Fix some warnings about deprecated functions not under testFriedemann Kleint2019-05-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings like: baselineserver/shared/baselineprotocol.cpp:295:72: warning: ‘int QImage::byteCount() const’ is deprecated: Use sizeInBytes [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:17: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:1560:39: warning: ‘static QList<QSslCertificate> QSslSocket::defaultCaCertificates()’ is deprecated [-Wdeprecated-declarations] tst_qnetworkreply.cpp:8153:60: warning: ‘T* QWeakPointer<T>::data() const [with T = const QNetworkSession]’ is deprecated: Use toStrongRef() instead, and data() on the returned QSharedPointer [-Wdeprecated-declarations]. ... st_qprinter.cpp:1318:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_qprinter.cpp:1362:74: warning: ‘QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const’ is deprecated [-Wdeprecated-declarations] tst_largefile.cpp:492:85: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_largefile.cpp:498:91: warning: ‘bool qEqual(InputIterator1, InputIterator1, InputIterator2) [with InputIterator1 = char*; InputIterator2 = char*]’ is deprecated: Use std::equal [-Wdeprecated-declarations] tst_qabstractitemmodel.cpp:312:25: warning: ‘void QAbstractItemModel::reset()’ is deprecated [-Wdeprecated-declarations] ... tst_qabstractitemmodel.cpp:1793:28: warning: ‘void QAbstractItemModel::setRoleNames(const QHash<int, QByteArray>&)’ is deprecated [-Wdeprecated-declarations] ... tst_qcolor.cpp:1425:33: warning: ‘QColor QColor::light(int) const’ is deprecated: Use QColor::lighter() instead [-Wdeprecated-declarations] tst_qcolor.cpp:1432:31: warning: ‘QColor QColor::dark(int) const’ is deprecated: Use QColor::darker() instead [-Wdeprecated-declarations] tst_qprinterinfo.cpp:303:61: warning: 'QList<QPagedPaintDevice::PageSize> QPrinterInfo::supportedPaperSizes() const' is deprecated [-Wdeprecated-declarations] tst_qprinterinfo.cpp:304:65: warning: 'QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const' is deprecated [-Wdeprecated-declarations] tst_qtextdocumentfragment.cpp:947:52: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations] tst_qtextlayout.cpp:2261:61: warning: ‘void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange>&)’ is deprecated: Use setFormats() [-Wdeprecated-declarations] tst_qtextlayout.cpp:2330:42: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] tst_qitemselectionmodel.cpp:2214:37: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] ... tst_qtextlist.cpp:317:68: warning: 'bool QTextList::isEmpty() const' is deprecated: Use count() instead [-Wdeprecated-declarations] tst_qpainter.cpp:373:32: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:374:40: warning: ‘bool QPainter::matrixEnabled() const’ is deprecated: Use worldMatrixEnabled() instead [-Wdeprecated-declarations] tst_qpainter.cpp:702:45: warning: ‘const QBrush& QPalette::background() const’ is deprecated: Use QPalette::window() instead [-Wdeprecated-declarations] tst_qpainter.cpp:1573:29: warning: ‘void QPainter::drawRoundRect(const QRect&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:76:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:81:41: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:105:30: warning: ‘virtual void QPdfWriter::setMargins(const QPagedPaintDevice::Margins&)’ is deprecated: Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:172:37: warning: ‘virtual void QPdfWriter::setPageSizeMM(const QSizeF&)’ is deprecated: Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead [-Wdeprecated-declarations] tst_qpdfwriter.cpp:258:38: warning: ‘virtual void QPdfWriter::setPageSize(QPagedPaintDevice::PageSize)’ is deprecated: Use setPageSize(QPageSize(id)) instead [-Wdeprecated-declarations] qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp:3980:54: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations] tst_qlocale.cpp:434:26: warning: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] ... Change-Id: I77c1a934b27119eedeb26a77c913686314a2a5c7 Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-05-091-6/+6
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qlocale_data_p.h (Regenerated by running the scripts in util/local_database/) src/gui/opengl/qopengltextureuploader.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io> Change-Id: I12df7f066ed0a25eb109f61c4b8d8dea63b683e2
| * Update locale data to CLDR v35.1Edward Welbourne2019-05-071-6/+6
| | | | | | | | | | | | | | | | | | | | The formatting of times in Norwegian has reverted to using dots in place of colons, as it did before v31 (commit 82deb0ad1), so reverted the tests to their state before that. Change-Id: I8a09ce253731bb0f0f3caca117f06ad568940a81 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-021-15/+28
|\| | | | | | | Change-Id: Ia5d893e57deb78bc32e2053a5a79543ff847fe32
| * Refine underflow check in QLocaleData::convertDoubleToFloat()Edward Welbourne2019-04-011-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A string can parse as a non-zero double that's smaller than the smallest float yet be a faithful representation of the smallest float. So rather than testing for non-zero doubles less than the smallest float, test for non-zero doubles that cast to float zero; these underflow. This means small values close below the smallest float shall round up to it, rather than down to zero, requiring a tweak to an existing test. Added a test for the boundary case (and tidied the test data). Fixes: QTBUG-74833 Change-Id: I4cb30b3c0e54683574b98253505607caaf88fbfb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-12-041-18/+138
|\| | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
| * Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-11-271-18/+138
| |\ | | | | | | | | | Change-Id: I12bcee17e349edd0dd4fd08da76361d1ffb1a727
| | * Recognize E along with e as exponent character in asciiToDoubleEdward Welbourne2018-11-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed a misguided condition in the check for bogus texts in the sscanf branch of the decoder; it checked for 'e' but neglected 'E', which is just as valid. Change-Id: I9236c76faea000c92df641930e401bce445e06c8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Fix toFloat()s between float and double ranges and documentEdward Welbourne2018-11-231-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revised some toFloat()s to be consistent with the matching toDouble()s; previously, they would return infinity if toDouble() did but return 0 if toDouble() got a finite value outside float's range. That also applied to values that underflowed float's range, succeeding and returning 0 as long as they were within double's range but failing if toDouble() underflowed. Now float-underflow also fails. Amended their documentation to reflect this more consistent reality. Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toFloat] QString, QByteArray and QLocale returned an infinity on double-overflow (since 5.7) but returned 0 on a finite double outside float's range, while setting ok to false; this was at odds with their documented behavior of returning 0 on any failure. They also succeeded, returning zero, on underflow of float's range, unless double underflowed, where they failed. Changed the handling of values outside float's range to match that of values outside double's range: fail, returning an infinity on overflow or zero on underflow. The documentation now reflects the revised behavior, which matches toDouble(). Change-Id: Ia168bcacf7def0df924840d45d8edc5f850449d6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Change documentation of some toDouble()s to reflect realityEdward Welbourne2018-11-231-12/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They actually return infinity if conversion overflows, while still setting ok to false; they were documented to return 0 on failure, with no mention of this special handling of overflow. Documented reality rather than changing the behavior. Gave underflow as an example of failure other than overflow (toDouble()s do indeed fail on it). Added some tests of out-of-range values, infinities and NaNs. [ChangeLog][QtCore][toDouble] QString, QByteArray and QLocale return an infinity on overflow (since 5.7), while setting ok to false; this was at odds with their documented behavior of returning 0 on failure. The documentation now reflects the actual behavior. Fixes: QTBUG-71256 Change-Id: I8d7e80ba1f06091cf0f1480c341553381103703b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * tst_QLocale: Add tests for toFloat()Edward Welbourne2018-11-231-1/+54
| | | | | | | | | | | | | | | | | | | | | Mirror those for toDouble(). Change-Id: Ide0ef3cd99528d575f6a578ef19547f3b1119c5d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * Implement transient locale as instantiating a classEdward Welbourne2018-11-231-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A couple of QLocale tests were using setlocale twice to provide a transient locale tweak in tests; however, if the test in between fails, that can leave the program running in the "transient" locale after. So implement a proper class whose destructor ensures the transient is tidied away. Also change the locale in use by one of these transient changes: it purported to be checking things didn't depend on locale, but was using the same local as most of the test-cases for its test. Change-Id: I0d954edcc96019a8c2eb12b7a7c568e8b87a41d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-09-131-18/+17
|\| | | | | | | | | | | Change-Id: Icd201bf6b634e44e0e2ab05eaf91a7d8588d7f05
| * | Clean up time-zone matching logic in tst_QLocale::macDefaultLocale()Edward Welbourne2018-09-111-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test was computing GMT with a suffix added to it for the offset; but when the offset is zero there's no need for it. Cleaned up the logic so that it only checks for a "padded to two digits with zero" if the number is single-digit (and use string arithmetic in preference to wantonly complex .arg()ing; and use simpler names). Since we don't try to check anything unless GMT does appear in the string (because the actual zone ID was used, instead of GMT with an offset), the case of zero offset has nothing more to check than that GMT was present, the precondition for checking anything. Task-number: QTBUG-70322 Change-Id: I0b8abe7e63d9d72fa9cf32f188b47a78a849044b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Make updateSystemPrivate() local to qlocale.cppEdward Welbourne2018-09-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's not thread-safe so should only be used within systemData()'s locked code. This eliminates the last callers of it by making it a local function of the compilation unit, exposing a method from QSystemLocale() to get round its use of private parts. Make the constructor for QSystemLocale only stomp its _systemLocale global if previously unset, but let instantiation still clear globalLocaleData.m_language_id, so that it can be used as a way to trigger an update to system locale data. Change-Id: I908dca9fd30bbf20f42321ab8f9094f2fa37b7b0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-08-291-0/+31
|\| | | | | | | | | | | Change-Id: Ifb032dc19053481e1b0ede5c5c72540110d62567
| * | tst_QLocale::formattedDataSize: add RussianShawn Rutledge2018-08-261-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | The table and macros weren't extensible enough for non-Latin-based languages. Change-Id: I950f06de57aaf6bd0b24e0056e4acee2fb655f3d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add some missing language codes to our locale dataEdward Welbourne2018-08-271-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | We were missing a few languages CLDR knew about; so add them to the list in enumdata.py (and add trailing commas to lists to make future additions not need to change the prior last line; python is perfectly happy with this). [ChangeLog][QtCore][QLocale] Added support for Western Balochi, Ido, Lojban, Sicilian and Souther Kurdish. Change-Id: I0d24cff46a0ae8db48ec1db8762088f877319982 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-08-241-0/+4
|\| | | | | | | Change-Id: I5f1567c792992fc00f0256f39b76cfbe017e6a3a
| * Test for fractional part of Costa Rican currencyEdward Welbourne2018-08-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | CLDR up to somewhere between v29 (used by 5.9) and v31.0.1 (used by 5.10 and later) claimed Costa Ricans don't include fractions in their currency; now it claims they expec two digits. Apparently one of them does expect those digits, so this is the regression test I'll be cherry-picking back to LTS, to accompany the CLDR updates they need. Task-number: QTBUG-70093 Change-Id: I138772cc6013fa74de4f7c54b836cac83421eab2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Revert "Fix time-zone tests on macOS >= 10.13, which now knows what CET is"Edward Welbourne2018-08-241-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit fd38c97a6c5b7bfab39b5f814d68a02e4d197e70. Apparently our actual VMs for 10.13 don't get this right, although the ones used in testing did (prompting the fix this reverts). We probably have mis-configured VMs, but this is the quick-fix to get development moving again. Task-number: QTBUG-70149 Change-Id: Ib96755d8e21d9b226e22fc985f13f34fa04117b1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | [macOS] Skip test that triggers a buffer overflow in CoreFoundationErik Verbruggen2018-08-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | Deep down in CoreFoundation, ICU is used, and this test triggers a heap-buffer-overflow with AddressSanitizer. Disable this test for macOS until Apple fixes it. Task-number: QTBUG-69875 Change-Id: I43e4a69708be8cde3bde87c57db21f5b717f96b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Rework tst_QLocale::emptyCtor() as a data-driven testEdward Welbourne2018-08-161-58/+88
| | | | | | | | | | | | | | | | | | That way, we'll get told all the cases that fail, rather than only the first. Provoked by investigation of failures that turned out to be caused by QTBUG-69875. Change-Id: I8fa2902cbbcb307cbe1fdec2e7d8d6b0c3eb998a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Add support for numbered territories in CLDREdward Welbourne2018-08-131-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CLDR data contains eight locales with numeric territory codes, 001 for World, 150 for Europe and 419 for Latin America. The last was already known in our enumdata.py, but as "Latin America and The Caribbean", which is not supported by the CLDR, so I've amended it while adding the other two. This gives us support for Esperanto and Yiddish (among others). [ChangeLog][QtCore][QLocale] Added support for World and Europe as (numeric) "country" codes ("territory" in CLDR terms), thereby enabling support for Yiddish and Esperanto, among other locales using such codes. Task-number: QTBUG-57802 Change-Id: Ibb1180fb720743a3a0589527649d10f3c9cd123d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix time-zone tests on macOS >= 10.13, which now knows what CET isEdward Welbourne2018-08-131-8/+8
| | | | | | | | | | | | | | | | | | | | | | These tests kludge round Apple's use of GMT+1 and GMT+2 as names for CET and CEST on Darwin; but 10.13 actually gets the names right, so side-step out of the kludge when on this version or later. Change-Id: Icb8a2f3ac30f0f621a19042dc03e0d281782dd41 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Thiago Macieira2018-07-171-1/+4
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-1/+4
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbintegration.cpp Conflicts git missed: src/plugins/platforms/qnx/qqnxglcontext.cpp Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
| | * Fix tst_QLocale's mis-use of QSKIP() to use qDebug() insteadEdward Welbourne2018-07-041-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSKIP() discards the whole test it appears in; so is not the right way to announce that (and why) the test has just skipped a few sub-tests. This was concealing a later failure on macOS, here fixed. This matches an earlier fix for tst_QDateTime. Change-Id: Idaf34a9d60d84202fd41d15455209457cc281f60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Fix typo: s/Numering/Numbering/Edward Welbourne2018-07-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kept the intended word (rather than "number system" or "numeral system" as might seem more natural) since CLDR's common/supplemental/numberingSystems.xml uses numbering in its name and in the XML tag-names in its contents. Thanks to Kari Oikarinen for noticing, in review. Change-Id: I85077611f9de8c4e812e1b5324fa2e99868b7b95 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Made more tst_QLocale tests data-drivenEdward Welbourne2018-07-171-98/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | This should improve reporting and ensure we know about each failing case, not just the first, when one fails. Change-Id: Ic00272201f69a2fd8508df23b1d746ea605aa539 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
* | | Assume Win >= Win7 in code that used to test itEdward Welbourne2018-07-171-21/+8
|/ / | | | | | | | | | | | | Cleaned up some related #if-ery in the process. Change-Id: I70f3152f2096ec34f36782fa1c3329f51c9b34f0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Update CLDR to version 33.1 (2018/June/20)Edward Welbourne2018-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Routine update in preparation for 5.12 * omitting Chakma because QLocale can't represent the zero digit, * de_DE no longer uses vorm./nachm. but AM/PM [ChangeLog][Third-party code] Updated CLDR to version 33.1 Task-number: QTBUG-67654 Change-Id: If20c47bb030abc3700b4f5a592152e617e2767c2 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Split up many long lines in tst_QLocaleEdward Welbourne2018-07-161-69/+138
| | | | | | | | | | | | | | Rewrote some of them away, in the process, using string arithmetic. Change-Id: Ie1a29abefab001889a22a8bc66c7eee608496786 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* | Adjust some indentation and spacing in tst_QLocaleEdward Welbourne2018-07-161-23/+22
|/ | | | | | | | This is preparation (the WS-only parts) for splitting up some over-long lines, in the course of which I also fix some indentation. Change-Id: I800490e328b5e16d40685dff04c09cd145d5eacf Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* Android: Pass tst_qlocaleMårten Nordheim2018-06-281-4/+19
| | | | | | | | | | | | To make it run we make sure it finds the syslocaleapp, however since it causes a crash we skip the test that uses it... "formatTimeZone" was failing, but it is the exact same issue as in e08ba34f26197fb9893fd48a38bdd0dfff7d4a60, so we solve it the exact same way. Change-Id: Ifd5c796735775dad94acf55210cf18c0f4d375ca Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* tst_QLocale: Avoid manual deletesKari Oikarinen2018-04-061-14/+19
| | | | | | | | | Also use data-driven test to reduce duplication. Change-Id: I9516e52267cb3c7b239030fd73dbbf23ac8f52f7 Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Kludge QLocale test order to fix fall-out from setDefault()Edward Welbourne2018-04-051-10/+28
| | | | | | | | | | | This makes an irreversible global change: tests that do it will mess with other tests. So make sure they're all last. This required splitting up one test; and revealed another that secretly depended on being run with C as default locale. Task-number: QTBUG-67276 Change-Id: Ic24ef48b2c9bd5c37c1f11260b437628019624ca Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
* QLocale: Update the system private on QLocale default constructor if neededAlbert Astals Cid2018-03-021-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When first starting an Android app we have invocation order issue, to load the platform plugin we create the default QLocale (needed by the resource locator code to see if :/qt/etc/qt.conf exists) so when the android platform plugin loads and creates its own QSystemLocale, the QLocale defaultLocalePrivate is already created and pointing to globalLocaleData which means that systemData won't be called and thus the code that triggers the call to QLocalePrivate::updateSystemPrivate won't be called when calling QLocale(). I thought of two ways of fixing this, one was calling QLocalePrivate::updateSystemPrivatea() from the QAndroidSystemLocale constructor, but giving the responsibility to not break things to the plugin seems a little fragile, so making the check on QLocale() seems better. Without this patch an Android app doing QApplication app(argc, argv); qDebug() << QLocale().name(); qDebug() << QLocale().name(); qDebug() << QLocale::system().name(); qDebug() << QLocale().name(); would print "" "" "ca_ES" "ca_ES" now it correctly prints "ca_ES" the four times. Task-number: QTBUG-41385 Change-Id: I2cf419f59aa008fa3aca11295fe7d42c40bcc32e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QDateTimeParser: reject all short values in fixed-width fieldsEdward Welbourne2017-11-301-0/+10
| | | | | | | | | | | | | | | | | | | | Previously, a 1, 2 or 3 for "dd" would be rejected because 10, 20 or 30 would fit in the field and be valid; but 4 or more was accepted, even though it was too short for the field, because no suffix could make it valid within the field-width. [ChangeLog][QtCore][QDateTime] When parsing dates and times from strings, fixed-width date-time fields, such as a "dd" for day, QDateTime now rejects all values that should be padded, rather than only doing so when the value is a prefix of some value that would fill the field-width. Use a single letter for the field, e.g. "d" for day, if you want to accept short values. (QDateTimeEdit is not affected.) Task-number: QTBUG-63072 Change-Id: I22d223c50057c3edab4ef7f01d9ed0f58e9139c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devOswald Buddenhagen2017-08-021-0/+22
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/widgets/qdockarealayout.cpp src/widgets/widgets/qmainwindow.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmainwindowlayout_p.h tests/auto/corelib/tools/qlocale/tst_qlocale.cpp tests/auto/other/macnativeevents/BLACKLIST tests/auto/widgets/widgets/qmenu/BLACKLIST Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
| * Return "en" for QLocale::c().bcp47Name()Jüri Valdmann2017-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently QLocale::c().bcp47Name() returns "C" which, according to [BCP47], is not a valid language tag. In particular it does not conform to the ABNF grammar in section 2.1 which specifies a minimum length of 2 characters for all language tags. [BCP47]: https://tools.ietf.org/html/bcp47 This patch changes the return value to "en" seeing as the documentation for QLocale::Language states that the C language is identical in behavior to English. Task-number: QTBUG-61949 Change-Id: I2a381def8fb7156467e01d105da92bb1f4821204 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * Add test for QLocale::bcp47Name()Jüri Valdmann2017-07-261-0/+23
| | | | | | | | | | | | | | Task-number: QTBUG-61949 Change-Id: I34fece0441afb1e69ea84ae59b90c5e2b7cf133f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devGabriel de Dietrich2017-07-131-8/+11
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
| * QLocale: fix handling of milliseconds in string format and documentThiago Macieira2017-07-071-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QLocale] Fixed the conversion of QTime to string form and parsing from string form to always treat the value as the decimal fraction of the seconds component. That is, the string format ".z" produces/parses ".2" for 200 milliseconds and ".002" for 2 milliseconds. Use of "z" or "zzz" is discouraged outside decimal fractions to avoid surprises. Task-number: QTBUG-53565 Change-Id: Ia19de85ad35e4eb7bb95fffd14792caf9b4a5156 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-061-6/+61
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
| * Fix parsing of 0E+1 and 0E-1 (capital 'E')Thiago Macieira2017-07-031-1/+57
| | | | | | | | | | | | | | | | | | | | Since the result is an actual zero, this section of code looking for underflows kicks in. But we forgot to take the capital letter into account when parsing the number. Task-number: QTBUG-61350 Change-Id: Ia53158e207a94bf49489fffd14c6abbd21f0bac0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * Fix offset calculation to be valid at the correct timeEdward Welbourne2017-07-031-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tst_QLocale::macDefaultLocale() was determining local-time's current offset from UTC and using it when working out what to expect the offset at 1:2:3 today to be. When a transition happens after 1:2:3 on its day (which is usual for DST changes in Europe), this lead to using the new offset to test a time before the transition; the test was thus wrong and failed. Use the time to be tested (and current date) to compute the offset to use, instead of using the current date-time. Change-Id: I1c02a5579bca859e1d1aeb4f45b24871a08287af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update CLDR to v31.0.1Edward Welbourne2017-06-201-6/+6
| | | | | | | | | | | | | | | | | | | | The formatting of times in Norwegian has changed to use colon rather than dot between hours, minutes and seconds: http://cldr.unicode.org/index/downloads/cldr-30#TOC-Other tst_QLocale gets a matching revision. Change-Id: I35a16080def5fbadd62144a0b44be8110b9be29b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Add QLocale::formattedDataSize and consolidate use casesShawn Rutledge2017-06-201-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be easier to translate sizes in bytes to human-readable strings consistently rather than having to repeat this code (and the string translations) in various places. The FileDialog in QtQuick.Controls has a use for this, too. [ChangeLog][QtCore][QLocale] Added QLocale::formattedDataSize() for formatting quantities of bytes as kB, MB, GB etc. Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I27bca146c3eba90fa7a5d52ef6626ce85723e3f0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>