From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Testing font things Date: Wed, 30 Nov 2022 15:36:35 +0200 Message-ID: <83cz94lg2k.fsf@gnu.org> References: <83tu2s2y70.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18978"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 30 14:38:02 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p0NHl-0004fV-IX for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Nov 2022 14:38:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0NH6-0000y4-2z; Wed, 30 Nov 2022 08:37:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0NGu-0000xC-FF for emacs-devel@gnu.org; Wed, 30 Nov 2022 08:37:16 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0NGt-0008WI-Id; Wed, 30 Nov 2022 08:37:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=w5OdHKxeMrHTleJcKpXS/Uf4Yg33sL0x3hPfyJRC8bc=; b=bHqHUhDralqX NtCTB6n77ij3jZt3m3sUEN0FkwBTWI3ySCIDPnmNUBxVAvx3w+KZ9G+63QiH07rXbBjKK0Cl+cVUT hNrjMqX8CaKUTA7m2VhF3OlzPsP81+wJ5LMZm1rKjYaLFCYW6c/3m6rsimwSuulsW/Ww3DSjczDDx ilJidiTqpiQG/W5ZVCISBU7XuXcHhzbk4zH/d+kZDswZHnX+nJH7CocA1EU5v4T/GOvbd4hfS6tFp XGLYQ1FipLikclIWgkHTIn60drKIL9Oa3UXkX33NVBri6MF/b6Gz7JAwgdqlQxLFMgeVBZHH9eKhS 19p+olrSaPZdHL3KbnCRHg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0NGr-0000F1-G7; Wed, 30 Nov 2022 08:37:06 -0500 In-Reply-To: (message from Stefan Monnier on Tue, 29 Nov 2022 22:31:26 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300761 Archived-At: > From: Stefan Monnier > 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).