You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad261a8
Browse filesBrowse the repository at this point in the historyBrowse files
Read PDF, Office and SVG documents in the standalone viewer and the tray
DiffEngineViewer now compares PDF, docx, xlsx and pptx files, and draws
SVGs beside their text. Each document shows as text, as its page drawn,
or both (the default), cycled with r. [ and ] turn pages, and an entry
opens at its first page that differs.
- Text: an SVG's source, a PDF's text page by page (PDFium through
Morph.PDFium), Office documents as Markdown (Morph).
- Pages: rendered to png, so they reach every head as an ordinary
ImagePane. No head or ABI field knows what a document is; r, [ and ]
are additive DeviewKey values with no DEVIEW_VERSION bump.
- The renderers live in DiffEngineViewer.Documents, loaded into an
isolated AssemblyLoadContext in the viewer process. Reading and
drawing run on DocumentWatch's thread, from a copy of each file
checked against its hash, so the listener thread only hashes.
- Shipped in a documents/ folder of the three tool packages and of the
tray (one shared viewer/documents/), never in DiffEngine's bundled
viewer, which stays the size it was. Payloads carry only their own
RIDs' natives and no pdbs.
- DiffEngine offers the viewer for .pdf/.docx/.xlsx/.pptx only when the
copy it resolved has the documents folder.
- Packaging.Tests: no documents in DiffEngine's bundle, and every
documents folder complete for the RIDs it ships.
The committed Linux and macOS natives need the build-native workflow to
pick up the new keys; the footer buttons reach the same commands until
then.
Copy file name to clipboardExpand all lines: docs/mdsource/tray.source.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,8 @@ A delete is withdrawn when a later test run verifies against its file again, sin
52
52
53
53
When the tray holds it, the window becomes disposable. A viewer that is closed, killed or crashes takes nothing pending with it, and the tray opens a new one on the same queue. A snapshot arriving with no window open starts one.
54
54
55
+
The viewer installed with the tray also reads [documents](/docs/viewer.md#documents): PDF, Word, Excel and PowerPoint files as text, as their pages drawn, or both, and SVGs drawn beside their text. The copy bundled in the DiffEngine package does not. On a machine with the tray installed, test runs resolve the tray's copy ahead of the bundled one, so pending documents open in a viewer that can read them.
56
+
55
57
"Pending Snapshots" accepts all of them. Clicking one accepts that one, and its drop down offers discard, opening the viewer on it, and opening the source file. A snapshot that failed to apply is marked with `!` and stays pending, so it can be retried once whatever blocked it is out of the way.
56
58
57
59
Exiting the tray writes any still-pending inline snapshots back to disk, under the source project's `obj/VerifyInline/`, where accept tooling such as [Verify.Terminal](https://github.com/VerifyTests/Verify.Terminal) still finds them. A kill or a crash skips that, and loses the queue as it loses pending moves and deletes; re-run the tests.
Only needed to use the viewer outside a project that references DiffEngine, since DiffEngine already bundles it.
24
+
Only needed to use the viewer outside a project that references DiffEngine, since DiffEngine already bundles it, or to read [documents](#documents), which only these packages and the copy installed with [DiffEngineTray](/docs/tray.md) do.
25
25
26
26
```
27
27
dotnet tool install -g DiffEngineViewer.Windows
@@ -72,6 +72,8 @@ Nothing is staged for inline review. A newly launched viewer gets the patch in a
72
72
|`Up``Down``PgUp``PgDn``Home``End`| Scroll |
73
73
|`n``p`| Next and previous change (also the **Next change** and **Prev change** buttons) |
74
74
|`m`| Show only the changes, or every line (also the **Changes only** button) |
75
+
|`r`| Cycle a [document](#documents) between text and picture, picture only, and text only (also the button naming the next view) |
76
+
|`[``]`| Previous and next page of a document (also **Prev page** and **Next page**) |
75
77
|`Tab``Shift+Tab`| Next and previous pending item |
76
78
|`a`| Accept |
77
79
|`Shift+A`| Accept all |
@@ -183,6 +185,37 @@ A format a head cannot decode draws nothing, and the comparison is still there i
183
185
Accepting is the same act it is for text — copy the received file over the expected one, or forward the move to the tray — so nothing about reviewing an image changes what accepting one does.
184
186
185
187
188
+
## Documents
189
+
190
+
The standalone tool and the copy installed with [DiffEngineTray](/docs/tray.md) carry a `documents` folder, and with it read `.pdf`, `.docx`, `.xlsx` and `.pptx` files, and draw `.svg` files. The copy bundled in the DiffEngine package does not, to stay small: the folder is about 16 MB of libraries and 22 MB of natives per platform. That copy reads these files exactly as it always has, an SVG as text.
191
+
192
+
A document is shown one of three ways, and `r`, or the button naming the next one, cycles between them:
193
+
194
+
| View | Shows |
195
+
| --- | --- |
196
+
| Text and picture | The text in the top half of each pane, and the page being read drawn under it. The default. |
197
+
| Picture only | The page, under two rows saying what each file is. |
198
+
| Text only | The text, as any text file is shown. |
199
+
200
+
What the text is depends on the format:
201
+
202
+
* SVG: the file itself.
203
+
* PDF: each page's text under a `--- page N ---` line, read with [PDFium](https://pdfium.googlesource.com/pdfium) through [Morph.PDFium](https://github.com/Papyrine/Morph.PDFium).
204
+
* Word, Excel and PowerPoint: the document as Markdown, from [Morph](https://github.com/Papyrine/Morph). Embedded pictures become `image-N` references rather than lines of base64.
205
+
206
+
Pages are drawn by PDFium for a PDF, by Morph for an Office file and by [Svg.Skia](https://github.com/wieslawsoltes/Svg.Skia) for an SVG. A spreadsheet's pages are its printed pages rather than its sheets. Drawing is deterministic, so the same page always draws to the same bytes, which is how the viewer knows which pages differ. A small SVG is drawn at a reviewable size rather than its own, since a picture is never enlarged on screen.
207
+
208
+
A document opens at its first page that differs, the way a text comparison opens at its first change. `[` and `]`, or **Prev page** and **Next page**, turn the page on both sides at once. With only the pictures on screen, **Prev change** and **Next change** move between the pages that differ.
209
+
210
+
The status line says what is known about the pair as it becomes known: `reading text` and `drawing` while that happens, which page is showing and which differ, `every page draws the same` when the files differ only where nothing shows, and `documents are identical` when the bytes match. Each pane's header names the page it shows, `received.pdf (page 2 of 5)`, or `(no page 6)` when that side has fewer.
211
+
212
+
Reading and drawing happen on a thread of their own once the window is up, so a long document never holds a test run waiting on the viewer. Each document is read from a copy the viewer takes, never the file itself, so it cannot hold a lock that stops it being accepted. They run inside the viewer's process: a document that hangs is given up on after two minutes, but one that crashes PDFium or Skia takes the window with it, and with no tray running, any inline snapshots the window was holding.
213
+
214
+
An SVG is drawn with scripts, external images and external elements turned off. A snapshot is test output, and nothing in one gets to reach the network or the disk.
215
+
216
+
DiffEngine offers the viewer for `.pdf`, `.docx`, `.xlsx` and `.pptx` only when the copy it resolved carries the folder. The viewer is last in the default tool order, so Word, Excel, Beyond Compare or DeltaWalker are still preferred where installed.
217
+
218
+
186
219
## With DiffEngineTray
187
220
188
221
The tray starts at login, so it normally binds the port first and holds the queue. The viewer then displays it: it reads the pending snapshots back over the socket and forwards accept and discard rather than applying them. That is what `--attach` is for, and the tray starts one whenever a snapshot arrives with no window open.
Copy file name to clipboardExpand all lines: docs/tray.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,8 @@ A delete is withdrawn when a later test run verifies against its file again, sin
59
59
60
60
When the tray holds it, the window becomes disposable. A viewer that is closed, killed or crashes takes nothing pending with it, and the tray opens a new one on the same queue. A snapshot arriving with no window open starts one.
61
61
62
+
The viewer installed with the tray also reads [documents](/docs/viewer.md#documents): PDF, Word, Excel and PowerPoint files as text, as their pages drawn, or both, and SVGs drawn beside their text. The copy bundled in the DiffEngine package does not. On a machine with the tray installed, test runs resolve the tray's copy ahead of the bundled one, so pending documents open in a viewer that can read them.
63
+
62
64
"Pending Snapshots" accepts all of them. Clicking one accepts that one, and its drop down offers discard, opening the viewer on it, and opening the source file. A snapshot that failed to apply is marked with `!` and stays pending, so it can be retried once whatever blocked it is out of the way.
63
65
64
66
Exiting the tray writes any still-pending inline snapshots back to disk, under the source project's `obj/VerifyInline/`, where accept tooling such as [Verify.Terminal](https://github.com/VerifyTests/Verify.Terminal) still finds them. A kill or a crash skips that, and loses the queue as it loses pending moves and deletes; re-run the tests.
0 commit comments