fix: reset V17 weather runtime across Android and iOS
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:
@@ -912,3 +912,60 @@ TEST(Source, RasterArrayV4MaterializerDecodesDirectionToUInt16LittleEndian) {
|
||||
EXPECT_NEAR(materialized->t0->vector[7], 0.0f, 1e-5f);
|
||||
EXPECT_EQ(materialized->t0->vectorSemantics, particle::VectorSemantics::Direction);
|
||||
}
|
||||
|
||||
|
||||
// The RN weather source uses Host V3 ingress and V4 QBIN on one Style source.
|
||||
// A terminal detach must clear both, drop old bindings, and permit a new owner.
|
||||
TEST(Source, RasterArrayV4TerminalResetClearsBothIngressesAndAllowsNewGeneration) {
|
||||
style::RasterArraySource source{"v4-detach-reset"};
|
||||
auto v3T0 = particle::OfflineFixtureParticleAdapter::load("uniform-east", 71);
|
||||
auto v3T1 = particle::OfflineFixtureParticleAdapter::load("uniform-north", 72);
|
||||
v3T1.validTime = v3T0.validTime + Hour;
|
||||
ASSERT_EQ(source.submitInitialRuntimeFieldWindow(v3T0, v3T1),
|
||||
style::RasterArrayRuntimeFieldUpdateResult::Applied);
|
||||
ASSERT_TRUE(source.impl().field);
|
||||
ASSERT_TRUE(source.impl().nextField);
|
||||
|
||||
submit(source, "wind", "wind", Base, 1);
|
||||
submit(source, "wind", "wind", Base + Hour, 2);
|
||||
source.setColorBinding({"wind", {1, 1, particle::FieldComponent::UEast},
|
||||
particle::FieldValueClass::VelocityComponent, 1});
|
||||
source.setParticleBinding({particle::ParticleBindingMode::VectorComponents,
|
||||
"wind", {1, 1, particle::FieldComponent::UEast},
|
||||
{2, 1, particle::FieldComponent::VNorth}, {}, 1});
|
||||
ASSERT_TRUE(source.setRequestedForecastTime(Base + Hour / 2));
|
||||
ASSERT_TRUE(source.impl().v4RendererState.color);
|
||||
ASSERT_TRUE(source.impl().v4RendererState.particle);
|
||||
ASSERT_EQ(source.impl().v4RendererState.color->sampleState.mix, 0.5f);
|
||||
EXPECT_EQ(source.impl().v4RendererState.particle->sampleState.mix, 0.5f);
|
||||
source.setForecastPlaybackState(particle::ForecastPlaybackState::Playing);
|
||||
ASSERT_EQ(source.impl().hostFieldSubmission, true);
|
||||
|
||||
ASSERT_TRUE(source.resetWeatherRuntimeState());
|
||||
EXPECT_FALSE(source.impl().field);
|
||||
EXPECT_FALSE(source.impl().nextField);
|
||||
EXPECT_FALSE(source.impl().timeline);
|
||||
EXPECT_EQ(source.impl().v4RendererState.color, nullptr);
|
||||
EXPECT_EQ(source.impl().v4RendererState.particle, nullptr);
|
||||
EXPECT_FALSE(source.impl().v4RendererState.colorInput);
|
||||
EXPECT_FALSE(source.impl().v4RendererState.particleInput);
|
||||
EXPECT_EQ(source.resolveColorProjection().error, particle::BindingProjectionError::InvalidBinding);
|
||||
EXPECT_EQ(source.resolveParticleProjection().error, particle::BindingProjectionError::InvalidBinding);
|
||||
EXPECT_EQ(source.impl().v4RendererState.color, nullptr);
|
||||
EXPECT_EQ(source.impl().v4RendererState.particle, nullptr);
|
||||
EXPECT_FALSE(source.tickForecastClock(std::chrono::steady_clock::now()));
|
||||
EXPECT_TRUE(source.resetWeatherRuntimeState()); // Idempotent.
|
||||
|
||||
submit(source, "wind", "wind", Base, 3);
|
||||
submit(source, "wind", "wind", Base + Hour, 4);
|
||||
source.setColorBinding({"wind", {1, 1, particle::FieldComponent::UEast},
|
||||
particle::FieldValueClass::VelocityComponent, 1});
|
||||
source.setParticleBinding({particle::ParticleBindingMode::VectorComponents,
|
||||
"wind", {1, 1, particle::FieldComponent::UEast},
|
||||
{2, 1, particle::FieldComponent::VNorth}, {}, 1});
|
||||
ASSERT_TRUE(source.setRequestedForecastTime(Base + Hour / 2));
|
||||
EXPECT_TRUE(source.resolveColorProjection().accepted());
|
||||
EXPECT_TRUE(source.resolveParticleProjection().accepted());
|
||||
EXPECT_TRUE(source.impl().v4RendererState.color);
|
||||
EXPECT_TRUE(source.impl().v4RendererState.particle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user