@@ -350,6 +350,36 @@ TEST(RField, StreamerSchemaEvolution)
350350 EXPECT_EQ (137 , ptrF->fValue );
351351}
352352
353+ TEST (RField, StreamerToClassFieldSupport)
354+ {
355+ FileRaii fileGuard (" test_ntuple_rfield_streamer_to_class_field_support.root" );
356+
357+ {
358+ auto model = RNTupleModel::Create ();
359+ model->AddField (std::make_unique<ROOT::RStreamerField>(" f" , " CustomStreamerEvolution" ));
360+ auto writer = RNTupleWriter::Recreate (std::move (model), " ntpl" , fileGuard.GetPath ());
361+ auto ptr = writer->GetModel ().GetDefaultEntry ().GetPtr <CustomStreamerEvolution>(" f" );
362+ ptr->x = 137 ;
363+ writer->Fill ();
364+ }
365+
366+ auto cl = TClass::GetClass (" CustomStreamerEvolution" );
367+ ASSERT_TRUE (cl != nullptr );
368+ cl->CreateAttributeMap ();
369+ cl->GetAttributeMap ()->AddProperty (" rntuple.streamerMode" , " false" );
370+
371+ const auto inMemoryField = RFieldBase::Create (" f" , " CustomStreamer" ).Unwrap ();
372+ const auto inMemoryFieldPtr = inMemoryField.get (); // silence clang
373+ EXPECT_EQ (typeid (*inMemoryFieldPtr), typeid (ROOT::RClassField));
374+
375+ auto reader = RNTupleReader::Open (" ntpl" , fileGuard.GetPath ());
376+ auto v = reader->GetView <CustomStreamerEvolution>(" f" );
377+ const auto &onDiskField = v.GetField ();
378+ EXPECT_EQ (typeid (onDiskField), typeid (ROOT::RStreamerField));
379+
380+ EXPECT_FLOAT_EQ (137 , v (0 ).x );
381+ }
382+
353383TEST (RField, StreamerClassMismatch)
354384{
355385 FileRaii fileGuard (" test_ntuple_rfield_streamer_class_mismatch.root" );
0 commit comments