Added context filter relationships option (#274)

This commit is contained in:
Bartek Kryza
2024-06-13 21:35:11 +02:00
parent db2bd0417a
commit 6952c3296d
10 changed files with 120 additions and 4 deletions

16
tests/t00078/.clang-uml Normal file
View File

@@ -0,0 +1,16 @@
diagrams:
t00078_class:
type: class
glob:
- t00078.cc
include:
namespaces:
- clanguml::t00078
context:
- match:
radius: 1
pattern: clanguml::t00078::A
relationships:
- inheritance
- aggregation
using_namespace: clanguml::t00078

22
tests/t00078/t00078.cc Normal file
View File

@@ -0,0 +1,22 @@
namespace clanguml {
namespace t00078 {
struct Base { };
struct D { };
struct E { };
struct A : public Base {
D d;
E *e;
};
struct B {
A *a;
};
struct C {
A a;
};
}
}

36
tests/t00078/test_case.h Normal file
View File

@@ -0,0 +1,36 @@
/**
* tests/t00078/test_case.h
*
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
TEST_CASE("t00078")
{
using namespace clanguml::test;
using namespace std::string_literals;
auto [config, db, diagram, model] =
CHECK_CLASS_MODEL("t00078", "t00078_class");
CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) {
REQUIRE(IsClass(src, "Base"));
REQUIRE(IsClass(src, "A"));
REQUIRE(IsClass(src, "C"));
REQUIRE(IsClass(src, "D"));
REQUIRE(!IsClass(src, "B"));
REQUIRE(!IsClass(src, "E"));
});
}

View File

@@ -551,6 +551,7 @@ void CHECK_INCLUDE_DIAGRAM(const clanguml::config::config &config,
#endif
#include "t00076/test_case.h"
#include "t00077/test_case.h"
#include "t00078/test_case.h"
///
/// Sequence diagram tests

View File

@@ -228,6 +228,9 @@ test_cases:
- name: t00077
title: Test case for context diagram with outward direction flag
description:
- name: t00078
title: Test case for context diagram with relationships option
description:
Sequence diagrams:
- name: t20001
title: Basic sequence diagram test case