Mercurial > hg > orthanc
changeset 6934:a5ded5f913ed
fix unit test FromDcmtkBridge.ValueRepresentationConversions
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Fri, 05 Jun 2026 17:58:48 +0200 |
| parents | 715d89b30809 |
| children | 987befd8303d |
| files | OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.cpp OrthancFramework/Sources/Enumerations.h OrthancServer/UnitTestsSources/UnitTestsMain.cpp |
| diffstat | 4 files changed, 12 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Fri Jun 05 17:46:10 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Fri Jun 05 17:58:48 2026 +0200 @@ -2031,10 +2031,11 @@ return ValueRepresentation_OtherFloat; case EVR_OL: -#if DCMTK_VERSION_NUMBER >= 361 +#if DCMTK_VERSION_NUMBER >= 362 return ValueRepresentation_OtherLong; #else - throw OrthancException(ErrorCode_NotSupported, "OL value representation is not supported, as using DCMTK <= 3.6.0"); + // Even though EVR_OL was introduced in DCMTK 3.6.1, its implementation was broken + throw OrthancException(ErrorCode_NotSupported, "OL value representation is not supported, as using DCMTK <= 3.6.1"); #endif case EVR_OW:
--- a/OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.cpp Fri Jun 05 17:46:10 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.cpp Fri Jun 05 17:58:48 2026 +0200 @@ -86,10 +86,11 @@ return EVR_OF; case ValueRepresentation_OtherLong: -#if DCMTK_VERSION_NUMBER >= 361 +#if DCMTK_VERSION_NUMBER >= 362 return EVR_OL; #else - throw OrthancException(ErrorCode_NotSupported, "OL value representation is not supported, as using DCMTK <= 3.6.0"); + // Even though EVR_OL was introduced in DCMTK 3.6.1, its implementation was broken + throw OrthancException(ErrorCode_NotSupported, "OL value representation is not supported, as using DCMTK <= 3.6.1"); #endif case ValueRepresentation_OtherWord:
--- a/OrthancFramework/Sources/Enumerations.h Fri Jun 05 17:46:10 2026 +0200 +++ b/OrthancFramework/Sources/Enumerations.h Fri Jun 05 17:58:48 2026 +0200 @@ -616,7 +616,8 @@ ValueRepresentation_OtherVeryLong = 32, // OV (8 bytes, new in Orthanc 1.12.12) ValueRepresentation_SignedVeryLong = 33, // SV (int64_t, new in Orthanc 1.12.12) ValueRepresentation_UnsignedVeryLong = 34, // UV (uint64_t, new in Orthanc 1.12.12) - ValueRepresentation_NotSupported // Not supported by Orthanc, or tag not in dictionary + + ValueRepresentation_NotSupported // Not supported by Orthanc, or tag not in dictionary (must be the last one) }; enum DicomReplaceMode
--- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Fri Jun 05 17:46:10 2026 +0200 +++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Fri Jun 05 17:58:48 2026 +0200 @@ -151,8 +151,9 @@ ASSERT_EQ(1, ValueRepresentation_ApplicationEntity); ASSERT_EQ(1, OrthancPluginValueRepresentation_AE); - for (int i = ValueRepresentation_ApplicationEntity; - i <= ValueRepresentation_NotSupported; i++) + ASSERT_EQ(35, ValueRepresentation_NotSupported); // New enum values were added, update this test + + for (int i = ValueRepresentation_ApplicationEntity; i <= ValueRepresentation_NotSupported; i++) { ValueRepresentation vr = static_cast<ValueRepresentation>(i); @@ -161,15 +162,6 @@ ASSERT_THROW(ToDcmtkBridge::Convert(vr), OrthancException); ASSERT_THROW(Plugins::Convert(vr), OrthancException); } - else if (vr == ValueRepresentation_OtherDouble || - vr == ValueRepresentation_OtherLong || - vr == ValueRepresentation_UniversalResource || - vr == ValueRepresentation_UnlimitedCharacters) - { - // These VR are not supported as of DCMTK 3.6.0 - ASSERT_THROW(ToDcmtkBridge::Convert(vr), OrthancException); - ASSERT_EQ(OrthancPluginValueRepresentation_UN, Plugins::Convert(vr)); - } else { ASSERT_EQ(vr, FromDcmtkBridge::Convert(ToDcmtkBridge::Convert(vr))); @@ -179,8 +171,7 @@ } } - for (int i = OrthancPluginValueRepresentation_AE; - i <= OrthancPluginValueRepresentation_UT; i++) + for (int i = OrthancPluginValueRepresentation_AE; i <= OrthancPluginValueRepresentation_UV; i++) { OrthancPluginValueRepresentation plugins = static_cast<OrthancPluginValueRepresentation>(i); ValueRepresentation orthanc = Plugins::Convert(plugins);
