core: rename mbgl namespace to mln (#4487)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Bart Louwers
2026-08-14 23:25:20 +02:00
committed by GitHub
parent 836b862984
commit 550f64be22
1970 changed files with 8931 additions and 8967 deletions

View File

@@ -10,7 +10,7 @@
#include <memory>
#include <thread>
using namespace mbgl;
using namespace mln;
using namespace std::chrono_literals;
TEST(Actor, Construction) {

View File

@@ -5,7 +5,7 @@
#include <future>
using namespace mbgl;
using namespace mln;
TEST(ActorRef, CanOutliveActor) {
// An ActorRef can outlive its actor. Doing does not extend the actor's lifetime.

View File

@@ -6,7 +6,7 @@
#include <mbgl/algorithm/update_renderables.hpp>
using namespace mbgl;
using namespace mln;
enum LookupResult : bool {
NotFound = false,

View File

@@ -3,7 +3,7 @@
#include <algorithm>
using namespace mbgl;
using namespace mln;
namespace {

View File

@@ -15,7 +15,7 @@
#include <algorithm>
using namespace mbgl;
using namespace mln;
namespace {
@@ -135,7 +135,7 @@ TEST(Annotations, AntimeridianAnnotationLarge) {
AnnotationTest test;
double antimeridian = 180;
test.map.jumpTo(CameraOptions().withCenter(mbgl::LatLng(0.0, antimeridian)).withZoom(0.0));
test.map.jumpTo(CameraOptions().withCenter(mln::LatLng(0.0, antimeridian)).withZoom(0.0));
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
LineString<double> line = {{{antimeridian, 20}, {antimeridian, -20}}};
@@ -397,7 +397,7 @@ TEST(Annotations, QueryFractionalZoomLevels) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationImage(namedMarker("default_marker"));
std::vector<mbgl::AnnotationID> ids;
std::vector<mln::AnnotationID> ids;
for (int longitude = 0; longitude < 10; longitude += 2) {
for (int latitude = 0; latitude < 10; latitude += 2) {
ids.push_back(
@@ -405,7 +405,7 @@ TEST(Annotations, QueryFractionalZoomLevels) {
}
}
test.map.jumpTo(CameraOptions().withCenter(mbgl::LatLng(5.0, 5.0)).withZoom(0.0));
test.map.jumpTo(CameraOptions().withCenter(mln::LatLng(5.0, 5.0)).withZoom(0.0));
for (uint16_t zoomSteps = 10; zoomSteps <= 20; ++zoomSteps) {
test.map.jumpTo(CameraOptions().withZoom(zoomSteps / 10.0));
test.frontend.render(test.map);
@@ -434,9 +434,9 @@ TEST(Annotations, VisibleFeatures) {
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationImage(namedMarker("default_marker"));
test.map.jumpTo(CameraOptions().withCenter(mbgl::LatLng(5.0, 5.0)).withZoom(3.0));
test.map.jumpTo(CameraOptions().withCenter(mln::LatLng(5.0, 5.0)).withZoom(3.0));
std::vector<mbgl::AnnotationID> ids;
std::vector<mln::AnnotationID> ids;
for (int longitude = 0; longitude < 10; longitude += 2) {
for (int latitude = 0; latitude <= 10; latitude += 2) {
ids.push_back(
@@ -515,7 +515,7 @@ TEST(Annotations, ViewFrustumCulling) {
std::vector<LatLng> latLngs = {tl, bl, tr, br, center};
std::vector<mbgl::AnnotationID> ids;
std::vector<mln::AnnotationID> ids;
for (auto latLng : latLngs) {
ids.push_back(
test.map.addAnnotation(SymbolAnnotation{{latLng.longitude(), latLng.latitude()}, "default_marker"}));

View File

@@ -11,7 +11,7 @@
#include <future>
using namespace mbgl;
using namespace mln;
TEST(API, RenderWithoutCallback) {
FixtureLog log;

View File

@@ -22,7 +22,7 @@
using namespace std::numbers;
class LineTestDrawableLayer : public mbgl::style::CustomDrawableLayerHost {
class LineTestDrawableLayer : public mln::style::CustomDrawableLayerHost {
public:
void initialize() override {}
@@ -35,7 +35,7 @@ public:
// add polylines
{
using namespace mbgl;
using namespace mln;
constexpr auto numLines = 6;
Interface::LineOptions options[numLines]{
@@ -128,7 +128,7 @@ public:
void deinitialize() override {}
};
class FillTestDrawableLayer : public mbgl::style::CustomDrawableLayerHost {
class FillTestDrawableLayer : public mln::style::CustomDrawableLayerHost {
public:
void initialize() override {}
@@ -141,7 +141,7 @@ public:
// add fill polygon
{
using namespace mbgl;
using namespace mln;
GeometryCollection geometry{
{
@@ -176,7 +176,7 @@ public:
void deinitialize() override {}
};
class SymbolIconTestDrawableLayer : public mbgl::style::CustomDrawableLayerHost {
class SymbolIconTestDrawableLayer : public mln::style::CustomDrawableLayerHost {
public:
void initialize() override {}
@@ -189,7 +189,7 @@ public:
// add symbol icon
{
using namespace mbgl;
using namespace mln;
GeometryCoordinate position{static_cast<int16_t>(util::EXTENT * 0.5f),
static_cast<int16_t>(util::EXTENT * 0.5f)};
@@ -235,8 +235,8 @@ public:
};
TEST(CustomDrawableLayer, Line) {
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
util::RunLoop loop;
@@ -259,8 +259,8 @@ TEST(CustomDrawableLayer, Line) {
}
TEST(CustomDrawableLayer, Fill) {
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
util::RunLoop loop;
@@ -283,8 +283,8 @@ TEST(CustomDrawableLayer, Fill) {
}
TEST(CustomDrawableLayer, SymbolIcon) {
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
util::RunLoop loop;

View File

@@ -13,8 +13,8 @@
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/run_loop.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
TEST(CustomGeometrySource, Grid) {
util::RunLoop loop;
@@ -28,7 +28,7 @@ TEST(CustomGeometrySource, Grid) {
map.jumpTo(CameraOptions().withCenter(LatLng{37.8, -122.5}).withZoom(10.0));
CustomGeometrySource::Options options;
options.fetchTileFunction = [&map](const mbgl::CanonicalTileID& tileID) {
options.fetchTileFunction = [&map](const mln::CanonicalTileID& tileID) {
double gridSpacing = 0.1;
FeatureCollection features;
const LatLngBounds bounds(tileID);

View File

@@ -17,9 +17,9 @@
#include <memory>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::platform;
using namespace mln;
using namespace mln::style;
using namespace mln::platform;
// Note that custom layers need to draw geometry with a z value of 1 to take
// advantage of depth-based fragment culling.
@@ -40,9 +40,9 @@ void main() {
// in the layer implementation because it is intended to reflect how someone
// using custom layers might actually write their own implementation.
class TestLayer : public mbgl::style::CustomLayerHost {
class TestLayer : public mln::style::CustomLayerHost {
public:
void initialize(const mbgl::style::CustomLayerInitParameters&) override {
void initialize(const mln::style::CustomLayerInitParameters&) override {
program = MBGL_CHECK_ERROR(glCreateProgram());
vertexShader = MBGL_CHECK_ERROR(glCreateShader(GL_VERTEX_SHADER));
fragmentShader = MBGL_CHECK_ERROR(glCreateShader(GL_FRAGMENT_SHADER));
@@ -62,7 +62,7 @@ public:
MBGL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(GLfloat), triangle, GL_STATIC_DRAW));
}
void render(const mbgl::style::CustomLayerRenderParameters&) override {
void render(const mln::style::CustomLayerRenderParameters&) override {
MBGL_CHECK_ERROR(glUseProgram(program));
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, buffer));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));

View File

@@ -15,9 +15,9 @@
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/gfx/headless_frontend.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::expression;
using namespace mln;
using namespace mln::style;
using namespace mln::style::expression;
using namespace std::literals;
namespace {
@@ -114,7 +114,7 @@ TEST(Query, QueryRenderedFeaturesFilterLayer) {
}
TEST(Query, QueryRenderedFeaturesFilter) {
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
QueryTest test;
auto zz = test.map.pixelForLatLng({0, 0});
@@ -172,7 +172,7 @@ TEST(Query, QuerySourceFeaturesOptionValidation) {
}
TEST(Query, QuerySourceFeaturesFilter) {
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
QueryTest test;
@@ -193,7 +193,7 @@ TEST(Query, QueryFeatureExtensionsInvalidExtension) {
QueryTest test;
auto unknownExt = test.frontend.getRenderer()->queryFeatureExtensions("source4"s, {}, "unknown"s, "children"s);
auto unknownValue = unknownExt.get<mbgl::Value>();
auto unknownValue = unknownExt.get<mln::Value>();
EXPECT_TRUE(unknownValue.is<NullValue>());
}
@@ -240,8 +240,8 @@ TEST(Query, QueryFeatureExtensionsSuperclusterExpansionZoom) {
auto queryExpansionZoom2 = test.frontend.getRenderer()->queryFeatureExtensions(
"cluster_source"s, children[3], "supercluster"s, "expansion-zoom"s);
auto zoomValue1 = queryExpansionZoom1.get<mbgl::Value>();
auto zoomValue2 = queryExpansionZoom2.get<mbgl::Value>();
auto zoomValue1 = queryExpansionZoom1.get<mln::Value>();
auto zoomValue2 = queryExpansionZoom2.get<mln::Value>();
EXPECT_TRUE(zoomValue1.is<uint64_t>());
EXPECT_TRUE(zoomValue2.is<uint64_t>());
EXPECT_EQ(zoomValue1.get<uint64_t>(), 1u);
@@ -261,7 +261,7 @@ TEST(Query, QueryFeatureExtensionsSuperclusterLeaves) {
EXPECT_EQ(leaves.size(), 10u);
// Get leaves for cluster 1, with limit 3, offset 0.
const std::map<std::string, mbgl::Value> limitOpts = {{"limit"s, static_cast<uint64_t>(3u)}};
const std::map<std::string, mln::Value> limitOpts = {{"limit"s, static_cast<uint64_t>(3u)}};
auto queryClusterLeavesLimit3 = test.frontend.getRenderer()->queryFeatureExtensions(
"cluster_source"s, topClusterFeature[0], "supercluster"s, "leaves"s, limitOpts);
auto limitLeaves3 = queryClusterLeavesLimit3.get<FeatureCollection>();
@@ -272,8 +272,8 @@ TEST(Query, QueryFeatureExtensionsSuperclusterLeaves) {
EXPECT_EQ(limitLeaves3[2].properties["name"].get<std::string>(), "Cape Fear"s);
// Get leaves for cluster 1, with limit 3, offset 3.
const std::map<std::string, mbgl::Value> offsetOpts = {{"limit"s, static_cast<uint64_t>(3u)},
{"offset"s, static_cast<uint64_t>(3u)}};
const std::map<std::string, mln::Value> offsetOpts = {{"limit"s, static_cast<uint64_t>(3u)},
{"offset"s, static_cast<uint64_t>(3u)}};
auto queryClusterLeavesOffset3 = test.frontend.getRenderer()->queryFeatureExtensions(
"cluster_source"s, topClusterFeature[0], "supercluster"s, "leaves"s, offsetOpts);
auto offsetLeaves3 = queryClusterLeavesOffset3.get<FeatureCollection>();

View File

@@ -15,8 +15,8 @@
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
TEST(API, RecycleMapUpdateImages) {
util::RunLoop loop;

View File

@@ -4,7 +4,7 @@
#include <mbgl/util/tileset.hpp>
#include <mbgl/geometry/dem_data.hpp>
using namespace mbgl;
using namespace mln;
auto fakeImage = [](Size s) {
PremultipliedImage img = PremultipliedImage(s);

View File

@@ -4,7 +4,7 @@
#include <random>
using namespace mbgl;
using namespace mln;
TEST(LineAtlas, Random) {
std::mt19937 generator(42); // Use the same seed for reproducible tests.

View File

@@ -16,7 +16,7 @@
#include <mbgl/map/mode.hpp>
namespace mbgl {
namespace mln {
bool operator==(const SegmentBase& lhs, const SegmentBase& rhs) {
return std::tie(lhs.vertexOffset, lhs.indexOffset, lhs.vertexLength, lhs.indexLength) ==
@@ -33,9 +33,9 @@ bool operator==(const VertexType<A1, A2>& lhs, const VertexType<A1, A2>& rhs) {
} // namespace detail
} // namespace gfx
} // namespace mbgl
} // namespace mln
using namespace mbgl;
using namespace mln;
namespace {

View File

@@ -19,9 +19,9 @@
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/run_loop.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::platform;
using namespace mln;
using namespace mln::style;
using namespace mln::platform;
static const GLchar* vertexShaderSource = R"MBGL_SHADER(
#ifdef GL_ES

View File

@@ -6,9 +6,9 @@
#include <mbgl/gl/enum.hpp>
#include <mbgl/test/util.hpp>
using namespace mbgl;
using namespace mbgl::gfx;
using namespace mbgl::gl;
using namespace mln;
using namespace mln::gfx;
using namespace mln::gl;
TEST(GL, DrawModeType) {
ASSERT_EQ(GL_POINTS, Enum<DrawModeType>::to(DrawModeType::Points));

View File

@@ -4,7 +4,7 @@
#include <mbgl/platform/gl_functions.hpp>
using namespace mbgl::platform;
using namespace mln::platform;
TEST(GLFunctions, OpenGLES) {
/* OpenGL ES 2.0 */

View File

@@ -7,7 +7,7 @@
#include <memory>
using namespace mbgl;
using namespace mln;
namespace {

View File

@@ -8,7 +8,7 @@
#include <mbgl/gl/headless_backend.hpp>
#include <mbgl/gl/context.hpp>
using namespace mbgl;
using namespace mln;
namespace {

View File

@@ -2,8 +2,8 @@
#include <mbgl/util/util.hpp>
namespace mbgl {
namespace mln {
MBGL_EXPORT int runTests(int argc, char* argv[]);
} // namespace mbgl
} // namespace mln

View File

@@ -56,7 +56,7 @@ namespace httplib {
class Server;
} // namespace httplib
namespace mbgl {
namespace mln {
namespace test {
class HttpServer {
@@ -82,4 +82,4 @@ void checkImages(const std::vector<std::string>& possibleExpected,
double getImageDiff(const std::string& base, const PremultipliedImage& actual, double pixelThreshold = 0);
} // namespace test
} // namespace mbgl
} // namespace mln

View File

@@ -13,7 +13,7 @@
#include <mbgl/util/logging.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
namespace mln {
class VectorTileTest {
public:
@@ -55,4 +55,4 @@ public:
}
};
} // namespace mbgl
} // namespace mln

View File

@@ -45,8 +45,8 @@
#include <atomic>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
using namespace std::literals::string_literals;
template <class FileSource = StubFileSource, class Frontend = HeadlessFrontend>
@@ -1686,7 +1686,7 @@ TEST(Map, ResourceError) {
test.frontend.render(test.map);
} catch (...) {
auto error = std::current_exception(); // captur
EXPECT_EQ(mbgl::util::toString(error), "Font file Server failed");
EXPECT_EQ(mln::util::toString(error), "Font file Server failed");
}
}
@@ -1946,7 +1946,7 @@ TEST(Map, ObserveTileLifecycle) {
}
TEST(BackgroundLayer, StyleUpdateZoomDependency) {
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
MapTest<> test;
test.map.getStyle().loadJSON(util::read_file("test/fixtures/map/style_update_zoom_dependency/style.json"));

View File

@@ -9,7 +9,7 @@
#include <mbgl/util/timer.hpp>
#include <mbgl/util/io.hpp>
using namespace mbgl;
using namespace mln;
static PremultipliedImage namedImage(const std::string& name) {
return decodeImage(util::read_file("test/fixtures/sprites/" + name + ".png"));
@@ -43,10 +43,10 @@ TEST(MapSnapshotter, setStyleJSON) {
})JSON");
snapshotter.snapshot([&runLoop](std::exception_ptr ptr,
mbgl::PremultipliedImage image,
mbgl::MapSnapshotter::Attributions,
mbgl::MapSnapshotter::PointForFn,
mbgl::MapSnapshotter::LatLngForFn) {
mln::PremultipliedImage image,
mln::MapSnapshotter::Attributions,
mln::MapSnapshotter::PointForFn,
mln::MapSnapshotter::LatLngForFn) {
EXPECT_EQ(nullptr, ptr);
EXPECT_EQ(32, image.size.width);
EXPECT_EQ(16, image.size.height);
@@ -71,10 +71,10 @@ TEST(MapSnapshotter, setSize) {
snapshotter.setSize(Size{16, 32});
snapshotter.snapshot([&runLoop](std::exception_ptr ptr,
mbgl::PremultipliedImage image,
mbgl::MapSnapshotter::Attributions,
mbgl::MapSnapshotter::PointForFn,
mbgl::MapSnapshotter::LatLngForFn) {
mln::PremultipliedImage image,
mln::MapSnapshotter::Attributions,
mln::MapSnapshotter::PointForFn,
mln::MapSnapshotter::LatLngForFn) {
EXPECT_EQ(nullptr, ptr);
EXPECT_EQ(16, image.size.width);
EXPECT_EQ(32, image.size.height);
@@ -89,10 +89,10 @@ TEST(MapSnapshotter, TEST_REQUIRES_SERVER(setStyleURL)) {
MapSnapshotter snapshotter(Size{64, 32}, 1.0f, ResourceOptions());
snapshotter.setStyleURL("http://127.0.0.1:3000/online/style.json");
snapshotter.snapshot([&runLoop](std::exception_ptr ptr,
mbgl::PremultipliedImage image,
mbgl::MapSnapshotter::Attributions,
mbgl::MapSnapshotter::PointForFn,
mbgl::MapSnapshotter::LatLngForFn) {
mln::PremultipliedImage image,
mln::MapSnapshotter::Attributions,
mln::MapSnapshotter::PointForFn,
mln::MapSnapshotter::LatLngForFn) {
EXPECT_EQ(nullptr, ptr);
EXPECT_EQ(64, image.size.width);
EXPECT_EQ(32, image.size.height);
@@ -107,10 +107,10 @@ TEST(MapSnapshotter, TEST_REQUIRES_SERVER(cancel)) {
MapSnapshotter snapshotter(Size{1, 1}, 1.0f, ResourceOptions());
snapshotter.setStyleURL("http://127.0.0.1:3000/online/style.json");
snapshotter.snapshot([](std::exception_ptr,
mbgl::PremultipliedImage,
mbgl::MapSnapshotter::Attributions,
mbgl::MapSnapshotter::PointForFn,
mbgl::MapSnapshotter::LatLngForFn) { ASSERT_TRUE(false); });
mln::PremultipliedImage,
mln::MapSnapshotter::Attributions,
mln::MapSnapshotter::PointForFn,
mln::MapSnapshotter::LatLngForFn) { ASSERT_TRUE(false); });
snapshotter.cancel();
@@ -132,10 +132,10 @@ TEST(MapSnapshotter, TEST_REQUIRES_SERVER(runtimeStyling)) {
fillLayer->setFillColor(Color(0.25f, 0.88f, 0.82f, 1.0f));
snapshotter.getStyle().addLayer(std::move(fillLayer));
snapshotter.snapshot([&runLoop](std::exception_ptr ptr,
mbgl::PremultipliedImage image,
mbgl::MapSnapshotter::Attributions,
mbgl::MapSnapshotter::PointForFn,
mbgl::MapSnapshotter::LatLngForFn) {
mln::PremultipliedImage image,
mln::MapSnapshotter::Attributions,
mln::MapSnapshotter::PointForFn,
mln::MapSnapshotter::LatLngForFn) {
EXPECT_EQ(nullptr, ptr);
EXPECT_EQ(256, image.size.width);
EXPECT_EQ(128, image.size.height);
@@ -161,10 +161,10 @@ TEST(MapSnapshotter, TEST_REQUIRES_SERVER(annotation)) {
lineAnnotation.width = {5};
snapshotter.addAnnotation(lineAnnotation);
snapshotter.snapshot([&runLoop](std::exception_ptr ptr,
mbgl::PremultipliedImage image,
mbgl::MapSnapshotter::Attributions,
mbgl::MapSnapshotter::PointForFn,
mbgl::MapSnapshotter::LatLngForFn) {
mln::PremultipliedImage image,
mln::MapSnapshotter::Attributions,
mln::MapSnapshotter::PointForFn,
mln::MapSnapshotter::LatLngForFn) {
EXPECT_EQ(nullptr, ptr);
EXPECT_EQ(256, image.size.width);
EXPECT_EQ(128, image.size.height);

View File

@@ -14,8 +14,8 @@
#include <string>
#include <vector>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
using namespace std::literals::string_literals;
using namespace std::chrono_literals;

View File

@@ -10,7 +10,7 @@
#include <numbers>
using namespace std::numbers;
using namespace mbgl;
using namespace mln;
TEST(Transform, InvalidZoom) {
Transform transform;
@@ -136,7 +136,7 @@ TEST(Transform, PerspectiveProjection) {
ASSERT_NEAR(point.x, 1000.0, 1e-5);
ASSERT_NEAR(point.y, 0.0, 1e-4);
mbgl::vec4 p;
mln::vec4 p;
point = transform.getState().latLngToScreenCoordinate({37.692872969426375, -76.75823239205641}, p);
ASSERT_NEAR(point.x, 1000.0, 1e-5);
ASSERT_NEAR(point.y, 0.0, 1e-4);
@@ -567,7 +567,7 @@ TEST(Transform, IsPanning) {
}
TEST(Transform, DefaultTransform) {
struct TransformObserver : public mbgl::TransformObserver {
struct TransformObserver : public mln::TransformObserver {
void onCameraWillChange(MapObserver::CameraChangeMode) final { cameraWillChangeCallback(); };
void onCameraDidChange(MapObserver::CameraChangeMode) final { cameraDidChangeCallback(); };
@@ -767,7 +767,7 @@ TEST(Transform, LatLngBounds) {
ASSERT_DOUBLE_EQ(transform.getLatLng().longitude(), 120.0);
// Simulate swipe to the left.
mbgl::AnimationOptions easeOptions(mbgl::Seconds(1));
mln::AnimationOptions easeOptions(mln::Seconds(1));
easeOptions.transitionFrameFn = [&](double /* t */) {
ASSERT_NEAR(transform.getLatLng().longitude(), 120.0, 1e-4);
};

View File

@@ -3,7 +3,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/math/clamp.hpp>
using namespace mbgl;
using namespace mln;
TEST(Math, ClampFloatingPoint) {
double lowestValue = std::numeric_limits<double>::lowest();

View File

@@ -3,7 +3,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/math/minmax.hpp>
using namespace mbgl;
using namespace mln;
TEST(Math, MinMaxFloatingPoint) {
double minimumValue = std::numeric_limits<double>::min();

View File

@@ -3,7 +3,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/math/wrap.hpp>
using namespace mbgl;
using namespace mln;
TEST(Math, WrapHigherValue) {
ASSERT_DOUBLE_EQ(4.0, util::wrap(16.0, 0.0, 12.0));

View File

@@ -1,8 +1,8 @@
#include <gtest/gtest.h>
#include <mbgl/platform/settings.hpp>
using namespace mbgl;
using namespace mbgl::platform;
using namespace mln;
using namespace mln::platform;
TEST(Settings, SetAndGet) {
using Value = mapbox::base::Value;

View File

@@ -48,8 +48,8 @@
#include <atomic>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
using namespace std::literals::string_literals;
template <class FileSource = StubFileSource, class Frontend = HeadlessFrontend>
@@ -168,19 +168,19 @@ TEST(Plugin, PluginLayer) {
std::string layerType = "plugin-layer-test";
auto pluginLayerFactory = std::make_unique<PluginLayerFactory>(
layerType,
mbgl::style::LayerTypeInfo::Source::NotRequired,
mbgl::style::LayerTypeInfo::Pass3D::NotRequired,
mbgl::style::LayerTypeInfo::Layout::NotRequired,
mbgl::style::LayerTypeInfo::FadingTiles::NotRequired,
mbgl::style::LayerTypeInfo::CrossTileIndex::NotRequired,
mbgl::style::LayerTypeInfo::TileKind::NotRequired);
mln::style::LayerTypeInfo::Source::NotRequired,
mln::style::LayerTypeInfo::Pass3D::NotRequired,
mln::style::LayerTypeInfo::Layout::NotRequired,
mln::style::LayerTypeInfo::FadingTiles::NotRequired,
mln::style::LayerTypeInfo::CrossTileIndex::NotRequired,
mln::style::LayerTypeInfo::TileKind::NotRequired);
pluginLayerFactory->setOnLayerCreatedEvent(
[&_layerRendered, &_layerCreated, &_initialPropertiesFound, &_paintPropertiesFound](
mbgl::style::PluginLayer* pluginLayer) {
mln::style::PluginLayer* pluginLayer) {
// std::cout << "On Layer Created\n";
_layerCreated = true;
auto pluginLayerImpl = (mbgl::style::PluginLayer::Impl*)pluginLayer->baseImpl.get();
auto pluginLayerImpl = (mln::style::PluginLayer::Impl*)pluginLayer->baseImpl.get();
auto& pm = pluginLayerImpl->_propertyManager;
PluginLayerProperty* p = new PluginLayerProperty();
p->_propertyName = "scale";

View File

@@ -6,7 +6,7 @@
#include <functional>
using namespace mbgl;
using namespace mln;
class StubRendererBackend : public gl::RendererBackend {
public:

View File

@@ -13,7 +13,7 @@
#include <utility>
using namespace mbgl;
using namespace mln;
TEST(ImageManager, Missing) {
auto imageManager = ImageManager::create();

View File

@@ -12,7 +12,7 @@
#include <utility>
using namespace mbgl;
using namespace mln;
TEST(PatternAtlas, Basic) {
FixtureLog log;

View File

@@ -26,7 +26,7 @@
#include <mbgl/shaders/gl/legacy/clipping_mask_program.hpp>
#endif
using namespace mbgl;
using namespace mln;
namespace {

View File

@@ -3,8 +3,8 @@
#include <mbgl/renderer/style_diff.hpp>
#include <mbgl/style/layer_impl.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
struct TestLayerImpl : style::Layer::Impl {
TestLayerImpl(std::string layerID, std::string sourceID)

View File

@@ -1,8 +1,8 @@
#include <mbgl/test/util.hpp>
#include <mbgl/shaders/webgpu/wgsl_preprocessor.hpp>
using namespace mbgl;
using namespace mbgl::webgpu::detail;
using namespace mln;
using namespace mln::webgpu::detail;
TEST(ShaderGroupPreprocessor, isDirective_ValidDirectives) {
EXPECT_TRUE(isDirective("#ifdef FEATURE", "ifdef"));

View File

@@ -12,8 +12,8 @@
#include <utility>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
class StubSpriteLoaderObserver : public SpriteLoaderObserver {
public:

View File

@@ -11,7 +11,7 @@
#include <algorithm>
using namespace mbgl;
using namespace mln;
namespace {

View File

@@ -4,5 +4,5 @@
int main(int argc, char* argv[]) {
[[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] bundlePath]];
return mbgl::runTests(argc, argv);
return mln::runTests(argc, argv);
}

View File

@@ -10,7 +10,7 @@
#include <algorithm>
#include <list>
namespace mbgl {
namespace mln {
/*
FakeFileSource is similar to StubFileSource, but it follows a post hoc,
@@ -102,4 +102,4 @@ public:
ClientOptions());
};
} // namespace mbgl
} // namespace mln

View File

@@ -2,7 +2,7 @@
#include <mbgl/test/util.hpp>
#include <mbgl/util/enum.hpp>
namespace mbgl {
namespace mln {
FixtureLog::Message::Message(EventSeverity severity_, Event event_, int64_t code_, std::string msg_)
: severity(severity_),
@@ -123,4 +123,4 @@ size_t FixtureLogObserver::uncheckedCount() const {
return os << "]" << std::endl;
}
} // namespace mbgl
} // namespace mln

View File

@@ -7,7 +7,7 @@
#include <mutex>
#include <iostream>
namespace mbgl {
namespace mln {
class FixtureLog {
public:
@@ -64,4 +64,4 @@ private:
using FixtureLogObserver = FixtureLog::Observer;
} // namespace mbgl
} // namespace mln

View File

@@ -10,7 +10,7 @@
* http://creativecommons.org/licenses/by/3.0/deed.en_US
*/
namespace mbgl {
namespace mln {
namespace test {
/**
@@ -92,4 +92,4 @@ size_t getCurrentRSS() {
}
} // namespace test
} // namespace mbgl
} // namespace mln

View File

@@ -25,7 +25,7 @@
#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
#endif
namespace mbgl {
namespace mln {
namespace test {
/**
@@ -42,4 +42,4 @@ size_t getPeakRSS();
size_t getCurrentRSS();
} // namespace test
} // namespace mbgl
} // namespace mln

View File

@@ -14,7 +14,7 @@
using namespace std::literals::string_literals;
namespace mbgl {
namespace mln {
namespace test {
void runServer(std::unique_ptr<httplib::Server>& server) {
@@ -218,4 +218,4 @@ HttpServer::~HttpServer() {
}
} // namespace test
} // namespace mbgl
} // namespace mln

View File

@@ -3,11 +3,11 @@
#include <mbgl/map/map.hpp>
#include <mbgl/map/map_impl.hpp>
namespace mbgl {
namespace mln {
class FileSource;
// Non-public version of mbgl::Map that accepts a file source as parameter.
// Non-public version of mln::Map that accepts a file source as parameter.
class MapAdapter : public Map {
public:
explicit MapAdapter(RendererFrontend& frontend,
@@ -17,4 +17,4 @@ public:
: Map(std::make_unique<Map::Impl>(frontend, observer, std::move(fileSource), options)) {}
};
} // namespace mbgl
} // namespace mln

View File

@@ -12,18 +12,18 @@
struct MockTileData;
struct MockSource {
mbgl::Range<uint8_t> zoomRange{0, 16};
std::map<mbgl::OverscaledTileID, std::unique_ptr<MockTileData>> dataTiles;
std::set<mbgl::OverscaledTileID> idealTiles;
mln::Range<uint8_t> zoomRange{0, 16};
std::map<mln::OverscaledTileID, std::unique_ptr<MockTileData>> dataTiles;
std::set<mln::OverscaledTileID> idealTiles;
// Test API
inline MockTileData* createTileData(const mbgl::OverscaledTileID& tileID);
inline MockTileData* createTileData(const mln::OverscaledTileID& tileID);
};
struct MockBucket {};
struct MockTileData {
MockTileData(const mbgl::OverscaledTileID& tileID_)
MockTileData(const mln::OverscaledTileID& tileID_)
: tileID(tileID_) {}
bool hasTriedCache() const { return triedOptional; }
@@ -35,10 +35,10 @@ struct MockTileData {
bool renderable = false;
bool triedOptional = false;
bool loaded = false;
const mbgl::OverscaledTileID tileID;
const mln::OverscaledTileID tileID;
};
MockTileData* MockSource::createTileData(const mbgl::OverscaledTileID& tileID) {
MockTileData* MockSource::createTileData(const mln::OverscaledTileID& tileID) {
// Replace the existing MockTileData object, if any.
return (dataTiles[tileID] = std::make_unique<MockTileData>(tileID)).get();
}

View File

@@ -238,7 +238,7 @@ static int sqlite3_test_fs_access(sqlite3_vfs* vfs, const char* zPath, int flags
return os_fs->xAccess(os_fs, zPath, flags, pResOut);
}
namespace mbgl {
namespace mln {
namespace test {
SQLite3TestFS::SQLite3TestFS() {
@@ -317,6 +317,6 @@ void SQLite3TestFS::reset() {
}
} // namespace test
} // namespace mbgl
} // namespace mln
#endif // __QT__

View File

@@ -2,7 +2,7 @@
#include <cstdint>
namespace mbgl {
namespace mln {
namespace test {
class SQLite3TestFS {
@@ -37,4 +37,4 @@ public:
};
} // namespace test
} // namespace mbgl
} // namespace mln

View File

@@ -3,7 +3,7 @@
#include <mbgl/util/async_request.hpp>
#include <mbgl/util/client_options.hpp>
namespace mbgl {
namespace mln {
using namespace std::chrono_literals;
@@ -147,4 +147,4 @@ ClientOptions StubFileSource::getClientOptions() {
return clientOptions.clone();
}
} // namespace mbgl
} // namespace mln

View File

@@ -10,7 +10,7 @@
#include <map>
#include <unordered_map>
namespace mbgl {
namespace mln {
class StubFileSource : public FileSource {
public:
@@ -69,4 +69,4 @@ private:
ClientOptions clientOptions;
};
} // namespace mbgl
} // namespace mln

View File

@@ -1,7 +1,7 @@
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/util/feature.hpp>
namespace mbgl {
namespace mln {
class StubGeometryTileFeature : public GeometryTileFeature {
public:
@@ -37,4 +37,4 @@ public:
const GeometryCollection& getGeometries() const override { return geometry; }
};
} // namespace mbgl
} // namespace mln

View File

@@ -2,8 +2,8 @@
#include <mbgl/style/layer_observer.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
/**
* An implementation of style::LayerObserver that forwards all methods to

View File

@@ -4,7 +4,7 @@
#include <functional>
namespace mbgl {
namespace mln {
class StubMapObserver : public MapObserver {
public:
@@ -110,4 +110,4 @@ public:
std::function<void(TileOperation, const OverscaledTileID&, const std::string&)> onTileActionCallback;
};
} // namespace mbgl
} // namespace mln

View File

@@ -2,7 +2,7 @@
#include <mbgl/renderer/render_source_observer.hpp>
using namespace mbgl;
using namespace mln;
/**
* An implementation of style::Observer that forwards all methods to

View File

@@ -2,8 +2,8 @@
#include <mbgl/style/observer.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
/**
* An implementation of style::Observer that forwards all methods to

View File

@@ -2,7 +2,7 @@
#include <mbgl/tile/tile_observer.hpp>
using namespace mbgl;
using namespace mln;
/**
* An implementation of TileObserver that forwards all methods to

View File

@@ -4,7 +4,7 @@
#include <gtest/gtest.h>
namespace mbgl {
namespace mln {
int runTests(int argc, char *argv[]) {
#if (TEST_HAS_SERVER && defined(__QT__)) || USE_CPP_TEST_SERVER
@@ -20,4 +20,4 @@ int runTests(int argc, char *argv[]) {
return RUN_ALL_TESTS();
}
} // namespace mbgl
} // namespace mln

View File

@@ -19,7 +19,7 @@
using namespace ::testing;
namespace mbgl {
namespace mln {
namespace test {
void checkImage(const std::string& base,
@@ -84,4 +84,4 @@ double getImageDiff(const std::string& base, const PremultipliedImage& actual, d
}
} // namespace test
} // namespace mbgl
} // namespace mln

View File

@@ -11,7 +11,7 @@
#include <gtest/gtest.h>
#include <atomic>
using namespace mbgl;
using namespace mln;
#if !ANDROID
TEST(AssetFileSource, Load) {
@@ -29,13 +29,13 @@ TEST(AssetFileSource, Load) {
class TestWorker {
public:
TestWorker(ActorRef<TestWorker>, mbgl::AssetFileSource* fs_)
TestWorker(ActorRef<TestWorker>, mln::AssetFileSource* fs_)
: fs(fs_) {}
void run(std::function<void()> endCallback) {
const std::string asset("asset://nonempty");
requestCallback = [this, asset, endCallback](mbgl::Response res) {
requestCallback = [this, asset, endCallback](mln::Response res) {
EXPECT_EQ(nullptr, res.error);
ASSERT_TRUE(res.data.get());
EXPECT_EQ("content is here\n", *res.data);
@@ -44,20 +44,20 @@ TEST(AssetFileSource, Load) {
endCallback();
request.reset();
} else {
request = fs->request({mbgl::Resource::Unknown, asset}, requestCallback);
request = fs->request({mln::Resource::Unknown, asset}, requestCallback);
}
};
request = fs->request({mbgl::Resource::Unknown, asset}, requestCallback);
request = fs->request({mln::Resource::Unknown, asset}, requestCallback);
}
private:
unsigned numRequests = 1000;
mbgl::AssetFileSource* fs;
std::unique_ptr<mbgl::AsyncRequest> request;
mln::AssetFileSource* fs;
std::unique_ptr<mln::AsyncRequest> request;
std::function<void(mbgl::Response)> requestCallback;
std::function<void(mln::Response)> requestCallback;
};
std::vector<std::unique_ptr<util::Thread<TestWorker>>> threads;

View File

@@ -7,7 +7,7 @@
#include <gtest/gtest.h>
using namespace mbgl;
using namespace mln;
TEST(DatabaseFileSource, PauseResume) {
util::RunLoop loop;
@@ -34,7 +34,7 @@ TEST(DatabaseFileSource, VolatileResource) {
Resource resource{Resource::Unknown, "http://127.0.0.1:3000/test", {}, Resource::LoadingMethod::CacheOnly};
Response response{};
response.data = std::make_shared<std::string>("Cached value");
std::unique_ptr<mbgl::AsyncRequest> req;
std::unique_ptr<mln::AsyncRequest> req;
dbfs->forward(resource, response, [&] {
req = dbfs->request(resource, [&](Response res1) {

View File

@@ -2,7 +2,7 @@
#include <mbgl/util/http_header.hpp>
TEST(HTTPHeader, Parsing) {
using namespace mbgl;
using namespace mln;
http::CacheControl cc;

View File

@@ -7,7 +7,7 @@
#include <mbgl/util/string.hpp>
#include <mbgl/storage/resource_options.hpp>
using namespace mbgl;
using namespace mln;
TEST(HTTPFileSource, TEST_REQUIRES_SERVER(Cancel)) {
util::RunLoop loop;

View File

@@ -27,14 +27,14 @@ std::string toAbsoluteURL(const std::string& fileName) {
char* cwd = getcwd(buff, PATH_MAX + 1);
#endif
// NOLINTNEXTLINE(clang-analyzer-nullability.NullPassedToNonnull)
std::string url = {mbgl::util::FILE_PROTOCOL + std::string(cwd) + "/test/fixtures/storage/assets/" + fileName};
std::string url = {mln::util::FILE_PROTOCOL + std::string(cwd) + "/test/fixtures/storage/assets/" + fileName};
assert(url.size() <= PATH_MAX);
return url;
}
} // namespace
using namespace mbgl;
using namespace mln;
TEST(LocalFileSource, AcceptsURL) {
LocalFileSource fs(ResourceOptions::Default(), ClientOptions());

View File

@@ -12,7 +12,7 @@
#include <mbgl/util/timer.hpp>
#include <mbgl/util/tile_server_options.hpp>
using namespace mbgl;
using namespace mln;
TEST(MainResourceLoader, TEST_REQUIRES_SERVER(CacheResponse)) {
util::RunLoop loop;

View File

@@ -18,7 +18,7 @@ std::string toAbsoluteURL(const std::string &fileName) {
} // namespace
using namespace mbgl;
using namespace mln;
TEST(MBTilesFileSource, AcceptsURL) {
MBTilesFileSource mbtiles(ResourceOptions::Default(), ClientOptions());

View File

@@ -3,8 +3,8 @@
#include <gtest/gtest.h>
using namespace mbgl;
using SourceType = mbgl::style::SourceType;
using namespace mln;
using SourceType = mln::style::SourceType;
TEST(OfflineTilePyramidRegionDefinition, EncodeDecode) {
OfflineTilePyramidRegionDefinition region(

View File

@@ -15,7 +15,7 @@
#include <variant>
using namespace std::literals::string_literals;
using namespace mbgl;
using namespace mln;
using mapbox::sqlite::ResultCode;
static constexpr const char* filename = "test/fixtures/offline_database/offline.db";

View File

@@ -19,7 +19,7 @@
#include <mbgl/storage/sqlite3.hpp>
#include <gtest/gtest.h>
using namespace mbgl;
using namespace mln;
using namespace std::literals::string_literals;
using mapbox::sqlite::ResultCode;

View File

@@ -11,7 +11,7 @@
#include <gtest/gtest.h>
using namespace mbgl;
using namespace mln;
#ifdef WIN32
// Windows doesn't fail immediately like other OS
@@ -309,7 +309,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(NetworkStatusChange)) {
// After 50 milliseconds, we're going to trigger a NetworkStatus change.
util::Timer reachableTimer;
reachableTimer.start(Milliseconds(50), Duration::zero(), []() { mbgl::NetworkStatus::Reachable(); });
reachableTimer.start(Milliseconds(50), Duration::zero(), []() { mln::NetworkStatus::Reachable(); });
loop.run();
}
@@ -357,7 +357,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(NetworkStatusChangePreempt)) {
// After 400 milliseconds + connectionTimeout, we're going to trigger a NetworkStatus change.
util::Timer reachableTimer;
reachableTimer.start(Milliseconds(static_cast<int>(connectionTimeout * 1000) + 400), Duration::zero(), []() {
mbgl::NetworkStatus::Reachable();
mln::NetworkStatus::Reachable();
});
fs->resume();

View File

@@ -13,12 +13,12 @@ namespace {
std::string toAbsoluteURL(const std::string &fileName) {
auto path = std::filesystem::current_path() / "test/fixtures/storage/pmtiles" / fileName;
return std::string(mbgl::util::PMTILES_PROTOCOL) + std::string(mbgl::util::FILE_PROTOCOL) + path.string();
return std::string(mln::util::PMTILES_PROTOCOL) + std::string(mln::util::FILE_PROTOCOL) + path.string();
}
} // namespace
using namespace mbgl;
using namespace mln;
TEST(PMTilesFileSource, AcceptsURL) {
PMTilesFileSource pmtiles(ResourceOptions::Default(), ClientOptions());

View File

@@ -3,21 +3,21 @@
#include <gtest/gtest.h>
TEST(Resource, Style) {
using namespace mbgl;
using namespace mln;
Resource resource = Resource::style("http://example.com");
EXPECT_EQ(Resource::Kind::Style, resource.kind);
EXPECT_EQ("http://example.com", resource.url);
}
TEST(Resource, Source) {
using namespace mbgl;
using namespace mln;
Resource resource = Resource::source("http://example.com");
EXPECT_EQ(Resource::Kind::Source, resource.kind);
EXPECT_EQ("http://example.com", resource.url);
}
TEST(Resource, Tile) {
using namespace mbgl;
using namespace mln;
Resource rasterTile = Resource::tile(
"http://example.com/{z}/{x}/{y}{ratio}.png", 2.0, 1, 2, 3, Tileset::Scheme::XYZ);
@@ -106,14 +106,14 @@ TEST(Resource, Tile) {
}
TEST(Resource, Glyphs) {
using namespace mbgl;
using namespace mln;
Resource resource = Resource::glyphs("http://example.com/{fontstack}/{range}", {{"stack"}}, {0, 255});
EXPECT_EQ(Resource::Kind::Glyphs, resource.kind);
EXPECT_EQ("http://example.com/stack/0-255", resource.url);
}
TEST(Resource, SpriteImage) {
using namespace mbgl;
using namespace mln;
Resource resource = Resource::spriteImage("http://example.com/sprite", 2.0);
EXPECT_EQ(Resource::Kind::SpriteImage, resource.kind);
EXPECT_EQ("http://example.com/sprite@2x.png", resource.url);
@@ -124,14 +124,14 @@ TEST(Resource, SpriteImage) {
}
TEST(Resource, Image) {
using namespace mbgl;
using namespace mln;
Resource resource = Resource::image("http://example.com/sprite.jpg");
EXPECT_EQ(Resource::Kind::Image, resource.kind);
EXPECT_EQ("http://example.com/sprite.jpg", resource.url);
}
TEST(Resource, SpriteJSON) {
using namespace mbgl;
using namespace mln;
Resource resource = Resource::spriteJSON("http://example.com/sprite", 2.0);
EXPECT_EQ(Resource::Kind::SpriteJSON, resource.kind);
EXPECT_EQ("http://example.com/sprite@2x.json", resource.url);

View File

@@ -3,10 +3,10 @@
#include <mbgl/storage/sqlite3.hpp>
using namespace mbgl;
using namespace mln;
TEST(SQLite, Statement) {
using namespace mbgl;
using namespace mln;
mapbox::sqlite::Database db = mapbox::sqlite::Database::open(":memory:", mapbox::sqlite::ReadWriteCreate);
db.exec("CREATE TABLE test (id INTEGER);");

View File

@@ -14,7 +14,7 @@
#include <gtest/gtest.h>
using namespace mbgl;
using namespace mln;
class SyncFileSource : public FileSource {
public:

View File

@@ -1,7 +1,7 @@
#include <mbgl/test/util.hpp>
#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace mln {
namespace style {
namespace conversion {
@@ -47,18 +47,18 @@ public:
static std::optional<std::string> toString(const MockConvertible&) { return std::nullopt; }
static std::optional<mbgl::Value> toValue(const MockConvertible&) { return std::nullopt; }
static std::optional<mln::Value> toValue(const MockConvertible&) { return std::nullopt; }
static std::optional<GeoJSON> toGeoJSON(const MockConvertible&, Error&) { return std::nullopt; }
};
} // namespace conversion
} // namespace style
} // namespace mbgl
} // namespace mln
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(Conversion, Move) {
int dtorCounter = 0;

View File

@@ -6,9 +6,9 @@
#include <mbgl/style/expression/dsl.hpp>
#include <mbgl/util/logging.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(StyleConversion, Function) {
Error error;
@@ -94,7 +94,7 @@ TEST(StyleConversion, TokenStrings) {
ASSERT_TRUE(hasTokens("token {token}"));
ASSERT_TRUE(hasTokens("{token} {token}"));
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
ASSERT_EQ(*convertTokenStringToExpression("{token}"), *toString(get(literal("token"))));
ASSERT_EQ(*convertTokenStringToExpression("token {token}"), *concat(vec(literal("token "), get(literal("token")))));
ASSERT_EQ(*convertTokenStringToExpression("{token} token"), *concat(vec(get(literal("token")), literal(" token"))));
@@ -112,10 +112,10 @@ TEST(StyleConversion, FormattedIdentityFunction) {
Error error;
auto parseFunction = [&](const std::string& json) {
return convertJSON<PropertyValue<mbgl::style::expression::Formatted>>(json, error, true, false);
return convertJSON<PropertyValue<mln::style::expression::Formatted>>(json, error, true, false);
};
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
auto fn1 = parseFunction(R"({ "property": "name", "type": "identity" })");
ASSERT_TRUE(bool(fn1));

View File

@@ -5,8 +5,8 @@
#include <mbgl/util/logging.hpp>
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(GeoJSONOptions, Basic) {
Error error;

View File

@@ -7,9 +7,9 @@
#include <rapidjson/prettywriter.h>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
using namespace std::literals::chrono_literals;
std::unique_ptr<Layer> parseLayer(const std::string& src) {

View File

@@ -12,9 +12,9 @@
#include <array>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(StyleConversion, Light) {
Error error;
@@ -27,30 +27,30 @@ TEST(StyleConversion, Light) {
auto light = parseLight("{}");
ASSERT_TRUE((bool)light);
const mbgl::JSValue colorValue("blue");
const mln::JSValue colorValue("blue");
light->setProperty("color", &colorValue);
ASSERT_FALSE(light->getColor().isUndefined());
ASSERT_TRUE(light->getColor().isConstant());
ASSERT_EQ(light->getColor().asConstant(), mbgl::Color::blue());
ASSERT_EQ(light->getColor().asConstant(), mln::Color::blue());
const mbgl::JSValue intensityValue(0.5);
const mln::JSValue intensityValue(0.5);
light->setProperty("intensity", &intensityValue);
ASSERT_FALSE(light->getIntensity().isUndefined());
ASSERT_TRUE(light->getIntensity().isConstant());
ASSERT_EQ(light->getIntensity().asConstant(), 0.5);
mbgl::JSValue::AllocatorType allocator;
const mbgl::JSValue positionValue(std::move(mbgl::JSValue(rapidjson::kArrayType)
.PushBack(1.f, allocator)
.PushBack(2.f, allocator)
.PushBack(3.f, allocator)
.Move()));
mln::JSValue::AllocatorType allocator;
const mln::JSValue positionValue(std::move(mln::JSValue(rapidjson::kArrayType)
.PushBack(1.f, allocator)
.PushBack(2.f, allocator)
.PushBack(3.f, allocator)
.Move()));
light->setProperty("position", &positionValue);
ASSERT_FALSE(light->getPosition().isUndefined());
ASSERT_TRUE(light->getPosition().isConstant());
std::array<float, 3> expected{{1.f, 2.f, 3.f}};
ASSERT_EQ(light->getPosition().asConstant(), mbgl::style::Position({expected}));
ASSERT_EQ(light->getPosition().asConstant(), mln::style::Position({expected}));
}
{
@@ -74,7 +74,7 @@ TEST(StyleConversion, Light) {
ASSERT_FALSE(light->getPosition().isUndefined());
ASSERT_TRUE(light->getPosition().isConstant());
std::array<float, 3> expected{{3, 90, 90}};
ASSERT_EQ(light->getPosition().asConstant(), mbgl::style::Position({expected}));
ASSERT_EQ(light->getPosition().asConstant(), mln::style::Position({expected}));
ASSERT_FALSE(light->getPosition().isExpression());
}
@@ -85,7 +85,7 @@ TEST(StyleConversion, Light) {
ASSERT_FALSE(light->getColor().isUndefined());
ASSERT_TRUE(light->getColor().isConstant());
ASSERT_FALSE(light->getColor().isExpression());
ASSERT_EQ(light->getColorTransition().duration, mbgl::Duration(mbgl::Milliseconds(1000)));
ASSERT_EQ(light->getColorTransition().duration, mln::Duration(mln::Milliseconds(1000)));
ASSERT_FALSE((bool)light->getColorTransition().delay);
}

View File

@@ -7,9 +7,9 @@
#include <array>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(StyleConversion, Padding) {
Error error;

View File

@@ -4,9 +4,9 @@
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/util/rapidjson.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(StyleConversion, PropertyValue) {
// PropertyValue<T> accepts a constant expression:

View File

@@ -6,9 +6,9 @@
#include <mbgl/util/logging.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(SourceOptions, Basic) {
Error error;

View File

@@ -10,9 +10,9 @@
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
template <class T>
std::string stringify(const T& t) {
@@ -83,13 +83,13 @@ TEST(Stringify, Value) {
}
TEST(Stringify, Filter) {
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
ASSERT_EQ(stringify(Filter()), "null");
ASSERT_EQ(stringify(Filter(eq(literal("a"), literal("b")))), "[\"==\",\"a\",\"b\"]");
}
TEST(Stringify, PropertyExpression) {
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
ASSERT_EQ(stringify(PropertyExpression<float>(interpolate(linear(), zoom(), 0.0, literal(1.0), 1.0, literal(2.0)))),
"[\"interpolate\",[\"linear\"],[\"zoom\"],0.0,1.0,1.0,2.0]");
@@ -115,7 +115,7 @@ TEST(Stringify, PropertyExpression) {
}
TEST(Stringify, PropertyValue) {
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
ASSERT_EQ(stringify(PropertyValue<float>(1)), "1.0");
ASSERT_EQ(stringify(PropertyValue<float>(PropertyExpression<float>(
interpolate(exponential(2.0), zoom(), 0.0, literal(1.0), 1.0, literal(2.0))))),

View File

@@ -5,8 +5,8 @@
#include <mbgl/util/logging.hpp>
using namespace mbgl;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style::conversion;
TEST(Tileset, Empty) {
Error error;

View File

@@ -4,15 +4,15 @@
#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/test/util.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::expression;
using namespace mbgl::style::expression::dsl;
using namespace mln;
using namespace mln::style;
using namespace mln::style::expression;
using namespace mln::style::expression::dsl;
using namespace std::string_literals;
namespace std {
using ::mbgl::operator<<;
using ::mln::operator<<;
}
template <typename T>

View File

@@ -10,8 +10,8 @@
#include <filesystem>
#include <fstream>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
TEST(Expression, IsExpression) {
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> spec;

View File

@@ -2,7 +2,7 @@
#include <mbgl/style/expression/utf8_op_helpers.hpp>
using namespace mbgl::style::expression;
using namespace mln::style::expression;
TEST(Utf8OpHelpers, unicodeLengthOnValidatedUtf8) {
EXPECT_EQ(unicodeLengthOnValidatedUtf8(""), 0);

View File

@@ -1,8 +1,8 @@
#include <mbgl/test/util.hpp>
#include <mbgl/style/expression/util.hpp>
using namespace mbgl;
using namespace mbgl::style::expression;
using namespace mln;
using namespace mln::style::expression;
TEST(Expression, Util_rgba) {
Result<Color> valid = rgba(0, 0, 0, 0);

View File

@@ -16,8 +16,8 @@
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
bool filter(const char* json,
const PropertyMap& featureProperties = {{}},

View File

@@ -5,8 +5,8 @@
#include <mbgl/renderer/property_evaluator.hpp>
#include <mbgl/renderer/data_driven_property_evaluator.hpp>
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
using namespace std::literals::chrono_literals;
float evaluate(Transitioning<PropertyValue<float>>& property, Duration delta = Duration::zero()) {
@@ -83,7 +83,7 @@ TEST(TransitioningDataDrivenPropertyValue, Evaluate) {
Transitioning<PropertyValue<float>> t0{
PropertyValue<float>(0.0f), Transitioning<PropertyValue<float>>(), TransitionOptions(), TimePoint::min()};
using namespace mbgl::style::expression::dsl;
using namespace mln::style::expression::dsl;
PropertyExpression<float> expression(number(get("property_name")));
Transitioning<PropertyValue<float>> t1{PropertyValue<float>(expression), t0, transition, TimePoint::min()};

View File

@@ -11,15 +11,15 @@
#include <sstream>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::expression;
using namespace mbgl::style::expression::dsl;
using namespace mln;
using namespace mln::style;
using namespace mln::style::expression;
using namespace mln::style::expression::dsl;
using namespace std::string_literals;
namespace std {
using ::mbgl::operator<<;
using ::mln::operator<<;
}
static const StubGeometryTileFeature oneInteger{PropertyMap{{"property", uint64_t(1)}}};
@@ -651,13 +651,13 @@ TEST(PropertyExpression, DistanceExpression) {
}
const auto getFeature = [](const std::string &name, FeatureType type, const CanonicalTileID &canonical) {
const auto geometryInput = mbgl::util::read_file(std::string("test/fixtures/geometry_data/" + name));
const auto geometryInput = mln::util::read_file(std::string("test/fixtures/geometry_data/" + name));
mapbox::geojson::geojson geojson{mapbox::geojson::parse(geometryInput)};
const auto &geometry = geojson.match(
[](const mapbox::geometry::geometry<double> &geometrySet) { return mbgl::Feature(geometrySet).geometry; },
[](const mapbox::feature::feature<double> &feature) { return mbgl::Feature(feature).geometry; },
[](const mapbox::geometry::geometry<double> &geometrySet) { return mln::Feature(geometrySet).geometry; },
[](const mapbox::feature::feature<double> &feature) { return mln::Feature(feature).geometry; },
[](const mapbox::feature::feature_collection<double> &features) {
return mbgl::Feature(features.front()).geometry;
return mln::Feature(features.front()).geometry;
},
[](const auto &) { return mapbox::geometry::empty(); });
return StubGeometryTileFeature(type, convertGeometry(geometry, canonical));
@@ -665,7 +665,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiPoint to MultiPoint distance
{
const auto multiPoints1 = mbgl::util::read_file("test/fixtures/geometry_data/multi_point_1.geojson");
const auto multiPoints1 = mln::util::read_file("test/fixtures/geometry_data/multi_point_1.geojson");
const auto multiPointsFeature = getFeature("multi_point_2.geojson", FeatureType::Point, canonicalTileID);
std::stringstream ss;
ss << std::string(R"(["distance", )") << multiPoints1 << std::string(R"( ])");
@@ -680,7 +680,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiPoint to LineString distance
{
const auto multiPoints1 = mbgl::util::read_file("test/fixtures/geometry_data/multi_point_1.geojson");
const auto multiPoints1 = mln::util::read_file("test/fixtures/geometry_data/multi_point_1.geojson");
const auto multiLineFeature = getFeature("line_string_2.geojson", FeatureType::LineString, canonicalTileID);
std::stringstream ss;
ss << std::string(R"(["distance", )") << multiPoints1 << std::string(R"( ])");
@@ -693,7 +693,7 @@ TEST(PropertyExpression, DistanceExpression) {
EXPECT_NEAR(258.691, evaluatedResult, 0.01);
// ----------------- switch feature and argument -----------------
const auto multiLine2 = mbgl::util::read_file("test/fixtures/geometry_data/line_string_2.geojson");
const auto multiLine2 = mln::util::read_file("test/fixtures/geometry_data/line_string_2.geojson");
const auto multiPointsFeature = getFeature("multi_point_1.geojson", FeatureType::Point, canonicalTileID);
std::stringstream ss1;
ss1 << std::string(R"(["distance", )") << multiLine2 << std::string(R"( ])");
@@ -708,7 +708,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with LineString to LineString distance
{
const auto lineString1 = mbgl::util::read_file("test/fixtures/geometry_data/line_string_1.geojson");
const auto lineString1 = mln::util::read_file("test/fixtures/geometry_data/line_string_1.geojson");
const auto lineFeature = getFeature("line_string_2.geojson", FeatureType::LineString, canonicalTileID);
std::stringstream ss;
ss << std::string(R"(["distance", )") << lineString1 << std::string(R"( ])");
@@ -723,7 +723,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiPoints to MutltiLineString distance
{
const auto multiPoints = mbgl::util::read_file("test/fixtures/geometry_data/multi_point_2.geojson");
const auto multiPoints = mln::util::read_file("test/fixtures/geometry_data/multi_point_2.geojson");
const auto multiLineFeature = getFeature(
"multi_line_string_1.geojson", FeatureType::LineString, canonicalTileID);
std::stringstream ss;
@@ -739,7 +739,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with LineString to MutltiLineString distance
{
const auto LineString1 = mbgl::util::read_file("test/fixtures/geometry_data/line_string_1.geojson");
const auto LineString1 = mln::util::read_file("test/fixtures/geometry_data/line_string_1.geojson");
const auto multiLineFeature = getFeature(
"multi_line_string_2.geojson", FeatureType::LineString, canonicalTileID);
std::stringstream ss;
@@ -755,7 +755,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiLineString to MutltiLineString distance
{
const auto multiLineString1 = mbgl::util::read_file("test/fixtures/geometry_data/multi_line_string_1.geojson");
const auto multiLineString1 = mln::util::read_file("test/fixtures/geometry_data/multi_line_string_1.geojson");
const auto multiLineFeature = getFeature(
"multi_line_string_2.geojson", FeatureType::LineString, canonicalTileID);
std::stringstream ss;
@@ -771,7 +771,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiPoint to MultiPolygon distance
{
const auto multiPolygon = mbgl::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
const auto multiPolygon = mln::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
std::stringstream ss;
ss << std::string(R"(["distance", )") << multiPolygon << std::string(R"( ])");
auto expression = createExpression(ss.str().c_str());
@@ -791,7 +791,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiLine to MultiPolygon distance
{
const auto multiPolygon = mbgl::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
const auto multiPolygon = mln::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
std::stringstream ss;
ss << std::string(R"(["distance", )") << multiPolygon << std::string(R"( ])");
auto expression = createExpression(ss.str().c_str());
@@ -813,7 +813,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with Polygon to MultiPolygon distance
{
const auto multiPolygon = mbgl::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
const auto multiPolygon = mln::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
std::stringstream ss;
ss << std::string(R"(["distance", )") << multiPolygon << std::string(R"( ])");
auto expression = createExpression(ss.str().c_str());
@@ -835,7 +835,7 @@ TEST(PropertyExpression, DistanceExpression) {
// Evaluation test with MultiPolygon to MultiPolygon distance
{
const auto multiPolygon = mbgl::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
const auto multiPolygon = mln::util::read_file("test/fixtures/geometry_data/multi_polygon_1.geojson");
std::stringstream ss;
ss << std::string(R"(["distance", )") << multiPolygon << std::string(R"( ])");
auto expression = createExpression(ss.str().c_str());

View File

@@ -51,8 +51,8 @@
#include <optional>
using namespace mbgl;
using SourceType = mbgl::style::SourceType;
using namespace mln;
using SourceType = mln::style::SourceType;
class SourceTest {
public:

View File

@@ -18,8 +18,8 @@
#include <Windows.h>
#endif
using namespace mbgl;
using namespace mbgl::style;
using namespace mln;
using namespace mln::style;
TEST(Style, Properties) {
util::RunLoop loop;

View File

@@ -4,7 +4,7 @@
#include <mbgl/util/image.hpp>
#include <mbgl/util/exception.hpp>
using namespace mbgl;
using namespace mln;
TEST(StyleImage, ZeroWidth) {
try {

View File

@@ -28,9 +28,9 @@
#include <memory>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
using namespace expression;
using namespace expression::dsl;
using namespace std::literals::string_literals;
@@ -63,9 +63,9 @@ class MockLayoutProperties : public Properties<TextField> {};
class MockPaintProperties : public Properties<TextColor> {};
using MockOverrides = FormatSectionOverrides<MockPaintProperties::OverridableProperties>;
mbgl::style::Filter parseFilter(const std::string& expression) {
mln::style::Filter parseFilter(const std::string& expression) {
Error error;
return *convertJSON<mbgl::style::Filter>(expression, error);
return *convertJSON<mln::style::Filter>(expression, error);
}
} // namespace

View File

@@ -23,7 +23,7 @@
#include <dirent.h>
#endif
using namespace mbgl;
using namespace mln;
using Message = std::pair<uint32_t, std::string>;
using Messages = std::vector<Message>;
@@ -189,12 +189,12 @@ TEST(StyleParser, SpriteAsArrayMultiple) {
TEST(StyleParser, FontStacks) {
style::Parser parser;
parser.parse(util::read_file("test/fixtures/style_parser/font_stacks.json"));
std::set<mbgl::FontStack> expected = {
std::set<mln::FontStack> expected = {
{"a"},
{"a", "b"},
{"a", "b", "c"},
};
std::set<mbgl::FontStack> result = parser.fontStacks();
std::set<mln::FontStack> result = parser.fontStacks();
ASSERT_EQ(expected, result);
}
@@ -229,10 +229,10 @@ TEST(StyleParser, FontStacksCaseExpression) {
}
}]
})");
std::set<mbgl::FontStack> expected;
std::set<mln::FontStack> expected;
expected.insert(FontStack({"Arial"}));
expected.insert(FontStack({"Helvetica"}));
std::set<mbgl::FontStack> result = parser.fontStacks();
std::set<mln::FontStack> result = parser.fontStacks();
ASSERT_EQ(expected, result);
}
@@ -250,10 +250,10 @@ TEST(StyleParser, FontStacksMatchExpression) {
}
}]
})");
std::set<mbgl::FontStack> expected;
std::set<mln::FontStack> expected;
expected.insert(FontStack({"Arial"}));
expected.insert(FontStack({"Helvetica"}));
std::set<mbgl::FontStack> result = parser.fontStacks();
std::set<mln::FontStack> result = parser.fontStacks();
ASSERT_EQ(expected, result);
}
@@ -271,10 +271,10 @@ TEST(StyleParser, FontStacksStepExpression) {
}
}]
})");
std::set<mbgl::FontStack> expected;
std::set<mln::FontStack> expected;
expected.insert(FontStack({"Arial"}));
expected.insert(FontStack({"Helvetica"}));
std::set<mbgl::FontStack> result = parser.fontStacks();
std::set<mln::FontStack> result = parser.fontStacks();
ASSERT_EQ(expected, result);
}
@@ -298,9 +298,9 @@ TEST(StyleParser, FontStacksGetExpression) {
}
TEST(StyleParser, ZoomCurve) {
using namespace mbgl::style;
using namespace mbgl::style::expression;
using namespace mbgl::style::expression::dsl;
using namespace mln::style;
using namespace mln::style::expression;
using namespace mln::style::expression::dsl;
const auto zoomInterp = []() {
return interpolate(linear(), zoom(), 0.0, literal(0.0), 0.0, literal(0.0));

View File

@@ -9,9 +9,9 @@
#include <array>
using namespace mbgl;
using namespace mbgl::style;
using namespace mbgl::style::conversion;
using namespace mln;
using namespace mln::style;
using namespace mln::style::conversion;
TEST(VariableAnchorOffsetCollection, Calculations) {
auto parseJson = [&](const std::string& src) {
@@ -19,7 +19,7 @@ TEST(VariableAnchorOffsetCollection, Calculations) {
return convertJSON<VariableAnchorOffsetCollection>(src, error);
};
mbgl::util::Interpolator<VariableAnchorOffsetCollection> interpolator;
mln::util::Interpolator<VariableAnchorOffsetCollection> interpolator;
// valid value
{

View File

@@ -3,7 +3,7 @@
#include <mbgl/text/bidi.hpp>
using namespace mbgl;
using namespace mln;
/*
These tests mirror the unit tests in mapbox-gl-rtl-text's arabic.test.js

View File

@@ -4,7 +4,7 @@
#include <mbgl/layout/symbol_layout.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
using namespace mbgl;
using namespace mln;
TEST(calculateTileDistances, Point) {
const GeometryCoordinates line = {Point<int16_t>{1, 1}};

Some files were not shown because too many files have changed in this diff Show More