-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue1069 check for model/gltf.binary content type and accept #1075
Conversation
Fixes #1069 |
@tomjebo would be nice to have test for this case in the repo ;) I build SDK from this branch and confirm that it works on my files. |
Don't forget to update the changelog |
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
Can you add a test for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the current override will do what you're expecting. It would be great to have a test for this.
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
src/DocumentFormat.OpenXml/Packaging/Model3DReferenceRelationshipPart.cs
Outdated
Show resolved
Hide resolved
test/DocumentFormat.OpenXml.Packaging.Tests/OpenXmlPackageTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple comments, but do with them as you want. Once you've addressed the warnings, feel free to merge!
Assert.NotNull(presDoc); | ||
} | ||
|
||
using (var testFile = GetStream(TestFiles._3DTestDot, false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be separate tests? Also, it would nice to assert on the content type of the package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@twsouthwick not sure what you mean by "content type of the package". Do you mean assert on the model/gltf-binary content type (the part) or do you mean something else? The test is pretty much about validating the model/gltf(-|.)binary content type so I don't know why it should explicitly assert this. Maybe you mean assert that the glb part is not something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because then when you look at the test, you know that is what you're testing here. In a year, or 5 years, you may not remember exactly what the test is supposed to be doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what i meant was, there is no content type of the package. do you mean assert on the content type of the .glb part? If so, I can probably add code to find the part and check that it's either model/gltf-binary or model/gltf.binary. But we say that in the comments and the code will assert that naturally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I can see what you mean. It's not clear what the test is actually looking for other than a clean open with a non-null package object. I'll add some code to look for the part and see if it's one of the two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it will have to be model/gltf-binary. The part class (Model3DReferenceRelationshipPart) will always show as model/gltf-binary internally and will write this (when a new one is created). But will just look the other way when loading model/glft.binary. I added the assert for it.
This fix checks to see if the part content type is "model/gltf.binary" and the expected part is "model/gltf-binary". If so, then the SDK accepts the part as is. Both will be consumed but the SDK will continue to write out "model/gltf-binary" as this is the current standard and is accepted by PowerPoint.