unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Testing font things
Date: Wed, 30 Nov 2022 15:36:35 +0200	[thread overview]
Message-ID: <83cz94lg2k.fsf@gnu.org> (raw)
In-Reply-To: <jwvtu2h9lec.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Tue, 29 Nov 2022 22:31:26 -0500)

> 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).



  parent reply	other threads:[~2022-11-30 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 13:42 Testing font things Stefan Monnier
2022-11-21 14:12 ` Eli Zaretskii
2022-11-30  3:31   ` Stefan Monnier
2022-11-30  5:06     ` Stefan Kangas
2022-11-30 13:36     ` Eli Zaretskii [this message]
2022-11-22  0:24 ` Po Lu
2022-11-30  3:48   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83cz94lg2k.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).