# HG changeset patch # User Sebastien Jodogne # Date 1780675128 -7200 # Node ID a5ded5f913ed4cbb4f8e690a714f96aa83f187dd # Parent 715d89b308093ec7001364706af1c303762394b8 fix unit test FromDcmtkBridge.ValueRepresentationConversions diff -r 715d89b30809 -r a5ded5f913ed OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- 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: diff -r 715d89b30809 -r a5ded5f913ed OrthancFramework/Sources/DicomParsing/ToDcmtkBridge.cpp --- 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: diff -r 715d89b30809 -r a5ded5f913ed OrthancFramework/Sources/Enumerations.h --- 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 diff -r 715d89b30809 -r a5ded5f913ed OrthancServer/UnitTestsSources/UnitTestsMain.cpp --- 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(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(i); ValueRepresentation orthanc = Plugins::Convert(plugins);