Extended context filter inward test case to larger radius (#274)
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -8,7 +8,7 @@ diagrams:
|
||||
- clanguml::t00076
|
||||
context:
|
||||
- match:
|
||||
radius: 1
|
||||
radius: 2
|
||||
pattern: clanguml::t00076::B
|
||||
direction: inward
|
||||
#relationships:
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user