Added layout hints config option to class diagrams

This commit is contained in:
Bartek Kryza
2022-02-08 22:19:38 +01:00
parent ed5e8e4e2d
commit fd7d916e3e
4 changed files with 94 additions and 0 deletions

View File

@@ -77,4 +77,28 @@ TEST_CASE("Test config includes", "[unit-test]")
CHECK(cus.include_relations_also_as_members());
CHECK(cus.generate_method_arguments() ==
clanguml::config::method_arguments::none);
}
TEST_CASE("Test config layout", "[unit-test]")
{
auto cfg = clanguml::config::load("./test_config_data/layout.yml");
CHECK(cfg.diagrams.size() == 1);
auto &def = static_cast<clanguml::config::class_diagram &>(
*cfg.diagrams["class_main"]);
CHECK(def.type() == clanguml::config::diagram_type::class_diagram);
CHECK(def.layout().at("ABCD").size() == 2);
CHECK(def.layout().at("ABCD")[0].hint == clanguml::config::hint_t::up);
CHECK(def.layout().at("ABCD")[0].entity == "ABCD_SUBCLASS");
CHECK(def.layout().at("ABCD")[1].hint == clanguml::config::hint_t::left);
CHECK(def.layout().at("ABCD")[1].entity == "ABCD_SIBLING");
CHECK(def.layout().at("ABCD_SIBLING").size() == 2);
CHECK(def.layout().at("ABCD_SIBLING")[0].hint ==
clanguml::config::hint_t::right);
CHECK(def.layout().at("ABCD_SIBLING")[0].entity == "ABCD_OTHER_SIBLING");
CHECK(def.layout().at("ABCD_SIBLING")[1].hint ==
clanguml::config::hint_t::down);
CHECK(def.layout().at("ABCD_SIBLING")[1].entity == "ABCD_SIBLING_SIBLING");
}

View File

@@ -0,0 +1,22 @@
compilation_database_dir: debug
output_directory: output
diagrams:
class_main:
type: class
glob:
- src/**/*.cc
- src/**/*.h
using_namespace:
- clanguml
generate_method_arguments: full
layout:
ABCD:
- up: ABCD_SUBCLASS
- left: ABCD_SIBLING
ABCD_SIBLING:
- right: ABCD_OTHER_SIBLING
- down: ABCD_SIBLING_SIBLING
include:
namespaces:
- clanguml
- ABCD