tests/auto/qlocale/tst_qlocale.cpp
changeset 29 b72c6db6890b
parent 18 2f34d5167611
equal deleted inserted replaced
25:e24348a560a6 29:b72c6db6890b
   174     { \
   174     { \
   175     	QLocale l(QLocale::req_lang, QLocale::req_country); \
   175     	QLocale l(QLocale::req_lang, QLocale::req_country); \
   176 	QCOMPARE(l.language(), exp_lang); \
   176 	QCOMPARE(l.language(), exp_lang); \
   177 	QCOMPARE(l.country(), exp_country); \
   177 	QCOMPARE(l.country(), exp_country); \
   178     }
   178     }
       
   179     {
       
   180         QLocale l(QLocale::C, QLocale::AnyCountry);
       
   181         QCOMPARE(l.language(), QLocale::C);
       
   182         QCOMPARE(l.country(), QLocale::AnyCountry);
       
   183     }
   179     TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
   184     TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
   180     TEST_CTOR(Aymara, AnyCountry, default_lang, default_country)
   185     TEST_CTOR(Aymara, AnyCountry, default_lang, default_country)
   181     TEST_CTOR(Aymara, France, default_lang, default_country)
   186     TEST_CTOR(Aymara, France, default_lang, default_country)
   182 
   187 
   183     TEST_CTOR(English, AnyCountry, QLocale::English, QLocale::UnitedStates)
   188     TEST_CTOR(English, AnyCountry, QLocale::English, QLocale::UnitedStates)
   185     TEST_CTOR(English, France, QLocale::English, QLocale::UnitedStates)
   190     TEST_CTOR(English, France, QLocale::English, QLocale::UnitedStates)
   186     TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
   191     TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
   187 
   192 
   188     TEST_CTOR(French, France, QLocale::French, QLocale::France)
   193     TEST_CTOR(French, France, QLocale::French, QLocale::France)
   189     TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
   194     TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
       
   195     TEST_CTOR(Spanish, LatinAmericaAndTheCaribbean, QLocale::Spanish, QLocale::LatinAmericaAndTheCaribbean)
   190 
   196 
   191     QLocale::setDefault(QLocale(QLocale::English, QLocale::France));
   197     QLocale::setDefault(QLocale(QLocale::English, QLocale::France));
   192 
   198 
   193     {
   199     {
   194 	QLocale l;
   200 	QLocale l;
   316     TEST_CTOR("nb", Norwegian, Norway)
   322     TEST_CTOR("nb", Norwegian, Norway)
   317     TEST_CTOR("nn", NorwegianNynorsk, Norway)
   323     TEST_CTOR("nn", NorwegianNynorsk, Norway)
   318     TEST_CTOR("no_NO", Norwegian, Norway)
   324     TEST_CTOR("no_NO", Norwegian, Norway)
   319     TEST_CTOR("nb_NO", Norwegian, Norway)
   325     TEST_CTOR("nb_NO", Norwegian, Norway)
   320     TEST_CTOR("nn_NO", NorwegianNynorsk, Norway)
   326     TEST_CTOR("nn_NO", NorwegianNynorsk, Norway)
       
   327     TEST_CTOR("es_ES", Spanish, Spain)
       
   328     TEST_CTOR("es_419", Spanish, LatinAmericaAndTheCaribbean)
       
   329 
       
   330     // test default countries for languages
       
   331     TEST_CTOR("mn", Mongolian, Mongolia)
       
   332     TEST_CTOR("ne", Nepali, Nepal)
   321 
   333 
   322 #undef TEST_CTOR
   334 #undef TEST_CTOR
   323 
   335 
   324 }
   336 }
   325 
   337 
  1015     QTest::newRow("12no_NO") << "no_NO" << QDateTime(QDate(1974, 12, 1), QTime(15, 0, 0))
  1027     QTest::newRow("12no_NO") << "no_NO" << QDateTime(QDate(1974, 12, 1), QTime(15, 0, 0))
  1016                              << "d'd'dd/M/yyh" << "1d01/12/7415";
  1028                              << "d'd'dd/M/yyh" << "1d01/12/7415";
  1017 
  1029 
  1018     QTest::newRow("RFC-1123") << "C" << QDateTime(QDate(2007, 11, 1), QTime(18, 8, 30))
  1030     QTest::newRow("RFC-1123") << "C" << QDateTime(QDate(2007, 11, 1), QTime(18, 8, 30))
  1019                               << "ddd, dd MMM yyyy hh:mm:ss 'GMT'" << "Thu, 01 Nov 2007 18:08:30 GMT";
  1031                               << "ddd, dd MMM yyyy hh:mm:ss 'GMT'" << "Thu, 01 Nov 2007 18:08:30 GMT";
       
  1032 
       
  1033     QTest::newRow("longFormat") << "en_US" << QDateTime(QDate(2009, 1, 5), QTime(11, 48, 32))
       
  1034                       << "dddd, MMMM d, yyyy h:mm:ss AP " << "Monday, January 5, 2009 11:48:32 AM ";
  1020 }
  1035 }
  1021 
  1036 
  1022 void tst_QLocale::toDateTime()
  1037 void tst_QLocale::toDateTime()
  1023 {
  1038 {
  1024     QFETCH(QString, localeName);
  1039     QFETCH(QString, localeName);
  1026     QFETCH(QString, format);
  1041     QFETCH(QString, format);
  1027     QFETCH(QString, string);
  1042     QFETCH(QString, string);
  1028 
  1043 
  1029     QLocale l(localeName);
  1044     QLocale l(localeName);
  1030     QCOMPARE(l.toDateTime(string, format), result);
  1045     QCOMPARE(l.toDateTime(string, format), result);
       
  1046     if (l.dateTimeFormat(QLocale::LongFormat) == format)
       
  1047         QCOMPARE(l.toDateTime(string, QLocale::LongFormat), result);
  1031 }
  1048 }
  1032 
  1049 
  1033 void tst_QLocale::macDefaultLocale()
  1050 void tst_QLocale::macDefaultLocale()
  1034 {
  1051 {
  1035 #ifndef Q_OS_MAC
  1052 #ifndef Q_OS_MAC
  1309     {      8,   223}, // Arabic/UnitedArabEmirates
  1326     {      8,   223}, // Arabic/UnitedArabEmirates
  1310     {      8,   237}, // Arabic/Yemen
  1327     {      8,   237}, // Arabic/Yemen
  1311     {      9,    11}, // Armenian/Armenia
  1328     {      9,    11}, // Armenian/Armenia
  1312     {     10,   100}, // Assamese/India
  1329     {     10,   100}, // Assamese/India
  1313     {     12,    15}, // Azerbaijani/Azerbaijan
  1330     {     12,    15}, // Azerbaijani/Azerbaijan
       
  1331     {     12,   102}, // Azerbaijani/Iran
  1314     {     14,   197}, // Basque/Spain
  1332     {     14,   197}, // Basque/Spain
  1315     {     15,    18}, // Bengali/Bangladesh
  1333     {     15,    18}, // Bengali/Bangladesh
  1316     {     15,   100}, // Bengali/India
  1334     {     15,   100}, // Bengali/India
  1317     {     16,    25}, // Bhutani/Bhutan
  1335     {     16,    25}, // Bhutani/Bhutan
       
  1336     {     19,    74}, // Breton/France
  1318     {     20,    33}, // Bulgarian/Bulgaria
  1337     {     20,    33}, // Bulgarian/Bulgaria
  1319     {     21,   147}, // Burmese/Myanmar
  1338     {     21,   147}, // Burmese/Myanmar
  1320     {     22,    20}, // Byelorussian/Belarus
  1339     {     22,    20}, // Byelorussian/Belarus
  1321     {     23,    36}, // Cambodian/Cambodia
  1340     {     23,    36}, // Cambodian/Cambodia
  1322     {     24,   197}, // Catalan/Spain
  1341     {     24,   197}, // Catalan/Spain
  1342     {     31,   100}, // English/India
  1361     {     31,   100}, // English/India
  1343     {     31,   104}, // English/Ireland
  1362     {     31,   104}, // English/Ireland
  1344     {     31,   107}, // English/Jamaica
  1363     {     31,   107}, // English/Jamaica
  1345     {     31,   133}, // English/Malta
  1364     {     31,   133}, // English/Malta
  1346     {     31,   134}, // English/MarshallIslands
  1365     {     31,   134}, // English/MarshallIslands
       
  1366     {     31,   137}, // English/Mauritius
  1347     {     31,   148}, // English/Namibia
  1367     {     31,   148}, // English/Namibia
  1348     {     31,   154}, // English/NewZealand
  1368     {     31,   154}, // English/NewZealand
  1349     {     31,   160}, // English/NorthernMarianaIslands
  1369     {     31,   160}, // English/NorthernMarianaIslands
  1350     {     31,   163}, // English/Pakistan
  1370     {     31,   163}, // English/Pakistan
  1351     {     31,   170}, // English/Philippines
  1371     {     31,   170}, // English/Philippines
  1359     {     33,    68}, // Estonian/Estonia
  1379     {     33,    68}, // Estonian/Estonia
  1360     {     34,    71}, // Faroese/FaroeIslands
  1380     {     34,    71}, // Faroese/FaroeIslands
  1361     {     36,    73}, // Finnish/Finland
  1381     {     36,    73}, // Finnish/Finland
  1362     {     37,    74}, // French/France
  1382     {     37,    74}, // French/France
  1363     {     37,    21}, // French/Belgium
  1383     {     37,    21}, // French/Belgium
       
  1384     {     37,    37}, // French/Cameroon
  1364     {     37,    38}, // French/Canada
  1385     {     37,    38}, // French/Canada
       
  1386     {     37,    41}, // French/CentralAfricanRepublic
       
  1387     {     37,    53}, // French/IvoryCoast
       
  1388     {     37,    88}, // French/Guadeloupe
       
  1389     {     37,    91}, // French/Guinea
  1365     {     37,   125}, // French/Luxembourg
  1390     {     37,   125}, // French/Luxembourg
       
  1391     {     37,   128}, // French/Madagascar
       
  1392     {     37,   132}, // French/Mali
       
  1393     {     37,   135}, // French/Martinique
  1366     {     37,   142}, // French/Monaco
  1394     {     37,   142}, // French/Monaco
       
  1395     {     37,   156}, // French/Niger
       
  1396     {     37,   176}, // French/Reunion
  1367     {     37,   187}, // French/Senegal
  1397     {     37,   187}, // French/Senegal
  1368     {     37,   206}, // French/Switzerland
  1398     {     37,   206}, // French/Switzerland
       
  1399     {     37,   244}, // French/Saint Barthelemy
       
  1400     {     37,   245}, // French/Saint Martin
  1369     {     40,   197}, // Galician/Spain
  1401     {     40,   197}, // Galician/Spain
  1370     {     41,    81}, // Georgian/Georgia
  1402     {     41,    81}, // Georgian/Georgia
  1371     {     42,    82}, // German/Germany
  1403     {     42,    82}, // German/Germany
  1372     {     42,    14}, // German/Austria
  1404     {     42,    14}, // German/Austria
  1373     {     42,    21}, // German/Belgium
  1405     {     42,    21}, // German/Belgium
  1394     {     61,   100}, // Kannada/India
  1426     {     61,   100}, // Kannada/India
  1395     {     63,   110}, // Kazakh/Kazakhstan
  1427     {     63,   110}, // Kazakh/Kazakhstan
  1396     {     64,   179}, // Kinyarwanda/Rwanda
  1428     {     64,   179}, // Kinyarwanda/Rwanda
  1397     {     65,   116}, // Kirghiz/Kyrgyzstan
  1429     {     65,   116}, // Kirghiz/Kyrgyzstan
  1398     {     66,   114}, // Korean/RepublicOfKorea
  1430     {     66,   114}, // Korean/RepublicOfKorea
       
  1431     {     67,   102}, // Kurdish/Iran
       
  1432     {     67,   103}, // Kurdish/Iraq
       
  1433     {     67,   207}, // Kurdish/SyrianArabRepublic
  1399     {     67,   217}, // Kurdish/Turkey
  1434     {     67,   217}, // Kurdish/Turkey
  1400     {     69,   117}, // Laothian/Lao
  1435     {     69,   117}, // Laothian/Lao
  1401     {     71,   118}, // Latvian/Latvia
  1436     {     71,   118}, // Latvian/Latvia
  1402     {     72,    49}, // Lingala/DemocraticRepublicOfCongo
  1437     {     72,    49}, // Lingala/DemocraticRepublicOfCongo
  1403     {     72,    50}, // Lingala/PeoplesRepublicOfCongo
  1438     {     72,    50}, // Lingala/PeoplesRepublicOfCongo
  1404     {     73,   124}, // Lithuanian/Lithuania
  1439     {     73,   124}, // Lithuanian/Lithuania
  1405     {     74,   127}, // Macedonian/Macedonia
  1440     {     74,   127}, // Macedonian/Macedonia
       
  1441     {     75,   128}, // Malagasy/Madagascar
  1406     {     76,   130}, // Malay/Malaysia
  1442     {     76,   130}, // Malay/Malaysia
  1407     {     76,    32}, // Malay/BruneiDarussalam
  1443     {     76,    32}, // Malay/BruneiDarussalam
  1408     {     77,   100}, // Malayalam/India
  1444     {     77,   100}, // Malayalam/India
  1409     {     78,   133}, // Maltese/Malta
  1445     {     78,   133}, // Maltese/Malta
       
  1446     {     79,   154}, // Maori/NewZealand
  1410     {     80,   100}, // Marathi/India
  1447     {     80,   100}, // Marathi/India
  1411     {     82,    44}, // Mongolian/China
  1448     {     82,    44}, // Mongolian/China
  1412     {     82,   143}, // Mongolian/Mongolia
  1449     {     82,   143}, // Mongolian/Mongolia
  1413     {     84,   100}, // Nepali/India
  1450     {     84,   100}, // Nepali/India
  1414     {     84,   150}, // Nepali/Nepal
  1451     {     84,   150}, // Nepali/Nepal
  1415     {     85,   161}, // Norwegian/Norway
  1452     {     85,   161}, // Norwegian/Norway
       
  1453     {     86,    74}, // Occitan/France
  1416     {     87,   100}, // Oriya/India
  1454     {     87,   100}, // Oriya/India
  1417     {     88,     1}, // Pashto/Afghanistan
  1455     {     88,     1}, // Pashto/Afghanistan
  1418     {     89,   102}, // Persian/Iran
  1456     {     89,   102}, // Persian/Iran
  1419     {     89,     1}, // Persian/Afghanistan
  1457     {     89,     1}, // Persian/Afghanistan
  1420     {     90,   172}, // Polish/Poland
  1458     {     90,   172}, // Polish/Poland
  1421     {     91,   173}, // Portuguese/Portugal
  1459     {     91,   173}, // Portuguese/Portugal
  1422     {     91,    30}, // Portuguese/Brazil
  1460     {     91,    30}, // Portuguese/Brazil
       
  1461     {     91,    92}, // Portuguese/GuineaBissau
       
  1462     {     91,   146}, // Portuguese/Mozambique
  1423     {     92,   100}, // Punjabi/India
  1463     {     92,   100}, // Punjabi/India
  1424     {     92,   163}, // Punjabi/Pakistan
  1464     {     92,   163}, // Punjabi/Pakistan
       
  1465     {     94,   206}, // RhaetoRomance/Switzerland
  1425     {     95,   141}, // Romanian/Moldova
  1466     {     95,   141}, // Romanian/Moldova
  1426     {     95,   177}, // Romanian/Romania
  1467     {     95,   177}, // Romanian/Romania
  1427     {     96,   178}, // Russian/RussianFederation
  1468     {     96,   178}, // Russian/RussianFederation
       
  1469     {     96,   141}, // Russian/Moldova
  1428     {     96,   222}, // Russian/Ukraine
  1470     {     96,   222}, // Russian/Ukraine
       
  1471     {     98,    41}, // Sangho/CentralAfricanRepublic
  1429     {     99,   100}, // Sanskrit/India
  1472     {     99,   100}, // Sanskrit/India
  1430     {    100,   241}, // Serbian/SerbiaAndMontenegro
  1473     {    100,   241}, // Serbian/SerbiaAndMontenegro
  1431     {    100,    27}, // Serbian/BosniaAndHerzegowina
  1474     {    100,    27}, // Serbian/BosniaAndHerzegowina
  1432     {    100,   238}, // Serbian/Yugoslavia
  1475     {    100,   238}, // Serbian/Yugoslavia
       
  1476     {    100,   242}, // Serbian/Montenegro
       
  1477     {    100,   243}, // Serbian/Serbia
  1433     {    101,   241}, // SerboCroatian/SerbiaAndMontenegro
  1478     {    101,   241}, // SerboCroatian/SerbiaAndMontenegro
  1434     {    101,    27}, // SerboCroatian/BosniaAndHerzegowina
  1479     {    101,    27}, // SerboCroatian/BosniaAndHerzegowina
  1435     {    101,   238}, // SerboCroatian/Yugoslavia
  1480     {    101,   238}, // SerboCroatian/Yugoslavia
  1436     {    102,   120}, // Sesotho/Lesotho
  1481     {    102,   120}, // Sesotho/Lesotho
  1437     {    102,   195}, // Sesotho/SouthAfrica
  1482     {    102,   195}, // Sesotho/SouthAfrica
  1438     {    103,   195}, // Setswana/SouthAfrica
  1483     {    103,   195}, // Setswana/SouthAfrica
       
  1484     {    104,   240}, // Shona/Zimbabwe
  1439     {    106,   198}, // Singhalese/SriLanka
  1485     {    106,   198}, // Singhalese/SriLanka
  1440     {    107,   195}, // Siswati/SouthAfrica
  1486     {    107,   195}, // Siswati/SouthAfrica
  1441     {    107,   204}, // Siswati/Swaziland
  1487     {    107,   204}, // Siswati/Swaziland
  1442     {    108,   191}, // Slovak/Slovakia
  1488     {    108,   191}, // Slovak/Slovakia
  1443     {    109,   192}, // Slovenian/Slovenia
  1489     {    109,   192}, // Slovenian/Slovenia
  1452     {    111,    47}, // Spanish/Colombia
  1498     {    111,    47}, // Spanish/Colombia
  1453     {    111,    52}, // Spanish/CostaRica
  1499     {    111,    52}, // Spanish/CostaRica
  1454     {    111,    61}, // Spanish/DominicanRepublic
  1500     {    111,    61}, // Spanish/DominicanRepublic
  1455     {    111,    63}, // Spanish/Ecuador
  1501     {    111,    63}, // Spanish/Ecuador
  1456     {    111,    65}, // Spanish/ElSalvador
  1502     {    111,    65}, // Spanish/ElSalvador
       
  1503     {    111,    66}, // Spanish/EquatorialGuinea
  1457     {    111,    90}, // Spanish/Guatemala
  1504     {    111,    90}, // Spanish/Guatemala
  1458     {    111,    96}, // Spanish/Honduras
  1505     {    111,    96}, // Spanish/Honduras
  1459     {    111,   139}, // Spanish/Mexico
  1506     {    111,   139}, // Spanish/Mexico
  1460     {    111,   155}, // Spanish/Nicaragua
  1507     {    111,   155}, // Spanish/Nicaragua
  1461     {    111,   166}, // Spanish/Panama
  1508     {    111,   166}, // Spanish/Panama
  1469     {    113,   210}, // Swahili/Tanzania
  1516     {    113,   210}, // Swahili/Tanzania
  1470     {    114,   205}, // Swedish/Sweden
  1517     {    114,   205}, // Swedish/Sweden
  1471     {    114,    73}, // Swedish/Finland
  1518     {    114,    73}, // Swedish/Finland
  1472     {    116,   209}, // Tajik/Tajikistan
  1519     {    116,   209}, // Tajik/Tajikistan
  1473     {    117,   100}, // Tamil/India
  1520     {    117,   100}, // Tamil/India
       
  1521     {    117,   198}, // Tamil/SriLanka
  1474     {    118,   178}, // Tatar/RussianFederation
  1522     {    118,   178}, // Tatar/RussianFederation
  1475     {    119,   100}, // Telugu/India
  1523     {    119,   100}, // Telugu/India
  1476     {    120,   211}, // Thai/Thailand
  1524     {    120,   211}, // Thai/Thailand
       
  1525     {    121,    44}, // Tibetan/China
       
  1526     {    121,   100}, // Tibetan/India
  1477     {    122,    67}, // Tigrinya/Eritrea
  1527     {    122,    67}, // Tigrinya/Eritrea
  1478     {    122,    69}, // Tigrinya/Ethiopia
  1528     {    122,    69}, // Tigrinya/Ethiopia
  1479     {    123,   214}, // Tonga/Tonga
  1529     {    123,   214}, // Tonga/Tonga
  1480     {    124,   195}, // Tsonga/SouthAfrica
  1530     {    124,   195}, // Tsonga/SouthAfrica
  1481     {    125,   217}, // Turkish/Turkey
  1531     {    125,   217}, // Turkish/Turkey
  1512     {    158,   157}, // Jju/Nigeria
  1562     {    158,   157}, // Jju/Nigeria
  1513     {    159,   106}, // Friulian/Italy
  1563     {    159,   106}, // Friulian/Italy
  1514     {    160,   195}, // Venda/SouthAfrica
  1564     {    160,   195}, // Venda/SouthAfrica
  1515     {    161,    83}, // Ewe/Ghana
  1565     {    161,    83}, // Ewe/Ghana
  1516     {    161,   212}, // Ewe/Togo
  1566     {    161,   212}, // Ewe/Togo
       
  1567     {    162,    69}, // Walamo/Ethiopia
  1517     {    163,   225}, // Hawaiian/UnitedStates
  1568     {    163,   225}, // Hawaiian/UnitedStates
  1518     {    164,   157}, // Tyap/Nigeria
  1569     {    164,   157}, // Tyap/Nigeria
  1519     {    165,   129}  // Chewa/Malawi
  1570     {    165,   129}, // Chewa/Malawi
       
  1571     {    166,   170}, // Filipino/Philippines
       
  1572     {    167,   206}, // Swiss German/Switzerland
       
  1573     {    168,    44}, // Sichuan Yi/China
       
  1574     {    169,    91}, // Kpelle/Guinea
       
  1575     {    169,   121}, // Kpelle/Liberia
       
  1576     {    170,    82}, // Low German/Germany
       
  1577     {    171,   195}, // South Ndebele/SouthAfrica
       
  1578     {    172,   195}, // Northern Sotho/SouthAfrica
       
  1579     {    173,    73}, // Northern Sami/Finland
       
  1580     {    173,   161}, // Northern Sami/Norway
       
  1581     {    174,   208}, // Taroko/Taiwan
       
  1582     {    175,   111}, // Gusii/Kenya
       
  1583     {    176,   111}, // Taita/Kenya
       
  1584     {    177,   187}, // Fulah/Senegal
       
  1585     {    178,   111}, // Kikuyu/Kenya
       
  1586     {    179,   111}, // Samburu/Kenya
       
  1587     {    180,   146}, // Sena/Mozambique
       
  1588     {    181,   240}, // North Ndebele/Zimbabwe
       
  1589     {    182,   210}, // Rombo/Tanzania
       
  1590     {    183,   145}, // Tachelhit/Morocco
       
  1591     {    184,     3}, // Kabyle/Algeria
       
  1592     {    185,   221}, // Nyankole/Uganda
       
  1593     {    186,   210}, // Bena/Tanzania
       
  1594     {    187,   210}, // Vunjo/Tanzania
       
  1595     {    188,   132}, // Bambara/Mali
       
  1596     {    189,   111}, // Embu/Kenya
       
  1597     {    190,   225}, // Cherokee/UnitedStates
       
  1598     {    191,   137}, // Morisyen/Mauritius
       
  1599     {    192,   210}, // Makonde/Tanzania
       
  1600     {    193,   210}, // Langi/Tanzania
       
  1601     {    194,   221}, // Ganda/Uganda
       
  1602     {    195,   239}, // Bemba/Zambia
       
  1603     {    196,    39}, // Kabuverdianu/CapeVerde
       
  1604     {    197,   111}, // Meru/Kenya
       
  1605     {    198,   111}, // Kalenjin/Kenya
       
  1606     {    199,   148}, // Nama/Namibia
       
  1607     {    200,   210}, // Machame/Tanzania
       
  1608     {    201,    82}, // Colognian/Germany
       
  1609     {    202,   111}, // Masai/Kenya
       
  1610     {    202,   210}, // Masai/Tanzania
       
  1611     {    203,   221}, // Soga/Uganda
       
  1612     {    204,   111}, // Luyia/Kenya
       
  1613     {    205,   210}, // Asu/Tanzania
       
  1614     {    206,   111}, // Teso/Kenya
       
  1615     {    206,   221}, // Teso/Uganda
       
  1616     {    207,    67}, // Saho/Eritrea
       
  1617     {    208,   132}, // Koyra Chiini/Mali
       
  1618     {    209,   210}, // Rwa/Tanzania
       
  1619     {    210,   111}, // Luo/Kenya
       
  1620     {    211,   221}, // Chiga/Uganda
       
  1621     {    212,   145}, // Central Morocco Tamazight/Morocco
       
  1622     {    213,   132}, // Koyraboro Senni/Mali
       
  1623     {    214,   210}  // Shambala/Tanzania
  1520 };
  1624 };
  1521 static const int g_locale_list_count = sizeof(g_locale_list)/sizeof(g_locale_list[0]);
  1625 static const int g_locale_list_count = sizeof(g_locale_list)/sizeof(g_locale_list[0]);
  1522 
  1626 
  1523 
  1627 
  1524 void tst_QLocale::testNames()
  1628 void tst_QLocale::testNames()
  1573     QTest::newRow("C short")  << QString("C") << QString("Sun") << 7 << QLocale::ShortFormat;
  1677     QTest::newRow("C short")  << QString("C") << QString("Sun") << 7 << QLocale::ShortFormat;
  1574     QTest::newRow("C narrow")  << QString("C") << QString("7") << 7 << QLocale::NarrowFormat;
  1678     QTest::newRow("C narrow")  << QString("C") << QString("7") << 7 << QLocale::NarrowFormat;
  1575 
  1679 
  1576     QTest::newRow("ru_RU long")  << QString("ru_RU") << QString::fromUtf8("\320\262\320\276\321\201\320\272\321\200\320\265\321\201\320\265\320\275\321\214\320\265") << 7 << QLocale::LongFormat;
  1680     QTest::newRow("ru_RU long")  << QString("ru_RU") << QString::fromUtf8("\320\262\320\276\321\201\320\272\321\200\320\265\321\201\320\265\320\275\321\214\320\265") << 7 << QLocale::LongFormat;
  1577     QTest::newRow("ru_RU short")  << QString("ru_RU") << QString::fromUtf8("\320\222\321\201") << 7 << QLocale::ShortFormat;
  1681     QTest::newRow("ru_RU short")  << QString("ru_RU") << QString::fromUtf8("\320\222\321\201") << 7 << QLocale::ShortFormat;
  1578     QTest::newRow("ru_RU narrow")  << QString("ru_RU") << QString::fromUtf8("") << 7 << QLocale::NarrowFormat;
  1682     QTest::newRow("ru_RU narrow")  << QString("ru_RU") << QString::fromUtf8("\320\222") << 7 << QLocale::NarrowFormat;
  1579 }
  1683 }
  1580 
  1684 
  1581 void tst_QLocale::dayName()
  1685 void tst_QLocale::dayName()
  1582 {
  1686 {
  1583     QFETCH(QString, locale_name);
  1687     QFETCH(QString, locale_name);
  1892     QLocale sv("sv_SE");
  1996     QLocale sv("sv_SE");
  1893     QCOMPARE(sv.amText(), QLatin1String("fm"));
  1997     QCOMPARE(sv.amText(), QLatin1String("fm"));
  1894     QCOMPARE(sv.pmText(), QLatin1String("em"));
  1998     QCOMPARE(sv.pmText(), QLatin1String("em"));
  1895 
  1999 
  1896     QLocale nn("nl_NL");
  2000     QLocale nn("nl_NL");
  1897     QCOMPARE(nn.amText(), QLatin1String(""));
  2001     QCOMPARE(nn.amText(), QLatin1String("AM"));
  1898     QCOMPARE(nn.pmText(), QLatin1String(""));
  2002     QCOMPARE(nn.pmText(), QLatin1String("PM"));
  1899 
  2003 
  1900     QLocale ua("uk_UA");
  2004     QLocale ua("uk_UA");
  1901     QCOMPARE(ua.amText(), QString::fromUtf8("\320\264\320\277"));
  2005     QCOMPARE(ua.amText(), QString::fromUtf8("\320\264\320\277"));
  1902     QCOMPARE(ua.pmText(), QString::fromUtf8("\320\277\320\277"));
  2006     QCOMPARE(ua.pmText(), QString::fromUtf8("\320\277\320\277"));
  1903 }
  2007 }
  1919     const QLocale c(QLocale::C);
  2023     const QLocale c(QLocale::C);
  1920     // check that the NarrowFormat is the same as ShortFormat.
  2024     // check that the NarrowFormat is the same as ShortFormat.
  1921     QCOMPARE(c.timeFormat(QLocale::NarrowFormat), c.timeFormat(QLocale::ShortFormat));
  2025     QCOMPARE(c.timeFormat(QLocale::NarrowFormat), c.timeFormat(QLocale::ShortFormat));
  1922 
  2026 
  1923     const QLocale no("no_NO");
  2027     const QLocale no("no_NO");
  1924     QCOMPARE(no.timeFormat(QLocale::NarrowFormat), QLatin1String("HH.mm"));
  2028     QCOMPARE(no.timeFormat(QLocale::NarrowFormat), QLatin1String("HH:mm"));
  1925     QCOMPARE(no.timeFormat(QLocale::ShortFormat), QLatin1String("HH.mm"));
  2029     QCOMPARE(no.timeFormat(QLocale::ShortFormat), QLatin1String("HH:mm"));
  1926     QCOMPARE(no.timeFormat(QLocale::LongFormat), QLatin1String("'kl'. HH.mm.ss "));
  2030     QCOMPARE(no.timeFormat(QLocale::LongFormat), QLatin1String("'kl'. HH:mm:ss t"));
  1927 }
  2031 }
  1928 
  2032 
  1929 void tst_QLocale::dateTimeFormat()
  2033 void tst_QLocale::dateTimeFormat()
  1930 {
  2034 {
  1931     const QLocale c(QLocale::C);
  2035     const QLocale c(QLocale::C);
  1932     // check that the NarrowFormat is the same as ShortFormat.
  2036     // check that the NarrowFormat is the same as ShortFormat.
  1933     QCOMPARE(c.dateTimeFormat(QLocale::NarrowFormat), c.dateTimeFormat(QLocale::ShortFormat));
  2037     QCOMPARE(c.dateTimeFormat(QLocale::NarrowFormat), c.dateTimeFormat(QLocale::ShortFormat));
  1934 
  2038 
  1935     const QLocale no("no_NO");
  2039     const QLocale no("no_NO");
  1936     QCOMPARE(no.dateTimeFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.yy HH.mm"));
  2040     QCOMPARE(no.dateTimeFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.yy HH:mm"));
  1937     QCOMPARE(no.dateTimeFormat(QLocale::ShortFormat), QLatin1String("dd.MM.yy HH.mm"));
  2041     QCOMPARE(no.dateTimeFormat(QLocale::ShortFormat), QLatin1String("dd.MM.yy HH:mm"));
  1938     QCOMPARE(no.dateTimeFormat(QLocale::LongFormat), QLatin1String("dddd d. MMMM yyyy 'kl'. HH.mm.ss "));
  2042     QCOMPARE(no.dateTimeFormat(QLocale::LongFormat), QLatin1String("dddd d. MMMM yyyy 'kl'. HH:mm:ss t"));
  1939 }
  2043 }
  1940 
  2044 
  1941 void tst_QLocale::monthName()
  2045 void tst_QLocale::monthName()
  1942 {
  2046 {
  1943     const QLocale c(QLocale::C);
  2047     const QLocale c(QLocale::C);
  1954 
  2058 
  1955     const QLocale de("de_DE");
  2059     const QLocale de("de_DE");
  1956     QCOMPARE(de.monthName(12, QLocale::LongFormat), QLatin1String("Dezember"));
  2060     QCOMPARE(de.monthName(12, QLocale::LongFormat), QLatin1String("Dezember"));
  1957     QCOMPARE(de.monthName(12, QLocale::ShortFormat), QLatin1String("Dez"));
  2061     QCOMPARE(de.monthName(12, QLocale::ShortFormat), QLatin1String("Dez"));
  1958     // 'de' locale doesn't have narrow month name
  2062     // 'de' locale doesn't have narrow month name
  1959     QCOMPARE(de.monthName(12, QLocale::NarrowFormat), QLatin1String(""));
  2063     QCOMPARE(de.monthName(12, QLocale::NarrowFormat), QLatin1String("D"));
  1960 
  2064 
  1961     QLocale ru("ru_RU");
  2065     QLocale ru("ru_RU");
  1962     QCOMPARE(ru.monthName(1, QLocale::LongFormat), QString::fromUtf8("\321\217\320\275\320\262\320\260\321\200\321\217"));
  2066     QCOMPARE(ru.monthName(1, QLocale::LongFormat), QString::fromUtf8("\321\217\320\275\320\262\320\260\321\200\321\217"));
  1963     QCOMPARE(ru.monthName(1, QLocale::ShortFormat), QString::fromUtf8("\321\217\320\275\320\262\56"));
  2067     QCOMPARE(ru.monthName(1, QLocale::ShortFormat), QString::fromUtf8("\321\217\320\275\320\262\56"));
  1964     QCOMPARE(ru.monthName(1, QLocale::NarrowFormat), QString::fromUtf8("")); // empty in CLDR 1.6.1
  2068     QCOMPARE(ru.monthName(1, QLocale::NarrowFormat), QString::fromUtf8("\320\257"));
  1965 }
  2069 }
  1966 
  2070 
  1967 void tst_QLocale::standaloneMonthName()
  2071 void tst_QLocale::standaloneMonthName()
  1968 {
  2072 {
  1969     const QLocale c(QLocale::C);
  2073     const QLocale c(QLocale::C);