[locale] Repair test: don't re-init te occupied-pixels set each loop
- while here, merge Tests.h to the cpp file - Fix build when debugging timezones (missed during earlier refactor)
This commit is contained in:
parent
21f97db8fd
commit
04e53be934
@ -368,7 +368,7 @@ getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTime
|
|||||||
adjustLiveTimezone = CalamaresUtils::getBool(
|
adjustLiveTimezone = CalamaresUtils::getBool(
|
||||||
configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() );
|
configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() );
|
||||||
#ifdef DEBUG_TIMEZONES
|
#ifdef DEBUG_TIMEZONES
|
||||||
if ( m_adjustLiveTimezone )
|
if ( adjustLiveTimezone )
|
||||||
{
|
{
|
||||||
cWarning() << "Turning off live-timezone adjustments because debugging is on.";
|
cWarning() << "Turning off live-timezone adjustments because debugging is on.";
|
||||||
adjustLiveTimezone = false;
|
adjustLiveTimezone = false;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "Tests.h"
|
|
||||||
#include "LocaleConfiguration.h"
|
#include "LocaleConfiguration.h"
|
||||||
#include "timezonewidget/TimeZoneImage.h"
|
#include "timezonewidget/TimeZoneImage.h"
|
||||||
|
|
||||||
@ -28,6 +27,26 @@
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
class LocaleTests : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
LocaleTests();
|
||||||
|
~LocaleTests() override;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void initTestCase();
|
||||||
|
// Check the sample config file is processed correctly
|
||||||
|
void testEmptyLocaleConfiguration();
|
||||||
|
void testDefaultLocaleConfiguration();
|
||||||
|
void testSplitLocaleConfiguration();
|
||||||
|
|
||||||
|
// Check the TZ images for consistency
|
||||||
|
void testTZImages(); // No overlaps in images
|
||||||
|
void testTZLocations(); // No overlaps in locations
|
||||||
|
void testSpecificLocations();
|
||||||
|
};
|
||||||
|
|
||||||
QTEST_MAIN( LocaleTests )
|
QTEST_MAIN( LocaleTests )
|
||||||
|
|
||||||
|
|
||||||
@ -191,11 +210,12 @@ LocaleTests::testTZLocations()
|
|||||||
using namespace CalamaresUtils::Locale;
|
using namespace CalamaresUtils::Locale;
|
||||||
ZonesModel zones;
|
ZonesModel zones;
|
||||||
|
|
||||||
|
QVERIFY( zones.rowCount( QModelIndex() ) > 100 );
|
||||||
|
|
||||||
int overlapcount = 0;
|
int overlapcount = 0;
|
||||||
|
std::set< QPoint > occupied;
|
||||||
for ( auto it = zones.begin(); it; ++it )
|
for ( auto it = zones.begin(); it; ++it )
|
||||||
{
|
{
|
||||||
std::set< QPoint > occupied;
|
|
||||||
|
|
||||||
const auto* zone = *it;
|
const auto* zone = *it;
|
||||||
QVERIFY( zone );
|
QVERIFY( zone );
|
||||||
|
|
||||||
@ -230,3 +250,7 @@ LocaleTests::testSpecificLocations()
|
|||||||
QEXPECT_FAIL( "", "Gibraltar and Ceuta are really close", Continue );
|
QEXPECT_FAIL( "", "Gibraltar and Ceuta are really close", Continue );
|
||||||
QVERIFY( gpos.y() < cpos.y() ); // Gibraltar is north of Ceuta
|
QVERIFY( gpos.y() < cpos.y() ); // Gibraltar is north of Ceuta
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "utils/moc-warnings.h"
|
||||||
|
|
||||||
|
#include "Tests.moc"
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Calamares is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TESTS_H
|
|
||||||
#define TESTS_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class LocaleTests : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
LocaleTests();
|
|
||||||
~LocaleTests() override;
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void initTestCase();
|
|
||||||
// Check the sample config file is processed correctly
|
|
||||||
void testEmptyLocaleConfiguration();
|
|
||||||
void testDefaultLocaleConfiguration();
|
|
||||||
void testSplitLocaleConfiguration();
|
|
||||||
|
|
||||||
// Check the TZ images for consistency
|
|
||||||
void testTZImages(); // No overlaps in images
|
|
||||||
void testTZLocations(); // No overlaps in locations
|
|
||||||
void testSpecificLocations();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user