From 04e53be934d13c08a63e4a5a12d8e0100ad15188 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 6 Aug 2020 12:14:15 +0200 Subject: [PATCH] [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) --- src/modules/locale/Config.cpp | 2 +- src/modules/locale/Tests.cpp | 30 ++++++++++++++++++++--- src/modules/locale/Tests.h | 45 ----------------------------------- 3 files changed, 28 insertions(+), 49 deletions(-) delete mode 100644 src/modules/locale/Tests.h diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 96d279477..b8a6df437 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -368,7 +368,7 @@ getAdjustLiveTimezone( const QVariantMap& configurationMap, bool& adjustLiveTime adjustLiveTimezone = CalamaresUtils::getBool( configurationMap, "adjustLiveTimezone", Calamares::Settings::instance()->doChroot() ); #ifdef DEBUG_TIMEZONES - if ( m_adjustLiveTimezone ) + if ( adjustLiveTimezone ) { cWarning() << "Turning off live-timezone adjustments because debugging is on."; adjustLiveTimezone = false; diff --git a/src/modules/locale/Tests.cpp b/src/modules/locale/Tests.cpp index e7fbb10f2..de0be57c4 100644 --- a/src/modules/locale/Tests.cpp +++ b/src/modules/locale/Tests.cpp @@ -17,7 +17,6 @@ */ -#include "Tests.h" #include "LocaleConfiguration.h" #include "timezonewidget/TimeZoneImage.h" @@ -28,6 +27,26 @@ #include +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 ) @@ -191,11 +210,12 @@ LocaleTests::testTZLocations() using namespace CalamaresUtils::Locale; ZonesModel zones; + QVERIFY( zones.rowCount( QModelIndex() ) > 100 ); + int overlapcount = 0; + std::set< QPoint > occupied; for ( auto it = zones.begin(); it; ++it ) { - std::set< QPoint > occupied; - const auto* zone = *it; QVERIFY( zone ); @@ -230,3 +250,7 @@ LocaleTests::testSpecificLocations() QEXPECT_FAIL( "", "Gibraltar and Ceuta are really close", Continue ); QVERIFY( gpos.y() < cpos.y() ); // Gibraltar is north of Ceuta } + +#include "utils/moc-warnings.h" + +#include "Tests.moc" diff --git a/src/modules/locale/Tests.h b/src/modules/locale/Tests.h deleted file mode 100644 index e01b1a25c..000000000 --- a/src/modules/locale/Tests.h +++ /dev/null @@ -1,45 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2019-2020, Adriaan de Groot - * - * 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 . - */ - - -#ifndef TESTS_H -#define TESTS_H - -#include - -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