forked from Slicer/SlicerGitSVNArchive
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vtkMRMLTableViewNodeTest1.cxx
67 lines (49 loc) · 2.29 KB
/
vtkMRMLTableViewNodeTest1.cxx
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
/*==============================================================================
Program: 3D Slicer
Portions (c) Copyright 2015 Brigham and Women's Hospital (BWH) All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
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.
This file was originally developed by Andras Lasso (PerkLab, Queen's
University) and Kevin Wang (Princess Margaret Hospital, Toronto) and was
supported through OCAIRO and the Applied Cancer Research Unit program of
Cancer Care Ontario.
==============================================================================*/
#include "vtkMRMLScene.h"
#include "vtkMRMLTableNode.h"
#include "vtkMRMLTableViewNode.h"
#include "vtkMRMLCoreTestingMacros.h"
int vtkMRMLTableViewNodeTest1(int , char * [] )
{
vtkNew<vtkMRMLTableViewNode> node1;
EXERCISE_ALL_BASIC_MRML_METHODS(node1.GetPointer());
// Check if modified eventes are only fired if and only if table node ID is changed
vtkNew<vtkMRMLScene> scene;
vtkNew<vtkMRMLTableNode> tableNode1;
vtkNew<vtkMRMLTableNode> tableNode2;
scene->AddNode(tableNode1.GetPointer() );
scene->AddNode(tableNode2.GetPointer());
vtkNew<vtkMRMLCoreTestingUtilities::vtkMRMLNodeCallback> callback;
node1->AddObserver(vtkCommand::AnyEvent, callback.GetPointer());
callback->ResetNumberOfEvents();
node1->SetTableNodeID(tableNode1->GetID());
CHECK_INT(callback->GetNumberOfModified(),1);
callback->ResetNumberOfEvents();
node1->SetTableNodeID(tableNode2->GetID());
CHECK_INT(callback->GetNumberOfModified(),1);
callback->ResetNumberOfEvents();
node1->SetTableNodeID(tableNode2->GetID());
CHECK_INT(callback->GetNumberOfModified(),0);
callback->ResetNumberOfEvents();
node1->SetTableNodeID(nullptr);
CHECK_INT(callback->GetNumberOfModified(),1);
callback->ResetNumberOfEvents();
node1->SetTableNodeID(nullptr);
CHECK_INT(callback->GetNumberOfModified(),0);
std::cout << "vtkMRMLTableViewNodeTest1 completed successfully" << std::endl;
return EXIT_SUCCESS;
}