MCPcopy Create free account
hub / github.com/MITK/MITK / mitkToolManagerTestClass

Class mitkToolManagerTestClass

Modules/Segmentation/Testing/mitkToolManagerTest.cpp:17–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include "mitkToolManager.h"
16
17class mitkToolManagerTestClass
18{
19public:
20 static void TestToolManagerWithOutTools(mitk::ToolManager::Pointer toolManager)
21 {
22 MITK_TEST_CONDITION(toolManager->GetTools().size() == 0, "Get empty tool list")
23 MITK_TEST_CONDITION(toolManager->GetToolById(0) == nullptr, "Get empty tool by id")
24 }
25
26 static void TestToolManagerWithTools(mitk::ToolManager::Pointer toolManager)
27 {
28 MITK_TEST_CONDITION(toolManager->GetTools().size() > 0, "Get tool list with size 1")
29 MITK_TEST_CONDITION(toolManager->GetToolById(0) != nullptr, "Test GetToolById() method")
30 MITK_TEST_CONDITION(toolManager->ActivateTool(0) == true, "Activate tool")
31 MITK_TEST_CONDITION(toolManager->GetActiveToolID() == 0, "Check for right tool id")
32
33 mitk::Tool *tool = toolManager->GetActiveTool();
34 MITK_TEST_CONDITION(tool != nullptr, "Check for right tool")
35 }
36
37 static void TestSetterMethods(mitk::ToolManager::Pointer toolManager)
38 {
39 MITK_TEST_CONDITION(toolManager->GetReferenceData().size() == 0, "Get reference data size (0)")
40
41 mitk::DataNode::Pointer nodeEmpty = mitk::DataNode::New();
42 toolManager->SetReferenceData(nodeEmpty);
43 MITK_TEST_CONDITION(toolManager->GetReferenceData().size() == 1, "Get reference data size (1)")
44 MITK_TEST_CONDITION(toolManager->GetReferenceData(0) == nodeEmpty, "Check if it is the right reference data")
45 MITK_TEST_CONDITION(toolManager->GetReferenceData()[0] == nodeEmpty,
46 "Check if it is the right reference data vector")
47
48 mitk::DataNode::Pointer nodeEmpty2 = mitk::DataNode::New();
49 toolManager->SetWorkingData(nodeEmpty2);
50 MITK_TEST_CONDITION(toolManager->GetWorkingData().size() == 1, "Get working data size (1)")
51 MITK_TEST_CONDITION(toolManager->GetWorkingData(0) == nodeEmpty2, "Check if it is the right working data")
52 MITK_TEST_CONDITION(toolManager->GetWorkingData()[0] == nodeEmpty2, "Check if it is the right working data vector")
53 }
54};
55
56int mitkToolManagerTest(int, char *[])
57{

Callers

nothing calls this directly

Calls 3

GetToolsMethod · 0.80
GetToolByIdMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected