From e507338f4cebec516dd5d83fec95c5de65e114fc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Aug 2020 13:27:15 +0200 Subject: [PATCH] [libcalamares] Test config filenames as well (custom vs standard) --- src/libcalamares/Tests.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/libcalamares/Tests.cpp b/src/libcalamares/Tests.cpp index e2060789f..1da333365 100644 --- a/src/libcalamares/Tests.cpp +++ b/src/libcalamares/Tests.cpp @@ -421,13 +421,11 @@ sequence: return d.isValid() && d.key().module() == moduleKey; }; - const auto it0 = std::find_if( - s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder ); + const auto it0 = std::find_if( s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder ); QVERIFY( it0 != s.moduleInstances().constEnd() ); moduleKey = QString( "derp" ); - const auto it1 = std::find_if( - s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder ); + const auto it1 = std::find_if( s.moduleInstances().constBegin(), s.moduleInstances().constEnd(), moduleFinder ); QVERIFY( it1 == s.moduleInstances().constEnd() ); int validCount = 0; @@ -435,10 +433,31 @@ sequence: for ( const auto& d : s.moduleInstances() ) { if ( d.isValid() ) + { validCount++; + } if ( d.isCustom() ) + { customCount++; + } QVERIFY( d.isCustom() ? d.isValid() : true ); // All custom entries are valid + + if ( !d.isCustom() ) + { + QCOMPARE( d.configFileName(), QString( "%1.conf" ).arg( d.key().module() ) ); + } + else + { + // Specific cases from this config file + if ( d.key().id() == QString( "yo" ) ) + { + QCOMPARE( d.configFileName(), QString( "yolo.conf" ) ); + } + else + { + QCOMPARE( d.configFileName(), QString( "welcome.conf" ) ); // Not set in the settings data + } + } } QCOMPARE( customCount, 2 ); QCOMPARE( validCount, 4 ); // welcome@hi is listed twice, in *show* and *exec*