Add additional tests for the updates in the Qt4.8 qlocale data (CLDRv2.0) already existing in Qt5 locale data (CLDRv22.1):
- The NumberingSystem for some Indic and Slovak locales.
- The Month/Day name in Irish/Gaelic locale.
- The AM/PM Text in Turkish locale.
Change-Id: Iaea4f13ec79f94ab937b97f8ae60eb8d8f217c4b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
These types are either built-in or 'automatically declared' and so
don't need to be explicitly declared as metatypes.
Change-Id: I54523eb854619917123d8816d3cd6c3a1f5b4c55
Reviewed-by: David Faure <david.faure@kdab.com>
If the dynamic_cast failed in QSharedPointer::dynamicCast or
qSharedPointerDynamicCast, we should avoid creating the QSharedPointer
that shares the weak and strong reference counts. In Qt 5, this does
not imply a leak since the original pointer is stored internally for
deletion. In Qt 4 it implies a leak under certain circumstances, which
this change fixes.
Task-number: QTBUG-28924
Change-Id: Id2de140de4cf676461e14b201ad250c53666b79d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
As they are built-in, they are effectively registered at compile-time
already.
Change-Id: I7ae6ba16088eab5d19213fa7b07c2a7760988a86
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Going through QLocale and QString is not really needed.
This also makes the result of the conversion of negative numbers
in bases other than 10 independent of the architecture and
implements the documented behavior of treating them as
unsigned types.
Change-Id: Ibc231dc5241deb5cbadd9796484a8b5f79c29410
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The address behind a string doesn't point to a string.
Change-Id: Ic54f652ae781fea278f60cc49d219c1c610ba29f
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
there is no point to use this for in-module references.
cleaning it out in an attempt to purge the constants entirely.
Change-Id: I1da4d70e3778257dd43eda0bdfc71eaec1124732
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
QCoreApplication::Type enum was removed in 553e21. This change updates
the (un)tested application types to match the application types
available in Qt 5.
Change-Id: I8631987a9ff31dc81baa013619cfc18616b851d1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Since the documentation doesn't mention the search should be done by language only,
consider the current behavior incorrect.
As of now, it is possible to get a list of locales by Country or Script as well.
Also fix countriesForLanguage() to be in-sync with matchingLocales().
Change-Id: I6a09ca459120143565fa6099d2b823df1fed7c25
Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
As of Unicode 5.1, some punctuation marks were mapped to MidLetter and MidNumLet
for better URL and abbreviations handling which caused "hi.there" to be treated
like if it were just a single word;
until we have the Unicode Text Segmentation tailoring mechanism, retain
the old behavior by remapping (some of) those characters back to their old values.
Change-Id: I49dea6064f2ea40a82fc0b1bc3c4f0b4e803919f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
...just like described in http://www.unicode.org/reports/tr35/#Likely_Subtags.
This is much more effective than current "guessing" algorithm
+ makes it possible to instantiate a locale by the script or territory code only.
Change-Id: I674f8476e65b01c56960b6e83a1a346df0715274
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This patch adds some missing codes (two-letter ones only),
removes an outdated ones, and updates some names.
The legacy language codes are handled in QLocalePrivate::codeToLanguage()
(fortunately, there are only 4 of such codes).
Change-Id: Iff50aecd1c762b6399cd151aebb955f341d366c6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
...with a generated one in a way similar to what
http://www.unicode.org/reports/tr35/#Likely_Subtags suggests.
The supplemental/likelySubtags.xml contains all the required data.
This changes some default countries to a most-expected ones.
Change-Id: I920a5623601d8661a943e78197d3bcc838191483
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Checking that the result of sort() is a specific list is wrong,
as sort() can put equivalent elements in an arbitrary order.
Change-Id: Ib06399cdecedb6cf01e721d4d92048449d66b40d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
1. There is a behaviour change for CFDateFormatterGetFormat() between
10.6 and later, QLocale::dateFormat(QLocale::LongFormat) will return
"MMMM d, yyyy" for 10.6 and "MMMM d, y" for 10.7, 10.8
2. Add a comment for toCurrencyString() test, need another system
settings
Task-number: QTBUG-27790
Change-Id: I4fe684d6e0c1d4a140e3b1f1ef395b7fdad030b4
Reviewed-by: Samuli Piippo <samuli.piippo@digia.com>
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
No reason to keep this test. If an application is trying to allocate too
much memory it will fail, and its the users responsibility to provide
sane values and catch exceptions to recover.
Task-number: QTBUG-27361
Change-Id: I29d71745ab791b6e8a76f7b1f866ff4bd7024749
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a read position variable to eliminate excessive memcpy'ing when
reading a partial buffer.
Specifically, fix performance issue of reading large files from
QNetworkDiskCache in QtWebKit2.
Task-number: QTBUG-27522
Change-Id: I21edc909bf9223971b2c3db5f1fa6b89c5b61c5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Antti Harju <antti.harju@ixonos.com>
The old code is just plain wrong for negative julian days. Replaced
with plain math from The Calendar FAQ [1], which is correct for all
julian days, provided you use mathematical integer division (round to
negative infinity) rather than c++11 integer division (round to zero).
[1] http://www.tondering.dk/claus/cal/julperiod.php
While the conversion code works for up to around JD +/- (2^63/4), we
only use an int for the year in the API, so this patch limits minJd()
and maxJd() to 1 Jan (2^31) BC and 31 Dec (2^31-1) AD, respectively.
Note that while the new conversion code looks like it would be more
expensive than the old, gcc will in fact be able to optimize it to be
slightly faster (probably because x86 hardware implements round to
negative infinity, and so GCC manages to optimize floordiv to a single
instruction, compared to the three instuctions needed for operator/).
In the following test application, run with a release mode Qt and
redirecting stderr to /dev/null, I measured an improvement from
6.81s +/- 0.08s to 6.26s +/- 0.16s user time over five runs on an
otherwise idle x86_64 system.
int main(int, char *[])
{
int year, month, day;
qint64 jd;
for (qint64 i = Q_INT64_C(-1048576) ; i < Q_INT64_C(1048576); ++i) {
QDate::fromJulianDay(i).getDate(&year, &month, &day);
jd = QDate(year, month, day).toJulianDay();
qDebug() << jd << year << month << day;
}
}
Change-Id: Ifd0dd01f0027f260401f7f9b4f1201d2b7a3b087
Reviewed-by: David Faure (KDE) <faure@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
hasUnquotedAP currently only checks for an a or A, which is wrong
according to both the toString documentation and the comments for
hasUnquotedAP.
Change-Id: I03015734b846fe761085cf8f8fca2b29210cff97
Reviewed-by: Jon Severinsson <jon@severinsson.net>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
We can insert directly on the most left-most Node.
We always enforce an insert here (unlike the insert call),
but that is not a problem since the keys in a std::map are unique.
Change-Id: Ib409b90ffc57a5a43dab4a4b08d34f6fdabd057f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This suggestion keeps track of the most left node.
The point is that constBegin() becomes a lot faster.
That speeds up iteration a bit, and makes it O(1) to get the
first element. The penalty in insert and remove is very small.
On large trees it seems to be less than 1%.
It should be noticed that constBegin() is a very common hint
on my planned change to 5.1, and this opperation will without
this patch cost 2 x log N. One when the user calls the hint
with begin - and one where it is compared with begin.
Other std::maps has a very fast begin(). E.g
http://www.cplusplus.com/reference/stl/map/begin/
(begin with constant time)
Change-Id: I221f6755aa8bd16a5189771c5bc8ae56c8ee0fb4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Instead omit the whole tests when appropriate.
In particular:
- When Q_CC_HPACC is defined the tests fromStdString and toStdString are
crashing. Omit the tests in this configuration since the compiler is not
supported.
- Clean the localeAwareCompare() by removing the code where Q_OS_WIN is
defined but not Q_OS_WINCE. System and user locale cannot be set on
Q_OS_WIN other than Win CE and some code could never be reached.
Change-Id: I72ae3246bf8c2a73d14cce45dde14bcb8001d8b3
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
This is in line with what QTime::addMSecs and QDate::addDays do, for
example.
Change-Id: I902112486727f74f669a97bde6c42028e0838f8d
Reviewed-by: Jon Severinsson <jon@severinsson.net>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Some statements could not be tested, such as default cases of switches
where all possible cases are already handled and some statements where
the system locale is used.
I also removed some statements that would never be reached and hence
will never be able to be covered by tests.
Change-Id: I8ea3071f66d942d986e65708732af6751d36b5e3
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Converting the date 1 January 0001 to a string in the format
"dd MMMM yyyy" currently results in the string "01 January 1", but it
should be "01 January 0001".
Task-number: QTBUG-27287
Change-Id: Ia025da7343d1c36aaee34c47c6db551a6e89595f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Two lines were commented out but were removed with
Ib6ceb1cb7fb4c6eca672495f96d9cfd907853c85. They have been replaced
as expected fails.
Task-number: QTBUG-22833
Change-Id: Ib154a31bffcdc8e43c6ad236df193e99334652c6
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
remove() can use non-detaching iterators internally before calling
erase(), which hasn't been exploited so far, so that the detach() in
erase() never actually detached. When using erase() from outside,
you can't do it legally without calling begin() or end() that detach()
before erase() is called.
Now remove() doesn't detach anymore, and detaching in erase() works.
With new tests that fail after changing only the erase() callers
and pass again after fixing erase().
Change-Id: I47c0a9e362dce8628ec566f5437d951755de96c8
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Instead omit the whole test when Q_COMPILER_INITIALIZER_LISTS
is not defined.
Change-Id: I34017484a027b95a2677e1c4cb9231fa2aeb5680
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Instead omit the whole test when appropriate.
Change-Id: Iebd569676cc7b2f8fe4a1d272107e092410d397b
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
These containers don't make sense and will just result in no action
being taken (all items added will simply be discarded), but it
shouldn't crash due to a division by zero.
Update the documentation to explain the fact.
Task-number: QTBUG-27339
Change-Id: Ib9acf5c0a9a826e6853e7beaf5e56511fde98dc6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Ian Walters <ian@walters.id.au>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Instead omit the whole test when Q_OS_WIN is not defined.
Change-Id: I311538ce839353d4d5e83edfd12c68968fe61215
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Instead omit the whole test when Q_COMPILER_LAMBDA is not defined since
the test is not relevant in that case.
Change-Id: I541da96a881fa0c9be38ae5c0f86df047dd8fc6b
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Add BoundaryReason::BreakOpportunity flag that will be returned by the
boundaryReasons() when the boundary finder is at the break opportunity
position that might be not an item boundary.
This is the same as (StartWord || EndWord) in Grapheme and Sentence modes;
in Word and Line modes, BreakOpportunity flag might occur between the words
or in between of Line boundaries (e.g. in conjunction with SoftHyphen flag).
In other words, the text boundaries are always break opportunities, but not vice versa.
StartWord and EndWord flags has been deprecated by new StartOfItem and EndOfItem
flags which are not about the word boundaries only. In line breaking,
StartOfItem and EndOfItem are set for the mandatory breaks only.
Change-Id: I79bf297e2b988f5976f30cff0c8ca616385f6552
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
that will be returned by boundaryReasons() when the boundary finder
is at the line end position (CR, LF, NewLine Function, End of Text, etc.).
The MandatoryBreak flag, if set, means the text should be wrapped at a given position.
Change-Id: I32d4f570935d2e015bfc5f18915396a15f009fde
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
addMSecs() / msecsTo() have always used qint64, and when QDate was changed
to use a 64-bit julian day, QDateTime::addDays() and QDateTime::daysTo() was
changed to use qint64 in order to support the full extended range, but
addSecs() and secsTo() seems to have been forgotten.
Change-Id: I3acc35ee2bcc9f353650eb42f97d428f706b2db6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Version 6.2 of the Unicode Standard is a special release
dedicated to the early publication of the newly encoded Turkish lira sign.
In addition, there are some significant changes to the Unicode algorithms
for text segmentation and line breaking to improve breaking for emoji symbols.
For more details, see http://www.unicode.org/versions/Unicode6.2.0/
Change-Id: I21cfd4f307e41b41a19d36cce87f7a44c2661bc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The test is useless as we assert if the requested size exceeds
a certain limit. We could, as an alternative,
throw an exception, but in the end it's the caller's responsibility
to ensure that the requested size is a sane value.
Task-number: QTBUG-27285
Change-Id: I738950a6a2b51671a54e4d25c7e4c3ac0d7f63b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
for the case when the boundary finder is assigned to an invalid one.
Change-Id: I5b60984ff3fd99972fcae21895684bd83b012780
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>