fix: restore particle timeline readiness after field adapter
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:
@@ -273,6 +273,53 @@ TEST(Source, ParticleFieldDataAdapterReturnsStructuredValidationErrors) {
|
||||
EXPECT_EQ(result.error, particle::ParticleFieldAdapterError::UnsupportedFormat);
|
||||
}
|
||||
|
||||
TEST(Source, RasterArrayTimelineCandidatesReachReadyThroughFieldAdapter) {
|
||||
SourceTest test;
|
||||
const auto eastMetadata = fixtureBytes("uniform-east", "metadata.json");
|
||||
const auto eastField = fixtureBytes("uniform-east", "field.f32");
|
||||
const auto northMetadata = fixtureBytes("uniform-north", "metadata.json");
|
||||
const auto northField = fixtureBytes("uniform-north", "field.f32");
|
||||
const auto vortexMetadata = fixtureBytes("vortex", "metadata.json");
|
||||
const auto vortexField = fixtureBytes("vortex", "field.f32");
|
||||
test.fileSource->sourceResponse = [&](const Resource& resource) -> Response {
|
||||
Response response;
|
||||
const std::string* text = nullptr;
|
||||
const std::string* bytes = nullptr;
|
||||
if (resource.url == "east-metadata") text = &eastMetadata;
|
||||
if (resource.url == "east-field") bytes = &eastField;
|
||||
if (resource.url == "north-metadata") text = &northMetadata;
|
||||
if (resource.url == "north-field") bytes = &northField;
|
||||
if (resource.url == "vortex-metadata") text = &vortexMetadata;
|
||||
if (resource.url == "vortex-field") bytes = &vortexField;
|
||||
if (text) response.data = std::make_unique<std::string>(*text);
|
||||
if (bytes) response.data = std::make_unique<std::string>(*bytes);
|
||||
if (!response.data) ADD_FAILURE() << "Unexpected Timeline resource: " << resource.url;
|
||||
return response;
|
||||
};
|
||||
|
||||
style::RasterArraySource source{
|
||||
"source", "uniform-east", "east-metadata", "east-field", "uniform-north", "north-metadata", "north-field",
|
||||
{{"vortex", "vortex-metadata", "vortex-field", 0}}};
|
||||
source.setObserver(&test.styleObserver);
|
||||
test.styleObserver.sourceChanged = [&](Source&) {
|
||||
if (source.impl().timeline) test.end();
|
||||
};
|
||||
source.loadDescription(*test.fileSource);
|
||||
test.run();
|
||||
|
||||
ASSERT_TRUE(source.impl().timeline);
|
||||
const auto frame = source.impl().timeline->frame();
|
||||
ASSERT_TRUE(frame.t0);
|
||||
ASSERT_TRUE(frame.t1);
|
||||
EXPECT_EQ(frame.state, style::RasterArrayPlaybackState::Ready);
|
||||
EXPECT_EQ(frame.t0Index, 0u);
|
||||
EXPECT_TRUE(frame.t0->isValid());
|
||||
EXPECT_TRUE(frame.t1->isValid());
|
||||
EXPECT_FALSE(frame.t1->fieldID.empty());
|
||||
EXPECT_GT(frame.t1->generation, 0u);
|
||||
EXPECT_TRUE(source.impl().timeline->play());
|
||||
}
|
||||
|
||||
TEST(Source, RasterArrayGpuReuseConsumesNewRevision) {
|
||||
const auto oldT1 = particle::OfflineFixtureParticleAdapter::load("uniform-north", 100);
|
||||
auto wantedNewT0 = oldT1;
|
||||
|
||||
Reference in New Issue
Block a user