summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qlocale
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-162-54/+4
| | | | | | | | | | | | | 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 remaining uses of deprecated _qs with _sSona Kurazyan2022-05-021-3/+3
| | | | | | Task-number: QTBUG-101408 Change-Id: I1fda67c07e948af5017f0b99b67f8c20d7052033 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix qlocale_unix's handling of uiLanguages to take script into accountEdward Welbourne2022-04-271-0/+6
| | | | | | | | | | | | | | | Some languages have, in the same territory, locales for more than one script. In such cases, since we ignored the script, we got the one that is used by default, instead of the one actually asked for. Take the script into account. Added TODO comment in test listing the known examples of this; manually tested before and after the fix to verify the prior code was indeed getting it wrong and now does do it right. Change-Id: Iaf9201d6992bc39e6e9346ef8b7c69d418db7253 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Return more specific entries before less in QLocale::uiLanguages()Edward Welbourne2022-04-271-12/+12
| | | | | | | | | | | | | | | | | | The documentation overtly listed entries in this order but the code gave less specific entries before more specific (and the tests verified the same). This is now reversed. [ChangeLog][QtCore][QLocale] uiLanguages() now prefers more specific locale names over less specific ones, matching its own documentation, except where the system backend supplies them in some other order. This means a translation with the expected script and/or territory as well as language will be used in preference to a generic one for just the language, rather than only as a fall-back when the more generic one is missing. Fixes: QTBUG-102796 Change-Id: I3c7b3627afb51246df5a6ad0230e23b60af78071 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix assertion failure when parsing a doubly-invalid date-time textEdward Welbourne2022-04-071-1/+14
| | | | | | | | | | | | | | | | | | | | | | | When the date-time string falls in a spring-forward (so is invalid) and one of the fields of the parsed string doesn't match the format it's meant to (e.g. a single-digit seconds field when format ss was specified), a check that the current fall-back date-time is between the minimum and maximum for the parser object failed, triggering an assertion. In any case, an invalid default-value wasn't useful to the code that parsed a single section of the date-time string, so brute-force the current value to a valid date-time (when possible) using the usual round-trip via milliseconds since the epoch. Added the test-case which first revealed the problem, plus a couple more informed by it, to exercise the same code-paths with fewer things failing. Fixes: QTBUG-102199 Pick-to: 6.3 6.2 5.15 Change-Id: I658308614505ef25f4c97d0de6148acb54a65a0f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace uses of _qs with _s in testsSona Kurazyan2022-04-071-8/+10
| | | | | | Task-number: QTBUG-101408 Change-Id: If092a68828a1e8056259cf90d035d9a87989244b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* We do in fact support 'F' format for floating-point valuesEdward Welbourne2022-04-011-0/+96
| | | | | | | | | | | | | | Update docs and add tests. [ChangeLog][QtCore] Documented existing support for 'F' format when converting floating-point numbers to strings in QLocale::toString(), hence equally for QString's floating-point formatting. Previously it was supported but the documentation neglected to mention it; it only differs from 'f' for infinities and NaN. Change-Id: Ic946c0f7b9e86fdf512daa3124bea57fc664b34b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Move some purely floating-point testing from tst_QLocale to tst_QNumericEdward Welbourne2022-04-011-24/+0
| | | | | | | | | The testing of infinity and NaN somewhat duplicated existing tests in tst_QNumeric and, in any case, belongs there. Change-Id: I6b5d1ff9767daf8e4bbe0025d3efab3d74ed35de Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Clean up and modernise tst_QLocale::fpExceptions()Edward Welbourne2022-04-011-15/+14
| | | | | | | | | | | Use the modern "portable" _clearfp() and _controlfp(), that work regardless of the hardware MS is running on, rather than the x86-specific _clear87() and _control87(); and move some defines into the #if-ery context in which they're used, rather than defining them regardless of whether they're used. Change-Id: I13abf2c85525b1182b99bc2c366aadd6b5fc656f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Android: enable tst_QLocaleIvan Solovev2022-03-291-9/+12
| | | | | | | | | | | | | | | | | | Do not try to properly specify a path to an external syslocale app, because the related test can't be executed on Android anyway. This fixes a failure in initTestCase() and allows to unblock other test-cases. Also skip systemLocale() test, because Android platform plugin already creates a custom QSystemLocale instance, so a hack with MySystemLocale does not work. As a drive-by: simplify the #ifery in initTestCase() and remove an unused second parameter of QSKIP() in emptyCtor_data(). Fixes: QTBUG-87414 Pick-to: 6.3 6.2 Change-Id: Iefc587062362469856fdca77f9ec9d96f5552e45 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Exclude denormal test cases if system doesn't support itTatiana Borisova2022-02-151-0/+14
| | | | | | | | | | | | - current INTEGRITY development pack don't support denormals for float and double. All values are rounded to 0. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Iaaacdc4210c7ac2ec3ec337c61164a1ade0efb01 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: Extend support for language codesIevgenii Meshcheriakov2021-12-091-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extends functionality for QLocale::codeToLanguage() and QLocale::languageToCode() by adding an additional argument that allows selection of the ISO 639 code-set to consider for those operations. The following ISO 639 codes are supported: * Part 1 * Part 2 bibliographic * Part 2 terminological * Part 3 As a result of this change the codeToLanguage() overload without the additional argument now returns a Language value if it matches any know code. Previously a valid language was returned only if the function argument matched the first code defined for that language from the above list. [ChangeLog][QtCore][QLocale] Added overloads for codeToLanguage() and languageToCode() that support specifying which ISO 639 codes to consider. Fixes: QTBUG-98129 Change-Id: I4da8a89e2e68a673cf63a621359cded609873fa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix macOS system locale's formatting of negative yearsEdward Welbourne2021-11-181-3/+0
| | | | | | | It leaves off the minus sign. Change-Id: Iad72349368d8849330524144033453cbd79e9e7c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix formatting of dates before 1601 in MS system localeEdward Welbourne2021-11-181-0/+24
| | | | | | | | | | | | | | | | The relevant MS system calls (say they) don't support date formatting for years < 1601 (but apparently do in fact) and the year field of the data structure is unsigned, so can't support years < 0. As a result, the windows back-end for QSystemLocale failed for negative years. So replace year < 1601 with a place-holder and substitute after formatting. Added new tests (based loosely on one in qtdeclarative that failed) to verify that this actually works. These reveal that macOS also fails to handle negative years; marked as expected failure there pending a fix. Change-Id: I9b63cefd5f0b77a39cf1238549412de3e26ca1bd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean up exports from qlocale_p.hEdward Welbourne2021-11-101-1/+1
| | | | | | | | | | | | Explain why QSystemLocale needs to be an export. Unexport QLocaleId::fromName() now that qttools no longer uses it. QLocalePrivate was only Q_CORE_EXPORT for the sake of one use in tst_QLocale, that can now be replaced by a call to a public QLocale method. Change-Id: I1efe8ee03488acfc6e1c36661f6e956a86e191c3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update CLDR-derived data to newly-released v40Ievgenii Meshcheriakov2021-11-101-3/+3
| | | | | | | | | | | | | Update tst_qlocale to take into account "narrow" day representation change for Russian locales. This version of CLDR changes narrow forms to one letter. Previously those forms were identical to short forms (two letter). The new representation is consistent with other languages and so does not appear to be a bug. Fixes: QTBUG-94358 Pick-to: 6.2 Change-Id: I9724c281a250685da8232e5c05c9c375a8c79253 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add missing dependencies of tests on their helper programsEdward Welbourne2021-09-171-4/+4
| | | | | | | | | | | | | | | | | This ensures that a command such as $ ninja tst_qlocale && ninja tst_qlocale_check will automagically build the syslocaleapp program that the test runs from a subtest. Similar for testlib's selftests and tst_QProcess. As a drive-by, pruned some legacy comments from when CMakeLists.txt files were generated from .pro files. Change-Id: I67691a8175aaef124d4104cf1898193993408bdf Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Teach QLocale::system() to use narrow formatIvan Solovev2021-09-151-0/+27
| | | | | | | | | | | | | | | | QLocale::system() was not making use of QLocaleFormat::Narrow, always treating it in the same way as QLocaleFormat::Short. This patch fixes the issue for day and month names. The implementation falls back to CLDR if system locale fails to provide some data. Pick-to: 6.2 Task-number: QTBUG-84877 Change-Id: Ia37e59dbf02d7a5e230f2767d294b9ab7de37f33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Tidy up #includes in tst_qlocale.cppEdward Welbourne2021-09-141-17/+15
| | | | | | | | System headers were jumbled in with Qt headers. Separate those out and use standard names for Qt headers. Tidied some #if-ery. Change-Id: Ic8c61797303567eeaef48e2560e91924ddb380f0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move locale-switching code in tests to a shared headerEdward Welbourne2021-09-141-56/+4
| | | | | | | | | | | | | | | | | | | | | | QLocale and QString tests had copies of a TransientLocale; we've recently improved the QLocale one. Rather than duplicating those rather complicated improvements, finally share a common version. In the process, I noticed that setlocale() only returns the prior value when passed nullptr as the new value; so rework the implementation to get that right, so that it now correctly restores the prior locale. That, in turn, means there's now a later call to setlocale(), when we actually set the changed setting, which may invalidate the earlier return; so copy it to a QByteArray before the second call. Included Ivan Solovev's improved version of how to reset the locale, since TransientLocale needs it. Pick-to: 6.2 Change-Id: I4cb1efbda42f0e2cdd934e04b3b3732ce0f45a06 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add new am/pm format-specifier that preserves locale's caseEdward Welbourne2021-09-081-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing a, ap, A and AP specifiers all force the case of the formatted am/pm indicator. The indicators returned by QLocale's amText() and pmText() methods are those given in CLDR, with no case coercion. Application writers may reasonably want these strings used verbatim, rather than having to chose a case and impose it on the locale's indicators, in defiance of national custom. For example, while en_US uses upper-case indicators by default, cs_CZ uses lower-case ones. An application author writing a time format has been forced to chose which of these locales to be wrong in. Add support for aP and Ap specifiers, whose mixed case indicates that the locale's case is to be respected. Amend an existing test-case of tst_QLocale's formatDateTime() that used Ap (expecting, of course, an upper-case indicator followed by a stray p) to now expect the locale-appropriate-cased indicator. Extend formatTime() to test cases using aP and Ap, to illustrate the difference between en_US and cs_CZ. Rework QDateTimeParser to also support the new format specifier. This required expanding its Case enum, used by the getAmPmText() method, which was formerly shared with QDateTimeEditPrivate; however, as that class no longer makes any reference to this method, it and the enum can be made private, allowing a systematic clean-up of their use. Added test-cases for both serialization and parsing; and amended some existing parsing tests to verify am/pm indicators are matched case-insensitively. [ChangeLog][QtCore][Important Behavior Changes] Time formats used by QLocale, QTime and QDateTime's parsing and serialization now recognize 'aP' and 'Ap' format specifiers to obtain an AM/PM indicator, using the locale-appropriate case for the indicator, where previously the author of a time format had to pick a case that might conflict with the user's locale. For QTime and QDateTime the locale is always C, whose indicators are uppercase. For QLocale, the case will now match that of amText() or pmText(). Previously, 'aP' would have been read as a lower-case indicator followed by a 'P' and 'Ap' as an upper-case indicator followed by a 'p'. The 'P' or 'p' will now be treated as part of the format specifier: if the prior behavior is desired, either use 'APp' or 'apP' as format specifier or quote the 'p' or 'P' in the format. The prior 'a', 'ap', 'A' and 'AP' specifiers are otherwise unaffected. Fixes: QTBUG-95790 Change-Id: I26603f70f068e132b5c6aa63214ac8c1774ec913 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix QLocale::system() standalone day and month handlingIvan Solovev2021-09-061-0/+127
| | | | | | | | | | | | | | | Some backends were missing support for standalone days and months, also the standaloneDayName() implementation was always using the same codepath as dayName(). This patch fixes the issues. Support for narrow format will be added in the following patch. Task-number: QTBUG-84877 Pick-to: 6.2 Change-Id: I38ee06342cafab544e3c69097bd0e6ae68e85645 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make tst_QLocale::TransientLocale succeed at changing system localeIvan Solovev2021-09-031-2/+46
| | | | | | | | | | | | | | | | It was previously calling setlocale(), which makes no difference to the Unix backend for the system locale, since that's based on environment variables (that would normally be used to get default values for the various setlocale() categories, but only the first time each is asked for). So, on Unix, set the environment variable, too. It's also necessary to instantiate a QSystemLocale instance transiently to trigger a refresh of the system locale data. Pick-to: 6.2 Change-Id: If92e44053f9021e96c814f4b289f4fadaa7027e0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* qlocale_win: Fix non-standalone month namesEdward Welbourne2021-09-011-3/+10
| | | | | | | | | | | | | | | | | | | | We have previously been using the standalong (nominative) month names both when asked for that and when asked for the plain (genitive) month name, probably because there was no LCTYPE value for the latter. However, MS's docs for the standalone values do contain a comment telling us how to get the genitive names. Rename the old monthName() to standaloneMonthName() and add a monthName() that calls GetDateFormat() suitably, as described by the MS doc. Pick-to: 6.2 5.15 Fixes: QTBUG-92018 Fixes: QTBUG-86279 Change-Id: I27f63198c3a15b792683f476d2019078b0860f99 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace FreeBSD's strtou?ll() with std::from_chars()-based strntou?ll()Edward Welbourne2021-08-301-0/+3
| | | | | | | | | | | | | | | Remove third-party code in favor of STL. Implement (for now) strtou?ll() as inlines on strntou?ll() calling strlen() for the size parameter. (This is not entirely safe, as a string lacking '\0'-termination but with at least some non-matching text after the numeric portion would formerly be parsed just fine, but would now produce a crash. However, strtou?ll() are internal and callers should be ensuring '\0'-termination.) Task-number: QTBUG-74286 Change-Id: I0c8ca7d4f6110367e93b4c0164854a82c5a545e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QLocale::formatTime(): add some actual locale-dependenceEdward Welbourne2021-08-181-43/+68
| | | | | | | | | | | All the tests were using the C locale, so were equivalent to tests of QTime::toString(). Add a locale column and some test-cases in preparation for a change to am/pm indicators. Task-number: QTBUG-95790 Change-Id: I3ad917b7a6f3d3bfe31d6a5a5da596025f173e81 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qlocale: Add tests for parsing Chakma date and time stringsIevgenii Meshcheriakov2021-07-191-0/+16
| | | | | | | | | | | | Add tests to verify parser behavior with locales that use code points outside of Unicode BMP to represent dates. ccp is used for this because Chakma language uses code points outside of BMP for both letters and digits. QDateTimeParser currently is not able to handle this locale correctly, so the tests are marked as expected failures. Task-number: QTBUG-87111 Change-Id: I1cc6fe7304b47f19950ae0ad3179c4ffa946adb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add .UTF-8 suffixes to locale-names passed to setlocale()Edward Welbourne2021-06-111-3/+3
| | | | | | | | | | | We use UTF-8 locales by default since Qt 6; and relatively few systems have the encoding-unspecified locales we were trying to use, with the result that the setlocale() calls all failed. Task-number: COIN-689 Change-Id: Id791ba269bf4abac29da3daa4fd01684ca9caa7a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Always include standard name in QLocale::uiLanguages()Edward Welbourne2021-06-071-36/+39
| | | | | | | | | | | | | | | | Previously, for locales other than the system locale, no entry was added to the list for the actual locale whose variants - with and without likely sub-tags - were being appended. In most cases the standard name will in fact coincide with the variant without likely sub-tags, so this was unlikely to cause a problem, but it should be present regardless. At the same time, turn tst_QLocale::uiLanguages() into a data-driven test and add another row to its table. Change-Id: I5cb2d805d78fc3415d82b169caa6154b0f284708 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix augmentation of UI language listEdward Welbourne2021-06-071-8/+25
| | | | | | | | | | | | | | | | | | | | Previously, the augmentation wasn't being applied to the system locale, due to a mistaken test claiming the locale's name didn't resemble the string from which it was constructed. The test dates from before various fixes to likely sub-tag processing that should make it redundant now. This makes QLocalePrivate::rawName() also redundant (and its conversion of QLatin1String to QByteArray relied on '\0' termination which wasn't actually present in the various codes). Expanded the test of systemLocale() to also test uiLanguages() turns a single entry into the list we expect; and add two new test-cases. (The test uses a mock system locale class, making this independent of the platform backend.) Fixes: QTBUG-92234 Pick-to: 6.1 5.15 Change-Id: I0cdf6eae152a42dc377f4ea3e62c282ff4be1764 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix assertion on matchingLocales(Abhkazian, Any, Any)Edward Welbourne2021-05-051-1/+7
| | | | | | | | | CLDR v39 has no locales for Abkhazian, so the locale_index[] entry for it actually indexes the last entry before the next language up the enum. This has m_language_id less than Abkhazian. Change-Id: If8b88f30476a981b3ee00ff8760a46ede0b7aab7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Update CLDR-derived data to newly-released v39Edward Welbourne2021-04-261-1/+1
| | | | | | | | | | | | | Routine update with minor changes to locale data, no new languages, territories or scripts. Various Spanish locales change m_grouping_top from 1 to 2, reversing a change to a test of Costa Rica's currency formatting made in commit bb6a73260ec8272647265f42180963604ad0f755. Includes updates to time-zone IDs. Fixes: QTBUG-91478 Pick-to: 6.1 6.0 5.15 Change-Id: I78ee161275b3c456c5800a7317a96947c932cf8e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add the "Territory" enumerated type for QLocaleJiDe Zhang2021-04-151-97/+97
| | | | | | | | | | | | | | | | | | | The use of "Country" is misleading as some entries in the enumeration are not countries (eg, HongKong), for all that most are. The Unicode Consortium's Common Locale Data Repository (CLDR, from which QLocale's data is taken) calls these territories, so introduce territory-based names and prepare to deprecate the country-based ones in due course. [ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for its Country enumeration, and associated territory-based names to match its country-named methods, to better match the usage in relevant standards. The country-based names shall in due course be deprecated in favor of the territory-based names. Fixes: QTBUG-91686 Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* macOS: Be honest about the system localeTor Arne Vestbø2021-02-111-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The system locale of a macOS application is not affected by environment variables like LANG. Yet, we were reporting a name determined from environment variables as the fallbackUiLocale(), rather than one based on the language and country of the actual system locale. This lead, via the usual CLDR likely-subtag fallback, to claiming the system locale's name, language, script and country were those obtained from these environment variables, even when they were at odds with the actual locale being used by the system, which was being used for some queries. Worse yet, any data not supplied by these queries was being obtained from the same CLDR locale as the name, making for an inconsistent mix of locale data. While we cannot avoid the likely-subtag fallback step for fallback data, it is more consistent to use the actual system locale's name as start-point for that fallback. At the same time, add support for the language, script and country queries, so that the QLocale::system() describes itself faithfully, instead of claiming to be the locale that results from that fallback. If we want to support LANG or other environment variable overrides, they should be handled by the layer above the system locale, by changing the default locale of the Qt application, as if the user had called QLocale::setDefault(). [ChangeLog][QtCore][QLocale] QLocale::system() on macOS no longer pretends to support LANG or other environment variables as overrides, as this is not a feature that the system locale on macOS supports. To override the locale of an application, use QLocale::setDefault(), or pass -AppleLocale en_US. Fixes: QTBUG-90971 Change-Id: Ibdaf5ff9a2050f61233a88eabf3c29094f7757f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Clarify what QSystemLocale::fallbackLocale() is used forTor Arne Vestbø2021-02-091-1/+1
| | | | | Change-Id: I8f073f996505ccb42020b32fd76520ecef54e628 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: Allow direct conversion from language, country, and script codesKai Köhne2021-01-251-0/+27
| | | | | | | | | | | | | | | This complements patch a148c7b5d71d244, where languageToCode(), countryToCode() scriptToCode() methods were introduced, with matching codeToLanguage(), codeToCountry(), and codeToScript() methods. This allows us to remove the use of private Qt Core API in Qt Linguist. [ChangeLog][QtCore][QLocale] Added static codeToLanguage(), codeToCountry(), codeToScript() methods that convert ISO code strings to the respective enum values. Change-Id: If5c0843a718c006ade086a6f74ceb86ac6e0fce4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: Allow direct conversion to language, country, and script codesKai Köhne2021-01-181-0/+16
| | | | | | | | | | | | | | | | | | | | Currently the codes are only exposed in aggregated form, i.e. through name(), bcp47Name(). There are use cases though where you are only interested in either language, country, or script codes. One example is in Qt Linguist. This patch therefore exposes the static languageToCode(), countryToCode(), scriptToCode() methods that were so far only available in the private API also in the public API. [ChangeLog][QtCore][QLocale] Added static languageToCode(), countryToCode() scriptToCode() methods that convert enum values to the respective ISO code strings. Fixes: QTBUG-39542 Fixes: QTBUG-64942 Change-Id: Ib1d5c3293e2f53245ba4c1fc8159275bcb290080 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-073-30/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+2
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update CLDR to v38Edward Welbourne2020-11-081-1/+1
| | | | | | | | | | | | | Fresh on the heels of our update to v37, they've released a new version. No new languages to complicate life, fortunately. Updated license (year range) and attribution. One test also needed an update: Catalan's long time format now parenthesizes the zone. Task-number: QTBUG-87925 Pick-to: 5.15 Change-Id: I54fb9b7f084b5cd019c983c1e3862dc03865a272 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Purge deprecated language and country codes from QLocaleEdward Welbourne2020-10-291-28/+0
| | | | | | | | | | | | | | | | | | | | Requires subsequent re-numbering of the enum tables to eliminate gaps, before locale data can be regenerated. However, it will work with the present locale data, since it merely loses the means to use some names for which the available data was just the name and code. This implies a transient issue of recognising some codes for which there is no actual enum member; but relevant code will work as before, finding nothing but the code and its name. This shall be resolved by a coming BiC change to resort the language, country and script codes, changing the numbering (almost) completely. [ChangeLog][QtCore][QLocale] Various obsolete language and country codes have been removed. Some lacked locale data, others were obsolete aliases. All have been deprecated in 5.15. Task-number: QTBUG-84669 Change-Id: I45fc76a5f2f6c3b0ea3c1bb61e917da984183783 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate old aliases for two countries and several languagesEdward Welbourne2020-10-281-7/+7
| | | | | | | | | | [ChangeLog][QtCore][QLocale] Deprecated several Language and Country aliases, ready for removal in Qt 6.0, in favor of their newer names. Task-number: QTBUG-84669 Pick-to: 5.15 5.15.2 Change-Id: Iebaa0a5a77bfa12f7014de53fab4a25b5f1cc92c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deprecate QLocale::Language entries that no locale data relates toEdward Welbourne2020-10-281-10/+12
| | | | | | | | | | | | | | | | | These are languages for which CLDR does not even recognize the claimed language code (three-letter codes except for bh = Bihari, which might be an old name for bho = Bhojpuri, which CLDR does give, but provides no locale data using it). [ChangeLog][QtCore][QLocale::Language] Many obsolete language names are now deprecated in preparation for removal at Qt 6.0. No data has been available for any locale using these languages since CLDR v29 (at least; Qt now uses v37). Task-number: QTBUG-84669 Pick-to: 5.15 5.15.2 Change-Id: I2bf2d49211ade7cc511277f35fb1a247e7048b31 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tidy up tst_QLocale::ctor(), reduce needless repetitionEdward Welbourne2020-10-191-21/+21
| | | | | | | | | | | | The test macro's first three parameters were given a QLocale:: prefix by the macro, but the last three weren't. Save uses of the macro the need to repeat the prefix in all parameters, thereby making the test cases easier to read. Also, we can compare enum values, rather than casting them to int; and, when a test fails, reporting the enum name is far more informative than reporting the integer that represents it. Change-Id: Ib0360c51049333b4a00ea84e271c99db6724334f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove vacuous tst_QLocale::cleanupTestCase()Edward Welbourne2020-10-191-4/+0
| | | | | | Change-Id: I8bf9915045dce434f19de9c3745e1be28a833e8f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clean up tst_QLocale::testNames(), give better message on failureEdward Welbourne2020-10-091-27/+28
| | | | | | | | | | It was previously casting enum values to int, which produced unhelpful answers when a test failed. Better to have them as enum values that get printed as their names, which are actually informative. Change-Id: I1bf2971b1426bdbbc321bb48f45ee3e5799e76ec Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add unit test to check emoji handling in date-time parsingAndreas Buhr2020-09-231-0/+22
| | | | | | | | Add some unit tests using emojis as separator characters to check utf handling. Change-Id: I03c4bb5cd349e649c58e8a908c38a0185d80e722 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-232-4/+4
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Move QStringRef and remains to Qt5CompatKarsten Heimrich2020-08-201-5/+5
| | | | | | | | | Export some private functions from QUtf8 to resolve undefined symbols in Qt5Compat after moving QStringRef. Task-number: QTBUG-84437 Change-Id: I9046dcb14ed520d8868a511d79da6e721e26f72b Reviewed-by: Lars Knoll <lars.knoll@qt.io>