mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
fix: trigger change on solid color change (#11399) b5a73917b1
Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
BIN
tests/unit_tests/assets/solid_affects_has_changed.riv
Normal file
BIN
tests/unit_tests/assets/solid_affects_has_changed.riv
Normal file
Binary file not shown.
37
tests/unit_tests/runtime/render_test.cpp
Normal file
37
tests/unit_tests/runtime/render_test.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "rive/file.hpp"
|
||||
#include "rive/animation/state_machine_instance.hpp"
|
||||
#include "rive/viewmodel/viewmodel.hpp"
|
||||
#include "utils/serializing_factory.hpp"
|
||||
#include "rive_file_reader.hpp"
|
||||
#include "utils/no_op_renderer.hpp"
|
||||
#include <catch.hpp>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
using namespace rive;
|
||||
|
||||
TEST_CASE("file with only solid color animating triggers change on artboard",
|
||||
"[silver]")
|
||||
{
|
||||
auto file = ReadRiveFile("assets/solid_affects_has_changed.riv");
|
||||
|
||||
auto artboard = file->artboardDefault();
|
||||
NoOpRenderer renderer;
|
||||
|
||||
REQUIRE(artboard != nullptr);
|
||||
auto stateMachine = artboard->stateMachineAt(0);
|
||||
|
||||
auto vmi = file->createViewModelInstance(artboard.get());
|
||||
|
||||
stateMachine->bindViewModelInstance(vmi);
|
||||
stateMachine->advanceAndApply(0.1f);
|
||||
artboard->draw(&renderer);
|
||||
|
||||
int frames = 10;
|
||||
for (int i = 0; i < frames; i++)
|
||||
{
|
||||
stateMachine->advanceAndApply(0.1f);
|
||||
REQUIRE(artboard->didChange() == true);
|
||||
artboard->draw(&renderer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user