mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
fix(EA): list index can be compared to numbers (#11194) e2f7d6cde1
Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
BIN
tests/unit_tests/assets/transition_index_condition.riv
Normal file
BIN
tests/unit_tests/assets/transition_index_condition.riv
Normal file
Binary file not shown.
@@ -17,8 +17,11 @@
|
||||
#include <rive/shapes/shape.hpp>
|
||||
#include "catch.hpp"
|
||||
#include "rive_file_reader.hpp"
|
||||
#include "utils/serializing_factory.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
using namespace rive;
|
||||
|
||||
TEST_CASE("file with state machine be read", "[file]")
|
||||
{
|
||||
auto file = ReadRiveFile("assets/rocket.riv");
|
||||
@@ -502,3 +505,26 @@ TEST_CASE("Triggers will only be used on allowed state changes.", "[file]")
|
||||
|
||||
delete stateMachineInstance;
|
||||
}
|
||||
|
||||
TEST_CASE("Transition with list index can be compared to a number", "[silver]")
|
||||
{
|
||||
SerializingFactory silver;
|
||||
auto file = ReadRiveFile("assets/transition_index_condition.riv", &silver);
|
||||
|
||||
auto artboard = file->artboardDefault();
|
||||
silver.frameSize(artboard->width(), artboard->height());
|
||||
|
||||
auto stateMachine = artboard->stateMachineAt(0);
|
||||
int viewModelId = artboard.get()->viewModelId();
|
||||
|
||||
auto vmi = viewModelId == -1
|
||||
? file->createViewModelInstance(artboard.get())
|
||||
: file->createViewModelInstance(viewModelId, 0);
|
||||
|
||||
stateMachine->bindViewModelInstance(vmi);
|
||||
stateMachine->advanceAndApply(0.0f);
|
||||
auto renderer = silver.makeRenderer();
|
||||
artboard->draw(renderer.get());
|
||||
|
||||
CHECK(silver.matches("transition_index_condition"));
|
||||
}
|
||||
BIN
tests/unit_tests/silvers/transition_index_condition.sriv
Normal file
BIN
tests/unit_tests/silvers/transition_index_condition.sriv
Normal file
Binary file not shown.
Reference in New Issue
Block a user