From 34be1edab0effe331ddc18a3a405a4b3211af286 Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Wed, 19 Nov 2025 14:16:54 +0100 Subject: [PATCH] Improve source tests (#3944) --- test/style/source.test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index 70d784111..fd02e7aa5 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -668,14 +668,14 @@ TEST(Source, GeoJSonSourceUrlUpdate) { SourceTest test; test.fileSource->sourceResponse = [&](const Resource& resource) { - EXPECT_EQ("url", resource.url); + EXPECT_EQ("http://source-url.ext", resource.url); Response response; response.data = std::make_unique( R"({"geometry": {"type": "Point", "coordinates": [1.1, 1.1]}, "type": "Feature", "properties": {}})"); return response; }; - test.styleObserver.sourceDescriptionChanged = [&](Source&) { + test.styleObserver.sourceLoaded = [&](Source&) { // Should be called (test will hang if it doesn't) test.end(); }; @@ -690,6 +690,7 @@ TEST(Source, GeoJSonSourceUrlUpdate) { test.loop.invoke([&]() { // Update the url source.setURL(std::string("http://source-url.ext")); + source.loadDescription(*test.fileSource); }); test.run(); @@ -836,6 +837,7 @@ TEST(Source, InvisibleSourcesTileNecessity) { Immutable layerProperties = makeMutable( staticImmutableCast(layer.baseImpl)); std::vector> layers{layerProperties}; + EXPECT_CALL(renderTilesetSource, tileSetMinimumUpdateInterval).Times(testing::AnyNumber()); EXPECT_CALL(renderTilesetSource, tileSetNecessity(TileNecessity::Required)).Times(1); renderSource->update(initialized.baseImpl, layers, true, true, test.tileParameters()); @@ -863,6 +865,7 @@ TEST(Source, SourceMinimumUpdateInterval) { Duration minimumTileUpdateInterval = initialized.getMinimumTileUpdateInterval(); auto baseImpl = initialized.baseImpl; EXPECT_EQ(Duration::zero(), minimumTileUpdateInterval); + EXPECT_CALL(renderTilesetSource, tileSetNecessity).Times(testing::AnyNumber()); EXPECT_CALL(renderTilesetSource, tileSetMinimumUpdateInterval(minimumTileUpdateInterval)).Times(1); renderSource->update(baseImpl, layers, true, false, test.tileParameters());