[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Testing font things
From: |
Eli Zaretskii |
Subject: |
Re: Testing font things |
Date: |
Wed, 30 Nov 2022 15:36:35 +0200 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Tue, 29 Nov 2022 22:31:26 -0500
>
> >> I'm trying to write a test for our font choice code (bug#59347)
> > Is it useful?
>
> We've had a fair bit of regressions in our font-selection code over the
> years, and some of those have happened several times, so I think it
> would be useful, yes.
I was asking whether the particular approach you've chosen to implement such
tests was useful. Not whether having tests about font selection in general
would be useful (which has a trivial answer).
> > This test will work only on your platform and maybe on a few
> > other lucky ones.
>
> Sounds like a good reason to add more tests to cover other cases.
Not if all of them will have the same disadvantage.
> [ FWIW, Dejavu Sans is very widespread under GNU/Linux, AFAIK, and
> misc-fixed used to be very widespread as well, so there's a chance
> I'm not the only one where this test can run. ]
A useful test should be runnable by more than just a handful. From where I
stand, any test that I cannot run on my system is useless as a test.
> > I suggest to defer coding of the test until we fully understand the
> > problem, and then try to write the test in some generic way
> > independent of specific font families.
>
> Writing tests for the font code is not super easy, so I'd rather we get
> started earlier than wait for some hypothetical future. It's much
> easier to improve/extend existing tests than trying to figure out how
> the hell can we test GUI code in batch mode.
My point is that without understanding that problem fully, we don't know
what should be the expected results of a correctly-working Emacs.
> > ...why do you need to go to these obscure entities, when you have the font's
> > name as a string to begin with? So you should be able to:
> >
> > . use face-font, which returns the font's name as a string
>
> I'm not sure `face-font` will faithfully reproduce the result I'll see
> on my screen.
>
> > . compare that string with what you wanted it to be
>
> I'd rather not hard code any specific font name, actually, which is why
> my code was written to just check that we get one of the available fonts
> from the "DejaVu Sans" family.
>
> > . and/or use find-font to check whether the font is in fact installed on
> > the system
>
> How does that compare to `list-fonts`?
It avoids the problems you said got in your way.
Anyway, you asked for help in overcoming practical difficulties, and I tried
to do my best to help. If my suggestions aren't useful, feel free to ignore
them (but know that I did base them on running and well-tested code which
needed to overcome similar obstacles while I was writing it).