#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace mbgl; class AnnotationTileTest { public: FakeFileSource fileSource; TransformState transformState; util::RunLoop loop; ThreadPool threadPool { 1 }; AnnotationManager annotationManager; RenderStyle style { threadPool, fileSource }; ImageManager imageManager; GlyphManager glyphManager { fileSource }; TileParameters tileParameters { 1.0, MapDebugOptions(), transformState, threadPool, fileSource, MapMode::Continuous, annotationManager, imageManager, glyphManager }; }; // Don't query stale collision tile TEST(AnnotationTile, Issue8289) { AnnotationTileTest test; AnnotationTile tile(OverscaledTileID(0, 0, 0), test.tileParameters); auto data = std::make_unique(); data->addLayer("test")->addFeature(0, FeatureType::Point, GeometryCollection()); // Simulate layout and placement of a symbol layer. tile.onLayout(GeometryTile::LayoutResult { {}, std::make_unique(), std::move(data), 0 }); auto collisionTile = std::make_unique(PlacementConfig()); IndexedSubfeature subfeature { 0, "", "", 0 }; CollisionFeature feature(GeometryCoordinates(), Anchor(0, 0, 0, 0), -5, 5, -5, 5, 1, 0, style::SymbolPlacementType::Point, subfeature, CollisionFeature::AlignmentType::Curved); collisionTile->insertFeature(feature, 0, true); collisionTile->placeFeature(feature, false, false); tile.onPlacement(GeometryTile::PlacementResult { {}, std::move(collisionTile), {}, {}, 0 }); // Simulate a second layout with empty data. tile.onLayout(GeometryTile::LayoutResult { {}, std::make_unique(), std::make_unique(), 0 }); std::unordered_map> result; GeometryCoordinates queryGeometry {{ Point(0, 0) }}; TransformState transformState; RenderedQueryOptions options; tile.queryRenderedFeatures(result, queryGeometry, transformState, test.style, options); EXPECT_TRUE(result.empty()); }