[officechooser] Drop hard-coded data

This commit is contained in:
Philip Müller 2019-08-09 06:40:39 +02:00
parent 25db582a0a
commit dce9b215af
2 changed files with 15 additions and 31 deletions

View File

@ -184,32 +184,6 @@ PackageChooserViewStep::setConfigurationMap( const QVariantMap& configurationMap
fillModel( configurationMap.value( "items" ).toList() );
}
// TODO: replace this hard-coded model
if ( !m_model )
{
m_model = new PackageListModel( nullptr );
m_model->addPackage( PackageItem { QString(),
QString(),
"No Office Suite",
"Please pick an office suite from the list. "
"If you don't want to install an office suite, that's fine, "
"you can install one later as needed.",
":/images/choose-office.jpg" } );
m_model->addPackage( PackageItem { "libreoffice-still",
"libreoffice-still",
"LibreOffice",
"LibreOffice is a powerful and free office suite, used by millions of people around the world. "
"Its clean interface and feature-rich tools help you unleash your creativity and enhance your productivity.",
":/images/LibreOffice.jpg" } );
m_model->addPackage( PackageItem { "freeoffice",
"freeoffice",
"FreeOffice",
"FreeOffice 2018 is a full-featured Office suite with word processing, "
"spreadsheet and presentation software. It is seamlessly compatible with Microsoft Office. "
"(Note: You need to register the product for free longterm usage)",
":/images/FreeOffice.jpg" } );
}
if ( first_time && m_widget && m_model )
{
hookupModel();

View File

@ -45,13 +45,23 @@ PackageChooserTests::testBogus()
void
PackageChooserTests::testAppData()
{
// Path from the build-dir
QString appdataName( "../io.calamares.calamares.appdata.xml" );
// Path from the build-dir and from the running-the-test varies,
// for in-source build, for build/, and for tests-in-build/,
// so look in multiple places.
QString appdataName( "io.calamares.calamares.appdata.xml" );
for ( const auto& prefix : QStringList { "", "../", "../../../", "../../../../" } )
{
if ( QFile::exists( prefix + appdataName ) )
{
appdataName = prefix + appdataName;
break;
}
}
QVERIFY( QFile::exists( appdataName ) );
QVariantMap m;
m.insert( "appdata", appdataName );
PackageItem p1 = PackageItem::fromAppData( m );
#ifdef HAVE_XML
QVERIFY( p1.isValid() );
@ -63,10 +73,10 @@ PackageChooserTests::testAppData()
QCOMPARE( p1.description.get( QLocale( "en_GB" ) ), "Calamares Linux Installer" );
QCOMPARE( p1.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." );
QVERIFY( p1.screenshot.isNull() );
m.insert( "id", "calamares" );
m.insert( "screenshot", ":/images/calamares.png" );
PackageItem p2= PackageItem::fromAppData( m );
PackageItem p2 = PackageItem::fromAppData( m );
QVERIFY( p2.isValid() );
QCOMPARE( p2.id, "calamares" );
QCOMPARE( p2.description.get( QLocale( "nl" ) ), "Calamares is een installatieprogramma voor Linux distributies." );