43 CPPUNIT_TEST_SUITE(mitkDICOMLocaleTestSuite);
44 CPPUNIT_TEST_SUITE_ADD_CUSTOM_TESTS(addDICOMLocaleWithReferenceImageTests);
45 CPPUNIT_TEST_SUITE_END();
49 static void addDICOMLocaleWithReferenceImageTests(TestSuiteBuilderContextType &context)
51 std::vector<std::string> fileArgs;
52 fileArgs.push_back(
"spacing-ok-ct.dcm");
53 fileArgs.push_back(
"spacing-ok-mr.dcm");
54 fileArgs.push_back(
"spacing-ok-sc.dcm");
57 std::vector<std::string> localeArgs;
58 localeArgs.push_back(
"C");
59 localeArgs.push_back(
"de_DE");
60 localeArgs.push_back(
"de_DE.utf8");
61 localeArgs.push_back(
"de_DE.UTF8");
62 localeArgs.push_back(
"de_DE@euro");
63 localeArgs.push_back(
"German_Germany");
65 for (std::size_t fileIndex = 0; fileIndex < fileArgs.size(); ++fileIndex)
67 for (std::size_t localeIndex = 0; localeIndex < localeArgs.size(); ++localeIndex)
75 std::string m_FileName;
81 void SetTestParameter()
84 CPPUNIT_ASSERT(parameter.size() == 2);
86 m_Locale = parameter[1];
90 mitkDICOMLocaleTestSuite() : m_OldLocale(NULL), m_SkipImageTest(false) {}
94 m_SkipImageTest =
false;
100 m_OldLocale = setlocale(LC_ALL, NULL);
101 MITK_TEST_OUTPUT(<<
" ** Changing locale from " << m_OldLocale <<
" to '" << m_Locale <<
"'")
102 setlocale(LC_ALL, m_Locale.c_str());
103 std::cin.imbue(
std::locale(m_Locale.c_str()));
108 m_SkipImageTest = true;
112 void tearDown()
override
116 setlocale(LC_ALL, m_OldLocale);
117 std::cin.imbue(std::locale(m_OldLocale));
121 void testLocaleWithReferenceImage()
127 CPPUNIT_ASSERT(image.IsNotNull());
132 CPPUNIT_ASSERT_MESSAGE(
"incorrect x spacing",
mitk::Equal(image->GetGeometry()->GetSpacing()[0], 0.3141592));
133 CPPUNIT_ASSERT_MESSAGE(
"incorrect y spacing ",
mitk::Equal(image->GetGeometry()->GetSpacing()[1], 0.3411592));
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
static std::string GetTestDataFilePath(const std::string &testData)
Get the absolute path for test data.
#define MITK_PARAMETERIZED_TEST_2(TESTMETHOD, arg1, arg2)
Adds a parameterized test to the current test suite.
#define MITK_TEST_OUTPUT(x)
Output some text.
std::vector< std::string > GetTestParameter() const
Get parameters for this test fixture.
Test fixture for parameterized tests.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.