[locale] Extend tests with tz-image-validation

- The idea is to check all the TZ images for consistency, like
  TimeZoneWidget::setCurrentLocation() does when DEBUG_TIMEZONES is
  on; a zone-pixel should be set in only **one** image.

The test so far is just a stub.
main
Adriaan de Groot 5 years ago
parent e84db033b0
commit 36d9e7d8f4

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2019, Adriaan de Groot <groot@kde.org>
* Copyright 2019-2020, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,6 +20,8 @@
#include "Tests.h"
#include "LocaleConfiguration.h"
#include "locale/TimeZone.h"
#include <QtTest/QtTest>
QTEST_GUILESS_MAIN( LocaleTests )
@ -77,3 +79,20 @@ LocaleTests::testSplitLocaleConfiguration()
QCOMPARE( lc3.toBcp47(), QStringLiteral( "da" ) );
QCOMPARE( lc3.lc_numeric, QStringLiteral( "de_DE.UTF-8" ) );
}
void
LocaleTests::testTZImages()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
using namespace CalamaresUtils::Locale;
const CStringPairList& regions = TZRegion::fromZoneTab();
for ( const auto* pr : regions )
{
const TZRegion* region = dynamic_cast< const TZRegion* >( pr );
if ( region )
{
cDebug() << "Region" << region->region() << "zones #" << region->zones().count();
}
}
}

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2019, Adriaan de Groot <groot@kde.org>
* Copyright 2019-2020, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,6 +35,9 @@ private Q_SLOTS:
void testEmptyLocaleConfiguration();
void testDefaultLocaleConfiguration();
void testSplitLocaleConfiguration();
// Check the TZ images for consistency
void testTZImages();
};
#endif

Loading…
Cancel
Save