Bug 155547 - Provide a more direct way to write tests for low level text layout issues
Summary: Provide a more direct way to write tests for low level text layout issues
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2023-05-29 14:28 UTC by ⁨خالد حسني⁩
Modified: 2023-06-04 20:53 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ⁨خالد حسني⁩ 2023-05-29 14:28:16 UTC
Currently we test such issues indirectly by exporting to PDF and then checking the PDF file, but this is slow, indirect, not very reliable, and can’t test everything.

One idea is to write an VCL graphics backend that just dumps the drawing commands to some sort of plain text format that can be compared against known good results.
Comment 1 Noel Grandin 2023-05-30 09:46:23 UTC
I'm sure you will know best, but I would just 

(a) decide what piece of info I need

(b) plumb some methods down through the layers that dump the info into something convenient, either an in-memory XML file (e.g. see the dumpAsXml helpers we use elsewhere for unit test) and whatever else takes your fancy.

(c) use xpath to check the XML (like we do elsewhere)

(d) keep adding info to the XML for more unit tests
Comment 2 ⁨خالد حسني⁩ 2023-05-31 11:26:34 UTC
So, lets say I want to dump all the glyphs being drawn with their positions, so I’d have a SalLayout::dumpAsXml()? Not sure how can I wire this one all the way from the output device, but I can give it a try. I probably will need to set some kind of a flag on the output device before creating it so that it dumps every SalLayout it draws, since these are not kept around.
Comment 3 ⁨خالد حسني⁩ 2023-05-31 23:47:59 UTC
Looking at sw layout tests, looks like GDIMetaFile is the thing I want (I probably saw it before then forgot about it), now I need to see if it has all the information I need.
Comment 4 ⁨خالد حسني⁩ 2023-06-04 20:53:09 UTC
I tried using GDIMetaFile, but it is still higher level than what I need. Back to the drawing board.