Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkSceneIOCompatibilityTest.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 // MITK
15 #include "mitkTestingMacros.h"
16 
17 // VTK
18 #include <vtkRegressionTestImage.h>
19 
20 int mitkSceneIOCompatibilityTest(int argc, char *argv[])
21 {
22  try
23  {
24  mitk::RenderingTestHelper openGlTest(640, 480);
25  }
26  catch (const mitk::TestNotRunException &e)
27  {
28  MITK_WARN << "Test not run: " << e.GetDescription();
29  return 77;
30  }
31  // Load all arguments but last into a DataStorage,
32  // Take last argument as reference rendering.
33  //
34  // Setup a renderwindow of fixed size X*Y.
35  // Render the DataStorage.
36  // Compare rendering to reference image.
37  MITK_TEST_BEGIN("mitkSceneIOCompatibilityTest")
38 
39  mitk::RenderingTestHelper renderingHelper(200, 200, argc, argv);
40 
41  // Usage of CompareRenderWindowAgainstReference: See documentation of mitkRenderingTestHelper
42  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
43  "CompareRenderWindowAgainstReference test result positive?");
44 
45  // You can use this to generate a new reference
46  // on your platform or after changes:
47  if (false)
48  {
49  renderingHelper.SaveReferenceScreenShot("/where/you/want.png");
50  }
51 
52  MITK_TEST_END();
53 }
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
void SaveReferenceScreenShot(std::string fileName)
SaveReferenceScreenShot Convenience method to save a reference screen shot.
int mitkSceneIOCompatibilityTest(int argc, char *argv[])
bool CompareRenderWindowAgainstReference(int argc, char *argv[], double threshold=10.0)
CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal ...
#define MITK_WARN
Definition: mitkLogMacros.h:19
#define MITK_TEST_CONDITION(COND, MSG)
Specialized mitk::Exception for skipped tests.
and MITK_TEST_END()