Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkVTKRenderWindowSizeTest.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include <vtkRenderWindow.h>
18 #include <vtkSmartPointer.h>
19 
20 #include "mitkTestingMacros.h"
21 
22 void CheckRWSize(int width, int height)
23 {
24  MITK_TEST_OUTPUT(<< "Requesting VTK render window of size " << width << "x" << height);
25  vtkSmartPointer<vtkRenderWindow> renderWindowVTK = vtkRenderWindow::New();
26  renderWindowVTK->SetSize(width, height);
27  renderWindowVTK->SetOffScreenRendering(1); // seems to be related to off-screen rendering (only?)
28 
29  int *renderWindowSize = renderWindowVTK->GetSize();
30 
31  MITK_TEST_CONDITION(renderWindowSize[0] >= width,
32  " Window is at least " << width << "px wide (actually:" << renderWindowSize[0] << ")");
33  MITK_TEST_CONDITION(renderWindowSize[1] >= height,
34  " Window is at least " << height << "px high (actually:" << renderWindowSize[1] << ")");
35 }
36 
54 int mitkVTKRenderWindowSizeTest(int /*argc*/, char * /*argv*/ [])
55 {
56  MITK_TEST_BEGIN("mitkVTKRenderWindowSizeTest")
57 
58  // some power of two default sizes
59  CheckRWSize(128, 128);
60  CheckRWSize(256, 256);
61  CheckRWSize(512, 512);
62 
63  // some other size
64  CheckRWSize(300, 200);
65  CheckRWSize(150, 243);
66 
68 }
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
#define MITK_TEST_OUTPUT(x)
Output some text.
#define MITK_TEST_CONDITION(COND, MSG)
int mitkVTKRenderWindowSizeTest(int, char *[])
void CheckRWSize(int width, int height)
and MITK_TEST_END()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.