diff --git a/src/common/model/diagram_filter.h b/src/common/model/diagram_filter.h index 17758288..2e41b559 100644 --- a/src/common/model/diagram_filter.h +++ b/src/common/model/diagram_filter.h @@ -516,9 +516,10 @@ private: // which have a relationship to any of the effective_context // elements for (const relationship &rel : el.get().relationships()) { - if (context_cfg.direction == - config::context_direction_t::outward/* && - !is_inward(rel.type())*/) { + // At the moment aggregation and composition are added in the + // model in reverse direction so we don't consider them here + if (rel.type() == relationship_t::kAggregation || + rel.type() == relationship_t::kComposition) { continue; } @@ -532,7 +533,6 @@ private: // Now search current effective_context elements and add any // elements of any type in the diagram which have a relationship // to that element - for (const auto element_id : effective_context) { const auto &maybe_element = cd.get(element_id); @@ -547,6 +547,12 @@ private: rel.type() != relationship_t::kComposition)) { continue; } + if (context_cfg.direction == + config::context_direction_t::outward && + (rel.type() == relationship_t::kAggregation || + rel.type() == relationship_t::kComposition)) { + continue; + } if (d.should_include(rel.type()) && rel.destination() == el.get().id()) diff --git a/tests/t00076/.clang-uml b/tests/t00076/.clang-uml index dc8d36fd..12060530 100644 --- a/tests/t00076/.clang-uml +++ b/tests/t00076/.clang-uml @@ -8,7 +8,7 @@ diagrams: - clanguml::t00076 context: - match: - radius: 1 + radius: 2 pattern: clanguml::t00076::B direction: inward #relationships: diff --git a/tests/t00076/t00076.cc b/tests/t00076/t00076.cc index 37da1520..50d6ba5b 100644 --- a/tests/t00076/t00076.cc +++ b/tests/t00076/t00076.cc @@ -4,7 +4,13 @@ namespace t00076 { enum Color { red, green, blue }; struct F; -struct G { }; +struct GG { }; +struct G { + GG gg; +}; +struct GGG { + G g; +}; struct H { }; struct J { }; @@ -24,9 +30,17 @@ struct C : public B { }; struct D : public C { }; +struct EE { }; + struct E { B *b; + EE *ee; }; + +struct EEE { + E *e; +}; + struct F { }; struct I { diff --git a/tests/t00076/test_case.h b/tests/t00076/test_case.h index 7292f632..5efba40f 100644 --- a/tests/t00076/test_case.h +++ b/tests/t00076/test_case.h @@ -27,14 +27,21 @@ TEST_CASE("t00076") CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) { REQUIRE(IsClass(src, "B")); REQUIRE(IsClass(src, "C")); + REQUIRE(IsClass(src, "D")); REQUIRE(IsClass(src, "E")); + REQUIRE(IsClass(src, "EEE")); + REQUIRE(IsClass(src, "G")); + REQUIRE(IsClass(src, "GG")); + REQUIRE(IsClass(src, "I")); REQUIRE(IsClass(src, "J")); + REQUIRE(IsEnum(src, "Color")); REQUIRE(!IsClass(src, "A")); - REQUIRE(!IsClass(src, "D")); REQUIRE(!IsClass(src, "F")); REQUIRE(!IsClass(src, "H")); + REQUIRE(!IsClass(src, "EE")); + REQUIRE(!IsClass(src, "GGG")); }); } \ No newline at end of file