Accept U+2212 as minus sign in negative year unit test

Not all locales use ASCII hyphen-minus U+002D as minus sign. On macOS
using the nb_NO locale the U+2212 character is used instead when
displaying negative years. Verify that one of the two characters is
found.

Fixes: QTBUG-109853
Change-Id: I424539cc8d427ac199b4528e44bef98e45312d07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Øystein Heskestad 2023-01-05 16:54:12 +01:00
parent cac325fdc1
commit e088e01ace

View File

@ -2789,7 +2789,11 @@ void tst_QLocale::dateFormat()
// And, indeed, one for a negative year:
old = sys.toString(QDate(-1173, 5, 1), QLocale::LongFormat);
QVERIFY(!old.isEmpty());
QVERIFY2(old.contains(u"-1173"), qPrintable(old + QLatin1String(" for locale ") + sys.name()));
qsizetype yearDigitStart = old.indexOf(u"1173");
QVERIFY2(yearDigitStart != -1, qPrintable(old + QLatin1String(" for locale ") + sys.name()));
QStringView before = QStringView(old).first(yearDigitStart);
QVERIFY2(before.endsWith(QChar('-')) || before.endsWith(QChar(0x2212)),
qPrintable(old + QLatin1String(" has no minus sign for locale ") + sys.name()));
}
void tst_QLocale::timeFormat()