[locale][packagechooser] Fix tests, QCOMPARE again

This commit is contained in:
Adriaan de Groot 2020-02-21 18:24:39 +01:00
parent 6352b50ed0
commit adf81c0ab5
2 changed files with 18 additions and 18 deletions

View File

@ -48,13 +48,13 @@ LocaleTests::testDefaultLocaleConfiguration()
{ {
LocaleConfiguration lc( "en_US.UTF-8" ); LocaleConfiguration lc( "en_US.UTF-8" );
QVERIFY( !lc.isEmpty() ); QVERIFY( !lc.isEmpty() );
QCOMPARE( lc.language(), "en_US.UTF-8" ); QCOMPARE( lc.language(), QStringLiteral( "en_US.UTF-8" ) );
QCOMPARE( lc.toBcp47(), "en" ); QCOMPARE( lc.toBcp47(), QStringLiteral( "en" ) );
LocaleConfiguration lc2( "de_DE.UTF-8" ); LocaleConfiguration lc2( "de_DE.UTF-8" );
QVERIFY( !lc2.isEmpty() ); QVERIFY( !lc2.isEmpty() );
QCOMPARE( lc2.language(), "de_DE.UTF-8" ); QCOMPARE( lc2.language(), QStringLiteral( "de_DE.UTF-8" ) );
QCOMPARE( lc2.toBcp47(), "de" ); QCOMPARE( lc2.toBcp47(), QStringLiteral( "de" ) );
} }
void void
@ -62,18 +62,18 @@ LocaleTests::testSplitLocaleConfiguration()
{ {
LocaleConfiguration lc( "en_US.UTF-8", "de_DE.UTF-8" ); LocaleConfiguration lc( "en_US.UTF-8", "de_DE.UTF-8" );
QVERIFY( !lc.isEmpty() ); QVERIFY( !lc.isEmpty() );
QCOMPARE( lc.language(), "en_US.UTF-8" ); QCOMPARE( lc.language(), QStringLiteral( "en_US.UTF-8" ) );
QCOMPARE( lc.toBcp47(), "en" ); QCOMPARE( lc.toBcp47(), QStringLiteral( "en" ) );
QCOMPARE( lc.lc_numeric, QStringLiteral( "de_DE.UTF-8" ) ); QCOMPARE( lc.lc_numeric, QStringLiteral( "de_DE.UTF-8" ) );
LocaleConfiguration lc2( "de_DE.UTF-8", "da_DK.UTF-8" ); LocaleConfiguration lc2( "de_DE.UTF-8", "da_DK.UTF-8" );
QVERIFY( !lc2.isEmpty() ); QVERIFY( !lc2.isEmpty() );
QCOMPARE( lc2.language(), "de_DE.UTF-8" ); QCOMPARE( lc2.language(), QStringLiteral( "de_DE.UTF-8" ) );
QCOMPARE( lc2.toBcp47(), "de" ); QCOMPARE( lc2.toBcp47(), QStringLiteral( "de" ) );
QCOMPARE( lc2.lc_numeric, "da_DK.UTF-8" ); QCOMPARE( lc2.lc_numeric, QStringLiteral( "da_DK.UTF-8" ) );
LocaleConfiguration lc3( "da_DK.UTF-8", "de_DE.UTF-8" ); LocaleConfiguration lc3( "da_DK.UTF-8", "de_DE.UTF-8" );
QVERIFY( !lc3.isEmpty() ); QVERIFY( !lc3.isEmpty() );
QCOMPARE( lc3.toBcp47(), "da" ); QCOMPARE( lc3.toBcp47(), QStringLiteral( "da" ) );
QCOMPARE( lc3.lc_numeric, "de_DE.UTF-8" ); QCOMPARE( lc3.lc_numeric, QStringLiteral( "de_DE.UTF-8" ) );
} }

View File

@ -71,21 +71,21 @@ PackageChooserTests::testAppData()
#ifdef HAVE_XML #ifdef HAVE_XML
PackageItem p1 = fromAppData( m ); PackageItem p1 = fromAppData( m );
QVERIFY( p1.isValid() ); QVERIFY( p1.isValid() );
QCOMPARE( p1.id, "io.calamares.calamares.desktop" ); QCOMPARE( p1.id, QStringLiteral( "io.calamares.calamares.desktop" ) );
QCOMPARE( p1.name.get(), "Calamares" ); QCOMPARE( p1.name.get(), QStringLiteral( "Calamares" ) );
// The <description> entry has precedence // The <description> entry has precedence
QCOMPARE( p1.description.get(), "Calamares is an installer program for Linux distributions." ); QCOMPARE( p1.description.get(), QStringLiteral( "Calamares is an installer program for Linux distributions." ) );
// .. but en_GB doesn't have an entry in description, so uses <summary> // .. but en_GB doesn't have an entry in description, so uses <summary>
QCOMPARE( p1.description.get( QLocale( "en_GB" ) ), "Calamares Linux Installer" ); QCOMPARE( p1.description.get( QLocale( "en_GB" ) ), QStringLiteral( "Calamares Linux Installer" ) );
QCOMPARE( p1.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." ); QCOMPARE( p1.description.get( QLocale( "nl" ) ), QStringLiteral( "Calamares is een installatieprogramma voor Linux distributies." ) );
QVERIFY( p1.screenshot.isNull() ); QVERIFY( p1.screenshot.isNull() );
m.insert( "id", "calamares" ); m.insert( "id", "calamares" );
m.insert( "screenshot", ":/images/calamares.png" ); m.insert( "screenshot", ":/images/calamares.png" );
PackageItem p2 = fromAppData( m ); PackageItem p2 = fromAppData( m );
QVERIFY( p2.isValid() ); QVERIFY( p2.isValid() );
QCOMPARE( p2.id, "calamares" ); QCOMPARE( p2.id, QStringLiteral( "calamares" ) );
QCOMPARE( p2.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." ); QCOMPARE( p2.description.get( QLocale( "nl" ) ), QStringLiteral( "Calamares is een installatieprogramma voor Linux distributies." ) );
QVERIFY( !p2.screenshot.isNull() ); QVERIFY( !p2.screenshot.isNull() );
#endif #endif
} }