Repository navigation
Conversation
When Photoshop did not report the new document's width/height, create_document silently fell back to the size the caller requested and still returned success: True. A client could not tell a confirmed measurement apart from the size it merely asked for. Use the try_float/UNCONVERTIBLE helper that document/info and open_document already use. An unreadable dimension now sets dimensions_unavailable: true while width/height stay numeric, falling back to the requested size rather than 0.0 - a better stand-in for a document just created at that size. The except-branch fallback carries the same signal for the same reason. Adds coverage for the readable, unreadable, UnitValue, genuine-zero and property-read-failure branches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
create_documentsilently fell back to the size the caller requested when Photoshop did not report the new document's width/height, while still returningsuccess: True. A client could not tell a confirmed measurement apart from the size it merely asked for — the same trap thatphotoshop://document/infoandphotoshop_open_documentwere fixed for in #92, at the third entry point.This uses the
try_float/UNCONVERTIBLEhelper those two call sites already use:dimensions_unavailable: truewhilewidth/heightstay numeric. The fallback is the requested size rather than0.0, which is a better stand-in for a document just created at that size.exceptbranch, which also falls back to the requested size after a failed property read, carries the same signal for the same reason.Purely additive: the new field only appears when dimensions cannot be read, so consumers that ignore unknown keys are unaffected. A genuine zero is still reported as
0.0and is not flagged.Tests cover the readable, unreadable,
UnitValue, genuine-zero and property-read-failure branches; the unreadable cases fail against the previous implementation.