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
|
// which have a relationship to any of the effective_context
|
||||||
// elements
|
// elements
|
||||||
for (const relationship &rel : el.get().relationships()) {
|
for (const relationship &rel : el.get().relationships()) {
|
||||||
if (context_cfg.direction ==
|
// At the moment aggregation and composition are added in the
|
||||||
config::context_direction_t::outward/* &&
|
// model in reverse direction so we don't consider them here
|
||||||
!is_inward(rel.type())*/) {
|
if (rel.type() == relationship_t::kAggregation ||
|
||||||
|
rel.type() == relationship_t::kComposition) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +533,6 @@ private:
|
|||||||
// Now search current effective_context elements and add any
|
// Now search current effective_context elements and add any
|
||||||
// elements of any type in the diagram which have a relationship
|
// elements of any type in the diagram which have a relationship
|
||||||
// to that element
|
// to that element
|
||||||
|
|
||||||
for (const auto element_id : effective_context) {
|
for (const auto element_id : effective_context) {
|
||||||
const auto &maybe_element = cd.get(element_id);
|
const auto &maybe_element = cd.get(element_id);
|
||||||
|
|
||||||
@@ -547,6 +547,12 @@ private:
|
|||||||
rel.type() != relationship_t::kComposition)) {
|
rel.type() != relationship_t::kComposition)) {
|
||||||
continue;
|
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()) &&
|
if (d.should_include(rel.type()) &&
|
||||||
rel.destination() == el.get().id())
|
rel.destination() == el.get().id())
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ diagrams:
|
|||||||
- clanguml::t00076
|
- clanguml::t00076
|
||||||
context:
|
context:
|
||||||
- match:
|
- match:
|
||||||
radius: 1
|
radius: 2
|
||||||
pattern: clanguml::t00076::B
|
pattern: clanguml::t00076::B
|
||||||
direction: inward
|
direction: inward
|
||||||
#relationships:
|
#relationships:
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ namespace t00076 {
|
|||||||
enum Color { red, green, blue };
|
enum Color { red, green, blue };
|
||||||
|
|
||||||
struct F;
|
struct F;
|
||||||
struct G { };
|
struct GG { };
|
||||||
|
struct G {
|
||||||
|
GG gg;
|
||||||
|
};
|
||||||
|
struct GGG {
|
||||||
|
G g;
|
||||||
|
};
|
||||||
struct H { };
|
struct H { };
|
||||||
struct J { };
|
struct J { };
|
||||||
|
|
||||||
@@ -24,9 +30,17 @@ struct C : public B { };
|
|||||||
|
|
||||||
struct D : public C { };
|
struct D : public C { };
|
||||||
|
|
||||||
|
struct EE { };
|
||||||
|
|
||||||
struct E {
|
struct E {
|
||||||
B *b;
|
B *b;
|
||||||
|
EE *ee;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct EEE {
|
||||||
|
E *e;
|
||||||
|
};
|
||||||
|
|
||||||
struct F { };
|
struct F { };
|
||||||
|
|
||||||
struct I {
|
struct I {
|
||||||
|
|||||||
@@ -27,14 +27,21 @@ TEST_CASE("t00076")
|
|||||||
CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) {
|
CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) {
|
||||||
REQUIRE(IsClass(src, "B"));
|
REQUIRE(IsClass(src, "B"));
|
||||||
REQUIRE(IsClass(src, "C"));
|
REQUIRE(IsClass(src, "C"));
|
||||||
|
REQUIRE(IsClass(src, "D"));
|
||||||
REQUIRE(IsClass(src, "E"));
|
REQUIRE(IsClass(src, "E"));
|
||||||
|
REQUIRE(IsClass(src, "EEE"));
|
||||||
|
|
||||||
REQUIRE(IsClass(src, "G"));
|
REQUIRE(IsClass(src, "G"));
|
||||||
|
REQUIRE(IsClass(src, "GG"));
|
||||||
|
|
||||||
REQUIRE(IsClass(src, "I"));
|
REQUIRE(IsClass(src, "I"));
|
||||||
REQUIRE(IsClass(src, "J"));
|
REQUIRE(IsClass(src, "J"));
|
||||||
|
|
||||||
REQUIRE(IsEnum(src, "Color"));
|
REQUIRE(IsEnum(src, "Color"));
|
||||||
REQUIRE(!IsClass(src, "A"));
|
REQUIRE(!IsClass(src, "A"));
|
||||||
REQUIRE(!IsClass(src, "D"));
|
|
||||||
REQUIRE(!IsClass(src, "F"));
|
REQUIRE(!IsClass(src, "F"));
|
||||||
REQUIRE(!IsClass(src, "H"));
|
REQUIRE(!IsClass(src, "H"));
|
||||||
|
REQUIRE(!IsClass(src, "EE"));
|
||||||
|
REQUIRE(!IsClass(src, "GGG"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user