QMapLibre test refactoring

This commit is contained in:
Dan Paulat 2024-02-27 23:47:10 -06:00
parent e23c6c2624
commit 16c2fae408

View file

@ -3,10 +3,10 @@
#include <scwx/util/logger.hpp> #include <scwx/util/logger.hpp>
#include <QCoreApplication> #include <QCoreApplication>
#include <QMapLibreGL/QMapLibreGL>
#include <QTimer> #include <QTimer>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <qmaplibre.hpp>
#include <re2/re2.h> #include <re2/re2.h>
namespace scwx namespace scwx
@ -45,22 +45,22 @@ TEST_P(ByMapProviderTest, MapProviderLayers)
// Configure map provider // Configure map provider
const MapProviderInfo& mapProviderInfo = GetMapProviderInfo(mapProvider); const MapProviderInfo& mapProviderInfo = GetMapProviderInfo(mapProvider);
// Configure QMapLibreGL // Configure QMapLibre
QMapLibreGL::Settings mapSettings {}; QMapLibre::Settings mapSettings {};
mapSettings.resetToTemplate(mapProviderInfo.settingsTemplate_); mapSettings.setProviderTemplate(mapProviderInfo.providerTemplate_);
mapSettings.setApiKey(QString::fromStdString(apiKey)); mapSettings.setApiKey(QString::fromStdString(apiKey));
QMapLibreGL::Map map(nullptr, mapSettings, QSize(1, 1)); QMapLibre::Map map(nullptr, mapSettings, QSize(1, 1));
application.processEvents(); application.processEvents();
// Connect style load completion signal // Connect style load completion signal
QObject::connect( QObject::connect(
&map, &map,
&QMapLibreGL::Map::mapChanged, &QMapLibre::Map::mapChanged,
[&](QMapLibreGL::Map::MapChange mapChange) [&](QMapLibre::Map::MapChange mapChange)
{ {
if (mapChange == if (mapChange ==
QMapLibreGL::Map::MapChange::MapChangeDidFinishLoadingStyle) QMapLibre::Map::MapChange::MapChangeDidFinishLoadingStyle)
{ {
application.exit(); application.exit();
} }