FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodeeditor/test/src/TestDataModelRegistry.cpp at master · BehaviorTree/nodeeditor · GitHub
BehaviorTree
/
nodeeditor
Public
forked from
l3enQ/nodeeditor
Notifications
You must be signed in to change notification settings
Fork
0
Star
4
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodeeditor
/
test
/
src
/
TestDataModelRegistry.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
72 lines (60 loc) · 1.49 KB
Breadcrumbs
nodeeditor
/
test
/
src
/
TestDataModelRegistry.cpp
Copy path
File metadata and controls
72 lines (60 loc) · 1.49 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
include
<
nodes/DataModelRegistry
>
#
include
<
catch2/catch.hpp
>
#
include
"
StubNodeDataModel.hpp
"
using
QtNodes::DataModelRegistry;
using
QtNodes::NodeData;
using
QtNodes::NodeDataModel;
using
QtNodes::NodeDataType;
using
QtNodes::PortIndex;
using
QtNodes::PortType;
namespace
{
class
StubModelStaticName
:
public
StubNodeDataModel
{
public:
static
QString
Name
()
{
return
"
Name
"
;
}
};
}
TEST_CASE
(
"
DataModelRegistry::registerModel
"
,
"
[interface]
"
)
{
DataModelRegistry registry;
SECTION
(
"
stub model
"
)
{
registry.
registerModel
<StubNodeDataModel>();
auto
model = registry.
create
(
"
name
"
);
CHECK
(model->
name
() ==
"
name
"
);
}
SECTION
(
"
stub model with static name
"
)
{
registry.
registerModel
<StubModelStaticName>();
auto
model = registry.
create
(
"
Name
"
);
CHECK
(model->
name
() ==
"
name
"
);
}
SECTION
(
"
From model creator function
"
)
{
SECTION
(
"
non-static name()
"
)
{
registry.
registerModel
([] {
return
std::make_unique<StubNodeDataModel>();
});
auto
model = registry.
create
(
"
name
"
);
REQUIRE
(model !=
nullptr
);
CHECK
(model->
name
() ==
"
name
"
);
CHECK
(
dynamic_cast
<StubNodeDataModel*>(model.
get
()));
}
SECTION
(
"
static Name()
"
)
{
registry.
registerModel
([] {
return
std::make_unique<StubModelStaticName>();
});
auto
model = registry.
create
(
"
Name
"
);
REQUIRE
(model !=
nullptr
);
CHECK
(model->
name
() ==
"
name
"
);
CHECK
(
dynamic_cast
<StubModelStaticName*>(model.
get
()));
}
}
}
Back
|
FazBrowse Home
|
New Git URL