mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
feature: support name based binding paths (#11007) a55da7f31f
* feature: support name based binding paths Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
BIN
tests/unit_tests/assets/relative_data_binding.riv
Normal file
BIN
tests/unit_tests/assets/relative_data_binding.riv
Normal file
Binary file not shown.
@@ -1978,3 +1978,26 @@ TEST_CASE("Artboards as conditions", "[silver]")
|
||||
|
||||
CHECK(silver.matches("databind_artboard"));
|
||||
}
|
||||
|
||||
TEST_CASE("Relative data binding", "[silver]")
|
||||
{
|
||||
SerializingFactory silver;
|
||||
auto file = ReadRiveFile("assets/relative_data_binding.riv", &silver);
|
||||
|
||||
auto artboard = file->artboardDefault();
|
||||
REQUIRE(artboard != nullptr);
|
||||
|
||||
silver.frameSize(artboard->width(), artboard->height());
|
||||
|
||||
auto stateMachine = artboard->stateMachineAt(0);
|
||||
|
||||
auto vmi =
|
||||
file->createViewModelInstance((int)artboard.get()->viewModelId(), 0);
|
||||
|
||||
stateMachine->bindViewModelInstance(vmi);
|
||||
stateMachine->advanceAndApply(0.1f);
|
||||
auto renderer = silver.makeRenderer();
|
||||
artboard->draw(renderer.get());
|
||||
|
||||
CHECK(silver.matches("relative_data_binding"));
|
||||
}
|
||||
|
||||
BIN
tests/unit_tests/silvers/relative_data_binding.sriv
Normal file
BIN
tests/unit_tests/silvers/relative_data_binding.sriv
Normal file
Binary file not shown.
Reference in New Issue
Block a user