# HG changeset patch # User Sebastien Jodogne # Date 1780678311 -7200 # Node ID 093efd260e36fd64fcf0a99592609aac7c72180b # Parent 610bde3b8311f432c27ea035b9b53547e1fd5cc1 fix unit test against old versions DCMTK diff -r 610bde3b8311 -r 093efd260e36 OrthancFramework/Resources/CheckValueRepresentations.py --- a/OrthancFramework/Resources/CheckValueRepresentations.py Fri Jun 05 18:09:41 2026 +0200 +++ b/OrthancFramework/Resources/CheckValueRepresentations.py Fri Jun 05 18:51:51 2026 +0200 @@ -168,6 +168,30 @@ print(' - Value representation not handled:', vr) + print('\nChecking FromDcmtkBridge::ConvertLeafElement()') + + func = re.search(r'FromDcmtkBridge::ConvertLeafElement.*?default', content, re.DOTALL).group(0) + for vr in vrs: + if not ('case EVR_%s' % vr) in func: + print(' - Value representation not handled:', vr) + + + print('\nChecking FromDcmtkBridge::FillElementWithString()') + + func = re.search(r'FromDcmtkBridge::FillElementWithString.*?boost::bad_lexical_cast', content, re.DOTALL).group(0) + for vr in vrs: + if not ('case EVR_%s' % vr) in func: + print(' - Value representation not handled:', vr) + + + print('\nChecking FromDcmtkBridge::ApplyVisitorToLeaf()') + + func = re.search(r'ApplyVisitorToLeaf.*?boost::bad_lexical_cast', content, re.DOTALL).group(0) + for vr in vrs: + if not ('case EVR_%s' % vr) and not ('== EVR_%s' % vr) in func: + print(' - Value representation not handled:', vr) + + with open(os.path.join(BASE, 'OrthancFramework', 'Sources', 'DicomParsing', 'ToDcmtkBridge.cpp'), 'r') as f: content = f.read() diff -r 610bde3b8311 -r 093efd260e36 OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp --- a/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp Fri Jun 05 18:09:41 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp Fri Jun 05 18:51:51 2026 +0200 @@ -457,6 +457,7 @@ vr == ValueRepresentation_OtherFloat || vr == ValueRepresentation_OtherLong || vr == ValueRepresentation_OtherWord || + vr == ValueRepresentation_OtherVeryLong || vr == ValueRepresentation_Unknown); if (tag.GetElement() != 0x0000) diff -r 610bde3b8311 -r 093efd260e36 OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp --- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Fri Jun 05 18:09:41 2026 +0200 +++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp Fri Jun 05 18:51:51 2026 +0200 @@ -823,6 +823,8 @@ case EVR_UT: // unlimited text case EVR_PN: // person name case EVR_UI: // unique identifier + case EVR_UR: // URI / URL + case EVR_UC: // Unlimited Characters case EVR_UNKNOWN: // used internally for elements with unknown VR (encoded with 4-byte length field in explicit VR) case EVR_UNKNOWN2B: // used internally for elements with unknown VR with 2-byte length field in explicit VR { @@ -3084,6 +3086,8 @@ case EVR_UT: // unlimited text case EVR_PN: // person name case EVR_UI: // unique identifier + case EVR_UR: // URI / URL + case EVR_UC: // Unlimited Characters { Uint8* data = NULL; diff -r 610bde3b8311 -r 093efd260e36 OrthancServer/UnitTestsSources/UnitTestsMain.cpp --- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Fri Jun 05 18:09:41 2026 +0200 +++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Fri Jun 05 18:51:51 2026 +0200 @@ -164,10 +164,39 @@ } else { - ASSERT_EQ(vr, FromDcmtkBridge::Convert(ToDcmtkBridge::Convert(vr))); + bool skip = false; + +#if DCMTK_VERSION_NUMBER < 361 + if (i == ValueRepresentation_OtherDouble || + i == ValueRepresentation_UnlimitedCharacters || + i == ValueRepresentation_UniversalResource) + { + skip = true; + } +#endif - OrthancPluginValueRepresentation plugins = Plugins::Convert(vr); - ASSERT_EQ(vr, Plugins::Convert(plugins)); +#if DCMTK_VERSION_NUMBER < 362 + if (i == ValueRepresentation_OtherLong) + { + skip = true; + } +#endif + +#if DCMTK_VERSION_NUMBER < 365 + if (i == ValueRepresentation_OtherVeryLong || + i == ValueRepresentation_SignedVeryLong || + i == ValueRepresentation_UnsignedVeryLong) + { + skip = true; + } +#endif + + if (!skip) + { + ASSERT_EQ(vr, FromDcmtkBridge::Convert(ToDcmtkBridge::Convert(vr))); + OrthancPluginValueRepresentation plugins = Plugins::Convert(vr); + ASSERT_EQ(vr, Plugins::Convert(plugins)); + } } }