diff --git a/src/modules/officechooser/PackageChooserViewStep.cpp b/src/modules/officechooser/PackageChooserViewStep.cpp index 6c559e94c..5443992c5 100644 --- a/src/modules/officechooser/PackageChooserViewStep.cpp +++ b/src/modules/officechooser/PackageChooserViewStep.cpp @@ -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(); diff --git a/src/modules/officechooser/Tests.cpp b/src/modules/officechooser/Tests.cpp index 3e7961b92..537ecbd3c 100644 --- a/src/modules/officechooser/Tests.cpp +++ b/src/modules/officechooser/Tests.cpp @@ -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." );