1
0
Fork 0
flightgear/test_suite/simgear_tests/timing/test_SGTime.cxx
James Turner ff5752d1dd Mark time test as passing, with updated TZ data
Requires FGData commit  844c24a085b6f065a1d6c
2022-12-01 09:31:12 +00:00

51 lines
1.2 KiB
C++

/*
* SPDX-FileCopyrightText: (C) 2022 James Turner <james@flightgear.org>
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <algorithm>
#include <memory>
#include "test_SGTime.hxx"
#include "test_suite/dataStore.hxx"
#include <simgear/math/SGGeod.hxx>
using namespace std;
// Set up function for each test.
void SimgearTimingTests::setUp()
{
}
// Clean up after each test.
void SimgearTimingTests::tearDown()
{
}
void SimgearTimingTests::testBadZoneDetectPosition()
{
DataStore &data = DataStore::get();
const SGPath rootPath{data.getFGRoot()};
if (rootPath.isNull()) {
return;
}
std::unique_ptr<SGTime> t(new SGTime{rootPath});
const auto goodPos = SGGeod::fromDeg(-69.5, 12.0);
CPPUNIT_ASSERT(t->updateLocal(goodPos, rootPath / "Timezone"));
// discovered while flying with the Shuttle, but actually
// can happen at sea level.
// https://sourceforge.net/p/flightgear/codetickets/2780/
// this was fixed by updating the timezone data from
// https://github.com/BertoldVdb/ZoneDetect into FGData/Timezone/timezone16.bin
const auto pos = SGGeod::fromDeg(-69.0, 12.0);
CPPUNIT_ASSERT(t->updateLocal(pos, rootPath / "Timezone"));
}