feat: prepare STEP-114 guarded fast smoke validation
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -526,6 +526,86 @@ TEST(ParticleFastPath, ParticleOnlyStableRevisionIsCandidate) {
|
||||
EXPECT_EQ(decision.reason, ParticleFastPathMissReason::None);
|
||||
}
|
||||
|
||||
TEST(Step114FastPathSafety, PlacementFreeSceneIgnoresControllerStaleOnly) {
|
||||
EXPECT_TRUE(particleFastPathHasPlacementTransition({}, true)); // Missing evidence stays closed.
|
||||
const std::vector<StyleLayerDiagnostics> layers{
|
||||
{0, "background", "background", true, std::nullopt, std::nullopt},
|
||||
{1, "probe", "circle", true, "probe-source", std::nullopt},
|
||||
{2, "color", "weather-color", true, "field", std::nullopt},
|
||||
{3, "particle", "raster-particle", true, "field", std::nullopt}};
|
||||
auto input = fastPathInput();
|
||||
input.hasPlacementTransition = particleFastPathHasPlacementTransition(layers, true);
|
||||
EXPECT_FALSE(input.hasPlacementTransition);
|
||||
EXPECT_TRUE(evaluateParticleFastPath(input).candidate);
|
||||
// This narrow change does not override any source/tile/resource/camera gate.
|
||||
input.contentRevisionMatches = false;
|
||||
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::ContentMutation);
|
||||
input.contentRevisionMatches = true;
|
||||
input.hasPendingChanges = true;
|
||||
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::PendingChanges);
|
||||
input.hasPendingChanges = false;
|
||||
input.cameraMatches = false;
|
||||
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::CameraChanged);
|
||||
input.cameraMatches = true;
|
||||
input.unsupportedContinuousLayer = true;
|
||||
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::UnsupportedContinuousLayer);
|
||||
input.unsupportedContinuousLayer = false;
|
||||
input.annotationMutation = true;
|
||||
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::AnnotationMutation);
|
||||
}
|
||||
|
||||
TEST(Step114FastPathSafety, HiddenEmptyAndAnnotationSymbolsKeepPlacementProtection) {
|
||||
for (const bool visible : {false, true}) {
|
||||
for (const char* id : {"symbol-in-R", "symbol-in-C", "org.maplibre.annotations.points"}) {
|
||||
const std::vector<StyleLayerDiagnostics> layers{
|
||||
{0, "background", "background", true, std::nullopt, std::nullopt},
|
||||
{1, id, "symbol", visible, "symbols", std::nullopt}};
|
||||
EXPECT_TRUE(particleFastPathHasPlacementTransition(layers, true));
|
||||
EXPECT_FALSE(particleFastPathHasPlacementTransition(layers, false));
|
||||
auto input = fastPathInput();
|
||||
input.hasPlacementTransition = particleFastPathHasPlacementTransition(layers, true);
|
||||
EXPECT_EQ(evaluateParticleFastPath(input).reason, ParticleFastPathMissReason::PlacementOrFade);
|
||||
EXPECT_FALSE(renderSegmentPlacementGatePassed(true, true, 0.0f, false));
|
||||
EXPECT_FALSE(renderSegmentPlacementGatePassed(true, false, 0.0f, true));
|
||||
EXPECT_FALSE(renderSegmentPlacementGatePassed(true, false, 1.0f, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Step114FastPathSafety, SourceRevisionRequiresRegistrationAndAsyncCompletionInvalidatesBuild) {
|
||||
RenderSegmentRevisionBook book;
|
||||
const RenderSegmentDependencies dependency{{"local-geojson"}, {}, false};
|
||||
EXPECT_FALSE(book.revisionFor(dependency));
|
||||
const auto missing = assessRenderSegmentSources(dependency, [](const std::string&)
|
||||
-> std::optional<RenderSegmentSourceStatus> { return std::nullopt; });
|
||||
EXPECT_FALSE(missing.ready);
|
||||
EXPECT_FALSE(missing.stable);
|
||||
EXPECT_STREQ(missing.reason, "missing-source");
|
||||
book.advanceSource("local-geojson");
|
||||
const auto initial = book.revisionFor(dependency);
|
||||
ASSERT_TRUE(initial);
|
||||
RetainedUnderlayCache cache;
|
||||
EXPECT_EQ(cache.evaluate(key(), *initial, true), RetainedUnderlayDecision::Build);
|
||||
cache.markBuildSucceeded();
|
||||
EXPECT_EQ(cache.evaluate(key(), *initial, true), RetainedUnderlayDecision::Reuse);
|
||||
book.advanceSource("local-geojson"); // Immutable source data change.
|
||||
const auto submitted = book.revisionFor(dependency);
|
||||
ASSERT_TRUE(submitted);
|
||||
EXPECT_NE(initial, submitted);
|
||||
EXPECT_EQ(cache.evaluate(key(), *submitted, false, "source-not-loaded"), RetainedUnderlayDecision::Fallback);
|
||||
EXPECT_FALSE(cache.isValid());
|
||||
book.advanceSource("local-geojson"); // Models onTileChanged after asynchronous layout.
|
||||
const auto completed = book.revisionFor(dependency);
|
||||
ASSERT_TRUE(completed);
|
||||
EXPECT_NE(submitted, completed);
|
||||
EXPECT_EQ(cache.evaluate(key(), *completed, true), RetainedUnderlayDecision::Build);
|
||||
cache.markBuildSucceeded();
|
||||
EXPECT_EQ(cache.evaluate(key(), *completed, true), RetainedUnderlayDecision::Reuse);
|
||||
book.advanceGlobal(); // Image/glyph/style/context change remains global.
|
||||
EXPECT_NE(completed, book.revisionFor(dependency));
|
||||
EXPECT_EQ(cache.evaluate(key(), *book.revisionFor(dependency), true), RetainedUnderlayDecision::Build);
|
||||
}
|
||||
|
||||
TEST(ParticleFastPath, RevisionCameraAndViewportMismatchReject) {
|
||||
auto input = fastPathInput();
|
||||
input.revisionMatches = false;
|
||||
|
||||
Reference in New Issue
Block a user