diff options
Diffstat (limited to 'tests/test_config.cpp')
| -rw-r--r-- | tests/test_config.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_config.cpp b/tests/test_config.cpp index be343d1..b0597de 100644 --- a/tests/test_config.cpp +++ b/tests/test_config.cpp @@ -154,6 +154,7 @@ private slots: void calendarSyncCommandSurvivesACommaAndDefaults(); void calendarsDirThatDoesNotExistIsReported(); void calendarSyncDelayRejectsGarbage(); + void aNegativeCalendarSyncDelayIsOutOfRange(); }; static QString writeIni(const QTemporaryDir &dir, const QString &body) @@ -2963,5 +2964,19 @@ void TestConfig::calendarSyncDelayRejectsGarbage() QVERIFY(!config.problems().isEmpty()); } +void TestConfig::aNegativeCalendarSyncDelayIsOutOfRange() +{ + // "-5" parses, so "is not a number" would be a lie; the value is simply + // outside what the key accepts. It falls back to the default and says so. + QTemporaryDir dir; + Config config; + config.load(writeIni(dir, QStringLiteral("[general]\n" + "calendar_sync_delay_ms=-5\n"))); + QCOMPARE(config.calendarSyncDelayMs(), 2000); + const QString joined = config.problems().join(QLatin1Char('\n')); + QVERIFY2(joined.contains(QStringLiteral("out of range")), qPrintable(joined)); + QVERIFY2(!joined.contains(QStringLiteral("not a number")), qPrintable(joined)); +} + QTEST_MAIN(TestConfig) #include "test_config.moc" |
