[locale] Expand tests to check lang

- This shows that one constructor isn't doing it right.
This commit is contained in:
Adriaan de Groot 2019-01-08 14:39:40 +01:00
parent 2345b933cd
commit 8cc0e1f5f9

View File

@ -49,10 +49,12 @@ void LocaleTests::testDefaultLocaleConfiguration()
{
LocaleConfiguration lc( "en_US.UTF-8" );
QVERIFY( !lc.isEmpty() );
QCOMPARE( lc.lang, "en_US.UTF-8" );
QCOMPARE( lc.toBcp47(), "en" );
LocaleConfiguration lc2( "de_DE.UTF-8" );
QVERIFY( !lc2.isEmpty() );
QCOMPARE( lc2.lang, "de_DE.UTF-8" );
QCOMPARE( lc2.toBcp47(), "de" );
}
@ -60,11 +62,13 @@ void LocaleTests::testSplitLocaleConfiguration()
{
LocaleConfiguration lc( "en_US.UTF-8", "de_DE.UTF-8" );
QVERIFY( !lc.isEmpty() );
QCOMPARE( lc.lang, "en_US.UTF-8" );
QCOMPARE( lc.toBcp47(), "en" );
QCOMPARE( lc.lc_numeric, QStringLiteral( "de_DE.UTF-8" ) );
LocaleConfiguration lc2( "de_DE.UTF-8", "da_DK.UTF-8" );
QVERIFY( !lc2.isEmpty() );
QCOMPARE( lc2.lang, "de_DE.UTF-8" );
QCOMPARE( lc2.toBcp47(), "de" );
QCOMPARE( lc2.lc_numeric, "da_DK.UTF-8" );