[libcalamares] Add API for geographical lookup
- find a zone given lat, lon -- with a failing test and a bogus implementation.
This commit is contained in:
parent
626dd038da
commit
ab69e7c83a
@ -52,6 +52,7 @@ private Q_SLOTS:
|
||||
void testComplexZones();
|
||||
void testTZLookup();
|
||||
void testTZIterator();
|
||||
void testLocationLookup();
|
||||
};
|
||||
|
||||
LocaleTests::LocaleTests() {}
|
||||
@ -389,6 +390,15 @@ LocaleTests::testTZIterator()
|
||||
QCOMPARE( ( *zones.begin() )->zone(), QStringLiteral( "Abidjan" ) );
|
||||
}
|
||||
|
||||
void
|
||||
LocaleTests::testLocationLookup()
|
||||
{
|
||||
const CalamaresUtils::Locale::ZonesModel zones;
|
||||
|
||||
QVERIFY( zones.find( 50.0, 0.0 ) );
|
||||
QCOMPARE( zones.find( 50.0, 0.0 )->zone(), QStringLiteral( "London" ) );
|
||||
}
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN( LocaleTests )
|
||||
|
||||
|
@ -316,6 +316,12 @@ ZonesModel::find( const QString& region, const QString& zone ) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const TimeZoneData*
|
||||
ZonesModel::find( double latitude, double longitude ) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ZonesModel::Iterator::operator bool() const
|
||||
{
|
||||
return 0 <= m_index && m_index < m_p->m_zones.count();
|
||||
|
@ -128,6 +128,12 @@ public:
|
||||
*/
|
||||
const TimeZoneData* find( const QString& region, const QString& zone ) const;
|
||||
|
||||
/** @brief Look up TZ data based on the location.
|
||||
*
|
||||
* Returns the nearest zone to the given lat and lon.
|
||||
*/
|
||||
const TimeZoneData* find( double latitude, double longitude ) const;
|
||||
|
||||
/** @brief Iterator for testing purposes
|
||||
*
|
||||
* This is primarily for testing, but who knows, it might be useful
|
||||
|
Loading…
Reference in New Issue
Block a user