• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / libossia / 36514539233

29 Sep 2026 02:51AM UTC coverage: 52.33% (+0.3%) from 52.019%
36514539233

Pull #955

github

web-flow
Merge a2a9cee15 into bc8a632b4
Pull Request #955: dataflow: format_set, immediate-cycle report, fft zero-fill, merge_scenes fields, camera aspect flag

272 of 291 new or added lines in 9 files covered. (93.47%)

5 existing lines in 3 files now uncovered.

31941 of 61038 relevant lines covered (52.33%)

174474.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.81
/tests/Dataflow/MergeScenesTest.cpp
1
#include <ossia/detail/config.hpp>
2

3
#include <ossia/dataflow/geometry_port.hpp>
4

5
#include "include_catch.hpp"
6

7
#include <array>
8
#include <memory>
9

10
namespace
11
{
12
std::shared_ptr<ossia::scene_state> make_state()
12 ✔
13
{
14
  auto s = std::make_shared<ossia::scene_state>();
12 ✔
15
  s->roots = std::make_shared<std::vector<ossia::scene_node_ptr>>();
12 ✔
16
  return s;
12 ✔
NEW
17
}
×
18

19
ossia::scene_spec merge(const std::shared_ptr<ossia::scene_state>& a,
7 ✔
20
                        const std::shared_ptr<ossia::scene_state>& b)
21
{
22
  std::array<ossia::scene_spec, 2> specs{ossia::scene_spec{a}, ossia::scene_spec{b}};
7 ✔
23
  return ossia::merge_scenes(specs);
14 ✔
24
}
7 ✔
25
}
26

27
TEST_CASE("merge_scenes_skeletons", "merge_scenes")
3 ✔
28
{
29
  auto shared = std::make_shared<const ossia::skeleton_component>();
3 ✔
30
  auto own_a = std::make_shared<const ossia::skeleton_component>();
3 ✔
31
  auto own_b = std::make_shared<const ossia::skeleton_component>();
3 ✔
32

33
  auto a = make_state();
3 ✔
34
  auto b = make_state();
3 ✔
35

36
  SECTION("one contributor: its list is reused as is")
3 ✔
37
  {
38
    auto list = std::make_shared<const std::vector<ossia::skeleton_component_ptr>>(
39
        std::vector<ossia::skeleton_component_ptr>{own_a});
3 ✔
40
    a->skeletons = list;
1 ✔
41
    auto m = merge(a, b);
1 ✔
42
    REQUIRE(m.state);
1 ✔
43
    CHECK(m.state->skeletons == list);
1 ✔
44
  }
4 ✔
45

46
  SECTION("several contributors: concatenated, shared ones once")
3 ✔
47
  {
48
    a->skeletons = std::make_shared<const std::vector<ossia::skeleton_component_ptr>>(
2 ✔
49
        std::vector<ossia::skeleton_component_ptr>{shared, own_a});
6 ✔
50
    b->skeletons = std::make_shared<const std::vector<ossia::skeleton_component_ptr>>(
2 ✔
51
        std::vector<ossia::skeleton_component_ptr>{own_b, shared});
6 ✔
52
    auto m = merge(a, b);
1 ✔
53
    REQUIRE(m.state->skeletons);
1 ✔
54
    CHECK(
6 ✔
55
        *m.state->skeletons
56
        == std::vector<ossia::skeleton_component_ptr>{shared, own_a, own_b});
57
  }
4 ✔
58

59
  SECTION("none")
3 ✔
60
  {
61
    CHECK_FALSE(merge(a, b).state->skeletons);
1 ✔
62
  }
3 ✔
63
}
7 ✔
64

65
TEST_CASE("merge_scenes_shadow_cascades", "merge_scenes")
1 ✔
66
{
67
  int texture{};
1 ✔
68
  auto a = make_state();
1 ✔
69
  auto b = make_state();
1 ✔
70

71
  a->shadow_cascades.shadow_map_array.native_handle = &texture;
1 ✔
72
  b->shadow_cascades.cascade_count = 3;
1 ✔
73
  b->shadow_cascades.shadow_distance = 42.f;
1 ✔
74

75
  auto m = merge(a, b);
1 ✔
76
  CHECK(m.state->shadow_cascades.cascade_count == 3);
1 ✔
77
  CHECK(m.state->shadow_cascades.shadow_distance == 42.f);
1 ✔
78
  // The cascades of b render into the array a provides.
79
  CHECK(m.state->shadow_cascades.shadow_map_array.native_handle == &texture);
1 ✔
80
}
1 ✔
81

82
TEST_CASE("merge_scenes_injections", "merge_scenes")
1 ✔
83
{
84
  int x{}, y{}, z{};
1 ✔
85
  auto a = make_state();
1 ✔
86
  auto b = make_state();
1 ✔
87
  a->inject_buffers.push_back({"lights", &x, 16});
2 ✔
88
  a->inject_buffers.push_back({"extra", &y, 8});
2 ✔
89
  b->inject_buffers.push_back({"lights", &z, 32});
2 ✔
90
  a->inject_textures.push_back({"noise", &x});
2 ✔
91
  b->inject_textures.push_back({"noise", &y});
2 ✔
92

93
  auto m = merge(a, b);
1 ✔
94
  const auto& buffers = m.state->inject_buffers;
1 ✔
95
  REQUIRE(buffers.size() == 2);
1 ✔
96
  CHECK(buffers[0].name == "extra");
1 ✔
97
  CHECK(buffers[1].name == "lights");
1 ✔
98
  CHECK(buffers[1].native_handle == &z);
1 ✔
99
  CHECK(buffers[1].byte_size == 32);
1 ✔
100

101
  REQUIRE(m.state->inject_textures.size() == 1);
1 ✔
102
  CHECK(m.state->inject_textures[0].native_handle == &y);
1 ✔
103
}
9 ✔
104

105
TEST_CASE("merge_scenes_variants_and_indices", "merge_scenes")
1 ✔
106
{
107
  auto a = make_state();
1 ✔
108
  auto b = make_state();
1 ✔
109
  a->version = 4;
1 ✔
110
  b->version = 9;
1 ✔
111
  a->dirty_index = 12;
1 ✔
112
  b->dirty_index = 3;
1 ✔
113
  b->active_variant_index = 1;
1 ✔
114
  b->variant_names = {"day", "night"};
5 ✔
115

116
  auto m = merge(a, b);
1 ✔
117
  CHECK(m.state->version == 10);
1 ✔
118
  CHECK(m.state->dirty_index == 13);
1 ✔
119
  CHECK(m.state->active_variant_index == 1);
1 ✔
120
  REQUIRE(m.state->variant_names.size() == 2);
1 ✔
121
  CHECK(m.state->variant_names[1] == "night");
1 ✔
122

123
  // The first contributor that picked a variant wins.
124
  a->active_variant_index = 0;
1 ✔
125
  CHECK(merge(a, b).state->active_variant_index == 0);
1 ✔
126
}
1 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc