From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70093: *** SPAM *** bug#70093: Remove unnecessary `image-tests--map-equal' Date: Sun, 31 Mar 2024 12:08:27 +0200 Message-ID: References: <877chjcxfg.fsf@breatheoutbreathe.in> <1d1367e3-d888-4a00-8204-1bb6c3607801@orange.fr> <87frw6c0dv.fsf@breatheoutbreathe.in> Reply-To: David Ponce Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29733"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 70093@debbugs.gnu.org, Eli Zaretskii To: Joseph Turner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 31 12:09:38 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rqs89-0007aJ-PH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Mar 2024 12:09:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rqs7Z-00067j-8b; Sun, 31 Mar 2024 06:09:01 -0400 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 1rqs7Y-00067H-2L for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2024 06:09:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqs7X-0001Sn-QD for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2024 06:08:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rqs7Z-0001zh-U1 for bug-gnu-emacs@gnu.org; Sun, 31 Mar 2024 06:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Mar 2024 10:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70093 X-GNU-PR-Package: emacs Original-Received: via spool by 70093-submit@debbugs.gnu.org id=B70093.17118797167595 (code B ref 70093); Sun, 31 Mar 2024 10:09:01 +0000 Original-Received: (at 70093) by debbugs.gnu.org; 31 Mar 2024 10:08:36 +0000 Original-Received: from localhost ([127.0.0.1]:46664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqs79-0001yQ-UL for submit@debbugs.gnu.org; Sun, 31 Mar 2024 06:08:36 -0400 Original-Received: from smtp-73.smtpout.orange.fr ([80.12.242.73]:65454 helo=msa.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rqs77-0001yG-0Z for 70093@debbugs.gnu.org; Sun, 31 Mar 2024 06:08:35 -0400 Original-Received: from [192.168.1.15] ([2.7.71.181]) by smtp.orange.fr with ESMTPA id qs71r56PMp1yHqs72rAAP4; Sun, 31 Mar 2024 12:08:29 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1711879709; bh=efWXWhybYc8tP+pxAlQZrxfAq3jzHo84wVDxFkJTFIc=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=HZc1VmN209JoC67RFLcmHIpiv6mJ0OFE7SXmd3tkN6W2hhaGVqN1Kxl5Xi1rmPQaO EnnWImBaCURelacqLQZADYms4qDmI0UVev9K7We98h3YTl2qyJ4QDCclND8BidvGJq nOn/1DIOBBgxirOjQE6XM0aHW6x4JauWiAULHK+gXClJdykL/fHicc0rbaPHahggc8 khBNx8dTlyrqL8yvMPc4c/ZvjU12Mx5TOCiiPa6nCZrSDWQLagxvquAlSwiEOECPUN 6LcDs4QkTJuGR2QUJ2HyeMbHD8e6Rh3Hz7776uWkH//wiHpsIKoxYrY4seivTzO4/p XEuWUw5pc5nig== X-ME-Helo: [192.168.1.15] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sun, 31 Mar 2024 12:08:29 +0200 X-ME-IP: 2.7.71.181 Content-Language: fr, en-US In-Reply-To: <87frw6c0dv.fsf@breatheoutbreathe.in> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282430 Archived-At: On 31/03/2024 09:37, Joseph Turner wrote: > > David Ponce writes: > >> On 30/03/2024 20:44, Joseph Turner wrote: >>> With the resolution of bug#69992, it may be possible to remove the >>> `image-tests--map-equal' equality predicate from lisp/image-tests.el. >>> Eli and David, would you please apply the attached patch and then >>> run >>> the tests to see if we still need to allow for tolerances in >>> `image--compute-map-and-original-map'? >>> The tests pass for me, but then again, they never failed on my >>> machine... >>> Thank you!! I'm grateful for this fun collaboration. :) >>> Joseph >>> >> >> Hi Joseph, >> >> Did you forget to attach the patch? I cannot find it. > > Apologies. Here it is. (This is the same patch as in my response to Eli) > >> Anyway, I don't think the resolution of bug#69992 changed anything >> regarding the test `image--compute-map-and-original-map'. And to >> be honest I don't understand why it gives a different result on our >> configurations. > > I thought perhaps calculating scale with > > (/ (float (car size)) > (car (image-size > (image--image-without-parameters image) t))) > > instead of > > (or (image-property image :scale) 1) > > would fix the variations on our machines. > >> To test, I also eval the following simple code in *scratch* buffer, >> which gives me consistent results on my laptop: >> >> (let* ((svg (svg-create 200 100)) >> (omap `(((rect . ((0 . 0) . (50 . 50))) >> rect-test (help-echo "rect-test")) >> ((circle . ((85 . 55) . 25)) >> circle-test (help-echo "circle-test")) >> ((poly . [100 0 125 0 170 50 125 50]) >> poly-test (help-echo "poly-test"))))) >> (svg-rectangle svg 0 0 50 50 >> :stroke-width 0 :fill "red") >> (svg-circle svg 85 55 25 >> :stroke-width 0 :fill "green") >> (svg-polyline svg '((100 . 0) (125 . 0) (170 . 50) (125 . 50)) >> :stroke-width 0 :fill "blue") >> (let ((image (svg-image svg >> :original-map omap >> :scale nil ;; vary scale test >> :rotation nil ;; vary rotation test >> :flip nil ;; vary flip test >> ))) >> ;; Must see the pointer and help-echo change when mouse hovers the >> ;; rect, circle and poly hot spots. >> (insert-image image) >> (insert ?\n) >> ;; Must see the same original map. >> (image--compute-original-map image))) > > This manual test also works on my machine. I had been doing something > similar; I like your use of svg-create :) > > Let me know if the unit tests pass with this patch applied. > > Thank you! > > Joseph > Hello, With the patch applied the test fails the same for me: _______________________________________________________________ Selector: image--compute-map-and-original-map Passed: 0 Failed: 1 (1 unexpected) Skipped: 0 Total: 1/1 Started at: 2024-03-31 11:17:56+0200 Finished. Finished at: 2024-03-31 11:17:56+0200 F F image--compute-map-and-original-map Test ‘image--compute-map’ and ‘image--compute-original-map’. (ert-test-failed ((should (equal (image--compute-map image) rotated-map)) :form (equal (((circle ... . 24) "a" (help-echo "A")) ((rect ... 127 . 77) "b" (help-echo "B")) ((poly . [199 161 206 160 213 154 218 146 221 136 ...]) "c" (help-echo "C"))) (((circle ... . 24) "a" (help-echo "A")) ((rect ... 54 . 77) "b" (help-echo "B")) ((poly . [126 161 133 160 140 154 145 146 148 136 ...]) "c" (help-echo "C")))) :value nil :explanation (list-elt 0 (list-elt 0 (cdr (car ...)))))) _______________________________________________________________ More in detail, these 3 tests pass: 1. (should (equal (image-property image :original-map) original-map)) 2. (setf (image-property image :flip) nil) (setf (image-property image :rotation) 0) (setf (image-property image :scale) 2) (should (equal (image--compute-map image) scaled-map)) 3. (setf (image-property image :scale) 2) (setf (image-property image :rotation) 90) (should (equal (image--compute-map image) scaled-rotated-flipped-map)) But these 2 tests fails: 1. (setf (image-property image :scale) 1) (setf (image-property image :rotation) 90) (should (equal (image--compute-map image) rotated-map)) ;; Return ((((circle (199 . 41) . 24) "a" (help-echo "A")) ((rect (79 . 5) 127 . 77) "b" (help-echo "B")) ((poly . [199 161 206 160 213 154 218 146 221 136 223 125 221 114 218 104 213 96 206 91 199 89 191 91 185 96 179 104 176 114 175 125 176 136 179 146 185 154 191 160]) "c" (help-echo "C"))) ;; Instead of (((circle (126 . 41) . 24) "a" (help-echo "A")) ((rect (6 . 5) 54 . 77) "b" (help-echo "B")) ((poly . [126 161 133 160 140 154 145 146 148 136 150 125 148 114 145 104 140 96 133 91 126 89 118 91 112 96 106 104 103 114 102 125 103 136 106 146 112 154 118 160]) "c" (help-echo "C")))) ;; All the result X coords are different, but Y coords are expected. 2. (setf (image-property image :rotation) 0) (setf (image-property image :flip) t) (should (equal (image--compute-map image) flipped-map)) ;; Return ((((circle (205 . 29) . 24) "a" (help-echo "A")) ((rect (169 . 101) 241 . 149) "b" (help-echo "B")) ((poly . [85 29 86 22 92 15 100 10 110 7 121 5 132 7 142 10 150 15 155 22 157 29 155 37 150 43 142 49 132 52 121 53 110 52 100 49 92 43 86 37]) "c" (help-echo "C"))) ;; Instead of (((circle (125 . 29) . 24) "a" (help-echo "A")) ((rect (89 . 101) 161 . 149) "b" (help-echo "B")) ((poly . [5 29 6 22 12 15 20 10 30 7 41 5 52 7 62 10 70 15 75 22 77 29 75 37 70 43 62 49 52 52 41 53 30 52 20 49 12 43 6 37]) "c" (help-echo "C")))) ;; All the result X coords are different, but Y coords are expected. On my laptop: (image-size (image--image-without-parameters image) t) => (228 . 246) Hope it will help to understand the reason. Thanks!