[packagechooser] Expand tests with override features

This commit is contained in:
Adriaan de Groot 2019-08-06 22:51:14 +02:00
parent a4362dac65
commit 194a562727

View File

@ -52,26 +52,26 @@ PackageChooserTests::testAppData()
QVariantMap m; QVariantMap m;
m.insert( "appdata", appdataName ); m.insert( "appdata", appdataName );
PackageItem p = PackageItem::fromAppData( m ); PackageItem p1 = PackageItem::fromAppData( m );
#ifdef HAVE_XML #ifdef HAVE_XML
QVERIFY( p.isValid() ); QVERIFY( p1.isValid() );
QCOMPARE( p.id, "io.calamares.calamares.desktop" ); QCOMPARE( p1.id, "io.calamares.calamares.desktop" );
QCOMPARE( p.name.get(), "Calamares" ); QCOMPARE( p1.name.get(), "Calamares" );
// The <description> entry has precedence // The <description> entry has precedence
QCOMPARE( p.description.get(), "Calamares is an installer program for Linux distributions." ); QCOMPARE( p1.description.get(), "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( p.description.get( QLocale( "en_GB" ) ), "Calamares Linux Installer" ); QCOMPARE( p1.description.get( QLocale( "en_GB" ) ), "Calamares Linux Installer" );
QCOMPARE( p.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." ); QCOMPARE( p1.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." );
QVERIFY( p.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 p_self = PackageItem::fromAppData( m ); PackageItem p2= PackageItem::fromAppData( m );
QVERIFY( p.isValid() ); QVERIFY( p2.isValid() );
QCOMPARE( p.id, "calamares" ); QCOMPARE( p2.id, "calamares" );
QCOMPARE( p.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." ); QCOMPARE( p2.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." );
QVERIFY( !p.screenshot.isNull() ); QVERIFY( !p2.screenshot.isNull() );
#else #else
QVERIFY( !p.isValid() ); QVERIFY( !p1.isValid() );
#endif #endif
} }