Improve source tests (#3944)
This commit is contained in:
@@ -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<std::string>(
|
||||
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> layerProperties = makeMutable<LineLayerProperties>(
|
||||
staticImmutableCast<LineLayer::Impl>(layer.baseImpl));
|
||||
std::vector<Immutable<LayerProperties>> 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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user