diff --git a/src/modules/partition/tests/3a-min-too-large.conf b/src/modules/partition/tests/3a-min-too-large.conf new file mode 100644 index 000000000..096f823d7 --- /dev/null +++ b/src/modules/partition/tests/3a-min-too-large.conf @@ -0,0 +1,5 @@ +--- +efi: + recommendedSize: 133MiB + minimumSize: 200MiB + label: "bigmin" diff --git a/src/modules/partition/tests/ConfigTests.cpp b/src/modules/partition/tests/ConfigTests.cpp index ee8150501..5e7d4d524 100644 --- a/src/modules/partition/tests/ConfigTests.cpp +++ b/src/modules/partition/tests/ConfigTests.cpp @@ -34,6 +34,7 @@ private Q_SLOTS: void testEmptyConfig(); void testLegacySize(); void testAll(); + void testWeirdConfig(); }; ConfigTests::ConfigTests() = default; @@ -195,6 +196,31 @@ ConfigTests::testAll() } } +void +ConfigTests::testWeirdConfig() +{ + Config c( nullptr ); + + auto* gs = Calamares::JobQueue::instanceGlobalStorage(); + QVERIFY( gs ); + + + // Config with an invalid minimum size + { + const auto file = QStringLiteral( BUILD_AS_TEST "/3a-min-too-large.conf" ); + bool ok = false; + c.setConfigurationMap( Calamares::YAML::load( file, &ok ) ); + + cDebug() << "Tried to load" << file << "success?" << ok; + QVERIFY( ok ); + + QCOMPARE( PartUtils::efiFilesystemRecommendedSize(), 133_MiB ); + QCOMPARE( PartUtils::efiFilesystemMinimumSize(), 133_MiB ); // Config setting was ignored + + QCOMPARE( gs->value( "efiSystemPartitionName" ).toString(), QStringLiteral( "bigmin" ) ); + } +} + QTEST_GUILESS_MAIN( ConfigTests )