Added decorator diagram scope
This commit is contained in:
@@ -13,7 +13,7 @@ class B {
|
||||
};
|
||||
|
||||
///
|
||||
/// @clanguml{note[bottom] C class note.}
|
||||
/// @clanguml{note:t00028_class[bottom] C class note.}
|
||||
/// This is class C.
|
||||
class C {
|
||||
};
|
||||
@@ -30,6 +30,10 @@ template <typename T> class E {
|
||||
T param;
|
||||
};
|
||||
|
||||
/// \clanguml{note:other_diagram[left] G class note.}
|
||||
class G {
|
||||
};
|
||||
|
||||
/// @clanguml{note[ bottom ] F enum note.}
|
||||
enum class F { one, two, three };
|
||||
|
||||
@@ -44,6 +48,8 @@ class R {
|
||||
std::vector<std::shared_ptr<D>> ddd;
|
||||
|
||||
E<int> eee;
|
||||
|
||||
G **ggg;
|
||||
};
|
||||
|
||||
} // namespace t00028
|
||||
|
||||
@@ -59,6 +59,7 @@ note.)";
|
||||
REQUIRE_THAT(puml, HasNote(_A("D"), "left", d_note));
|
||||
REQUIRE_THAT(puml, HasNote(_A("E<T>"), "left", "E template class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("F"), "bottom", "F enum note."));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note."));
|
||||
|
||||
save_puml(
|
||||
|
||||
@@ -157,3 +157,31 @@ TEST_CASE("Test decorator parser on skiprelationship", "[unit-test]")
|
||||
|
||||
CHECK(n1);
|
||||
}
|
||||
|
||||
TEST_CASE("Test decorator parser on diagram scope", "[unit-test]")
|
||||
{
|
||||
std::string comment = R"(
|
||||
\clanguml{note:diagram1, diagram2,
|
||||
diagram3[left] Note only for diagrams 1, 2 and 3.}
|
||||
)";
|
||||
|
||||
using namespace clanguml::decorators;
|
||||
|
||||
auto decorators = parse(comment);
|
||||
|
||||
CHECK(decorators.size() == 1);
|
||||
|
||||
auto n1 = std::dynamic_pointer_cast<note>(decorators.at(0));
|
||||
|
||||
CHECK(n1);
|
||||
CHECK(n1->diagrams.size() == 3);
|
||||
CHECK(n1->diagrams[0] == "diagram1");
|
||||
CHECK(n1->diagrams[1] == "diagram2");
|
||||
CHECK(n1->diagrams[2] == "diagram3");
|
||||
|
||||
CHECK(n1->position == "left");
|
||||
CHECK(n1->text == "Note only for diagrams 1, 2 and 3.");
|
||||
|
||||
CHECK(n1->applies_to_diagram("diagram2"));
|
||||
CHECK(!n1->applies_to_diagram("diagram4"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user