tst_qlocale: Add tests for parsing Chakma date and time strings

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>
This commit is contained in:
Ievgenii Meshcheriakov 2021-07-14 10:34:26 +02:00
parent 8f06d3f938
commit a11d7663a8

View File

@ -1945,6 +1945,20 @@ void tst_QLocale::toDateTime_data()
<< "24 Şubat2017 Cuma17:21:25" << true;
QTest::newRow("tr:short")
<< "tr" << dt.addSecs(-25) << "d.MM.yyyy HH:mm" << "25.02.2017 17:21" << true;
QTest::newRow("ccp:short")
<< "ccp" << dt << "dd/M/yy h:mm AP"
// "𑄸𑄻/𑄸/𑄷𑄽 𑄻:𑄸𑄷 PM"
<< QString::fromUcs4(U"\U00011138\U0001113b/\U00011138/\U00011137\U0001113d \U0001113b:"
U"\U00011138\U00011137 PM") << true;
QTest::newRow("ccp:long")
<< "ccp" << dt << "dddd, d MMMM, yyyy h:mm:ss AP"
// "𑄥𑄧𑄚𑄨𑄝𑄢𑄴, 𑄸𑄻 𑄜𑄬𑄛𑄴𑄝𑄳𑄢𑄪𑄠𑄢𑄨, 𑄸𑄶𑄷𑄽 𑄻:𑄸𑄷:𑄸𑄻 PM"
<< QString::fromUcs4(U"\U00011125\U00011127\U0001111a\U00011128\U0001111d\U00011122"
U"\U00011134, \U00011138\U0001113b \U0001111c\U0001112c\U0001111b"
U"\U00011134\U0001111d\U00011133\U00011122\U0001112a\U00011120"
U"\U00011122\U00011128, \U00011138\U00011136\U00011137\U0001113d "
U"\U0001113b:\U00011138\U00011137:\U00011138\U0001113b PM") << true;
}
void tst_QLocale::toDateTime()
@ -1956,6 +1970,8 @@ void tst_QLocale::toDateTime()
QFETCH(bool, clean);
QLocale l(localeName);
QEXPECT_FAIL("ccp:short", "QTBUG-87111: Handling of code points outside BMP is broken", Abort);
QEXPECT_FAIL("ccp:long", "QTBUG-87111: Handling of code points outside BMP is broken", Abort);
QCOMPARE(l.toDateTime(string, format), result);
if (clean) {
QCOMPARE(l.toDateTime(string.toLower(), format), result);