1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// SPDX-License-Identifier: LGPL-2.1-or-later
//
// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
//
#include <QObject>
#include "TestUtils.h"
#include <GeoDataCamera.h>
#include <GeoDataDocument.h>
#include <GeoDataPlacemark.h>
#include <GeoDataTimeStamp.h>
#include <MarbleDebug.h>
using namespace Marble;
class TestGxTimeStamp : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void simpleParseTest();
};
void TestGxTimeStamp::initTestCase()
{
MarbleDebug::setEnabled(true);
}
void TestGxTimeStamp::simpleParseTest()
{
QString const centerContent(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<kml xmlns=\"http://www.opengis.net/kml/2.2\""
" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">"
"<Document>"
"<Placemark>"
"<Camera>"
"<gx:TimeStamp>"
"<when>1987-06-05T04:03:02-01:00</when>"
"</gx:TimeStamp>"
"</Camera>"
"</Placemark>"
"</Document>"
"</kml>");
GeoDataDocument *dataDocument = parseKml(centerContent);
QCOMPARE(dataDocument->placemarkList().size(), 1);
GeoDataPlacemark *placemark = dataDocument->placemarkList().at(0);
GeoDataAbstractView *view = placemark->abstractView();
QVERIFY(view != nullptr);
auto camera = dynamic_cast<GeoDataCamera *>(view);
QVERIFY(camera != nullptr);
QCOMPARE(camera->timeStamp().when().toUTC(), QDateTime::fromString("1987-06-05T04:03:02-01:00", Qt::ISODate).toUTC());
delete dataDocument;
}
QTEST_MAIN(TestGxTimeStamp)
#include "TestGxTimeStamp.moc"
|