Mercurial > hg > orthanc
changeset 6937:093efd260e36 default tip
fix unit test against old versions DCMTK
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Fri, 05 Jun 2026 18:51:51 +0200 |
| parents | 610bde3b8311 |
| children | |
| files | OrthancFramework/Resources/CheckValueRepresentations.py OrthancFramework/Sources/DicomParsing/DicomWebJsonVisitor.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancServer/UnitTestsSources/UnitTestsMain.cpp |
| diffstat | 4 files changed, 61 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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)
--- 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;
--- 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)); + } } }
