Behaviour SwRS-MDOKFSTUDIO-PALETTE-192
The host image picker answers a path relative to the document
When previewPickImage reaches the host for a saved document, whatever the trust, the extension SHALL open a native dialog in the folder of the document filtered to png, jpg, jpeg, gif, webp and svg with the label Insert image, answer the picked file as a path relative to the document with forward slashes and blanks kept, or cancelled, or refuse a file that is outside the allowed folders (the workspace folders, or the folder of a standalone document), is not a local image or cannot be written in a reference with a reason the page shows, and read or write nothing.
Step 2 of path 1 in StRS-MDOKFSTUDIO-PALETTE-007: from “The image dialog is open” to “A path relative to the document comes back”.
Scenarios 4
The situations the tests check; open one to read it.
nominalPicked image
refusalCancelled
refusalRefused picks
| Input | Outcome |
|---|---|
| a file outside every workspace folder | the reason reads The image must be inside a workspace folder. |
| a file outside the folder of the document, for a standalone document that lies in no workspace folder | the reason reads The image must be inside the folder of the document. |
| a text file, or a file that is not local | the reason reads Pick a png, jpeg, gif, webp or svg image. |
| a file on another drive, with no relative path, or with a name that holds an angle bracket or a line break | the reason reads That image cannot be referenced from this document (another drive, or an unusual name). |
| a document that is out of date or is not a file | ok false with the reason The preview is out of date, or the document is not a file. |
| a failed dialog | ok false with the message of the error (a value that is not an Error as its string) |
boundaryShape of the request
| Input | Outcome |
|---|---|
| a previewPickImage message with a non-empty editId of at most 100 characters | handled; previewPickImageResult repeats the editId (see SwRS-MDOKFSTUDIO-TRUST-090) |
| a message without a valid editId | ignored by the envelope check (see SwRS-MDOKFSTUDIO-TRUST-052) |
| an SVG file | accepted for a reference (unlike a pasted image) |
| a path with Windows separators | accepted and written with forward slashes |