How to deal with dpi-dependent values in unit tests?

Regina Henschel rb.henschel at t-online.de
Sat Oct 16 13:57:39 UTC 2021


Hi Tomaž,

Tomaž Vajngerl schrieb am 16.10.2021 um 15:35:
> Hi Regina,
> 
> On Fri, Oct 15, 2021 at 1:29 PM Regina Henschel <rb.henschel at t-online.de 
> <mailto:rb.henschel at t-online.de>> wrote:
> 
>     Hi all,
> 
>     the values of the bound rectangle of a Fontwork shape are dpi dependent
>     (I don't know why). I could increase the tolerance to cover more dpi
>     settings as done in https://gerrit.libreoffice.org/c/core/+/123613
>     or I add
>           if (!IsDefaultDPI()) return;
>     as done in https://gerrit.libreoffice.org/c/core/+/123512
> 
>     What is the preferred way to handle it?
> 
> 
> If you can get away with IsDefaultDPI, then use that (you can't always). 
> Technically we shouldn't be dependent on DPI when we deal with logical 
> units, so until we find where the bug is that makes that DPI dependent, 
> only the default DPI (96) should return the correct results (I think).

I have used IsDefaultDPI for now and will use it in my next patch too. I 
think now, it makes it easier to find the affected unit tests, if 
someone fixes the reason why a BoundRect of a Fontwork shape depends on DPI.

To get away with IsDefaultDPI in these cases, I would need a different 
way to detect errors in rendering of Fontwork shapes. I have no idea for 
that.

Kind regards,
Regina


More information about the LibreOffice mailing list