Skip to content

Commit 47cba1f

Browse files
bodymovinbodymovin
andcommitted
chore(runtime): add computed root values test (#12830) d17e462c1a
Co-authored-by: hernan <hernan@rive.app>
1 parent e06da6a commit 47cba1f

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

.rive_head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3a7bd9bfdfa9b2c36abd0d0040ae240934902530
1+
d17e462c1a234f369a92cdf723d3a6b312219b1f
858 KB
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <rive/file.hpp>
2+
#include <rive/node.hpp>
3+
#include <utils/no_op_renderer.hpp>
4+
#include "rive/animation/state_machine_instance.hpp"
5+
#include "utils/serializing_factory.hpp"
6+
#include "rive_file_reader.hpp"
7+
#include <catch.hpp>
8+
#include <cstdio>
9+
10+
using namespace rive;
11+
12+
TEST_CASE("Computed root values", "[silver]")
13+
{
14+
SerializingFactory silver;
15+
auto file = ReadRiveFile("assets/computed_values_test.riv", &silver);
16+
17+
auto artboard = file->artboardDefault();
18+
silver.frameSize(artboard->width(), artboard->height());
19+
20+
auto stateMachine = artboard->stateMachineAt(0);
21+
22+
auto vmi = file->createDefaultViewModelInstance(artboard.get());
23+
stateMachine->bindViewModelInstance(vmi);
24+
25+
auto renderer = silver.makeRenderer();
26+
stateMachine->advanceAndApply(0.0f);
27+
stateMachine->advanceAndApply(0.016f);
28+
artboard->draw(renderer.get());
29+
30+
int frames = (int)(2.0f / 0.032f);
31+
for (int i = 0; i < frames; i++)
32+
{
33+
silver.addFrame();
34+
stateMachine->advanceAndApply(0.032f);
35+
artboard->draw(renderer.get());
36+
}
37+
38+
CHECK(silver.matches("computed_values_test"));
39+
}
298 KB
Binary file not shown.

0 commit comments

Comments
 (0)