GNU bug report logs - #64356
[PATCH 0/4] Fix GDM and VNC tests

Previous Next

Package: guix-patches;

Reported by: Bruno Victal <mirai <at> makinata.eu>

Date: Thu, 29 Jun 2023 20:41:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Bruno Victal <mirai <at> makinata.eu>
Cc: 64356 <at> debbugs.gnu.org
Subject: [bug#64356] [PATCH 0/4] Fix GDM and VNC tests
Date: Wed, 19 Jul 2023 10:50:17 -0400
Hi,

Bruno Victal <mirai <at> makinata.eu> writes:

[...]

> -(define* (marionette-screen-text marionette #:key (ocr "ocrad"))
> +(define* (marionette-screen-text marionette #:key (ocr "ocrad")
> +                                 ocr-arguments)
>    "Take a screenshot of MARIONETTE, perform optical character
>  recognition (OCR), and return the text read from the screen as a string, along
>  the screen dump image used.  Do this by invoking OCR, which should be the file
> @@ -324,14 +330,19 @@ (define* (marionette-screen-text marionette #:key (ocr "ocrad"))
>    ;; Process it via the OCR.
>    (cond
>     ((string-contains ocr "ocrad")
> -    (values (invoke-ocrad-ocr image #:ocrad ocr) image))
> +    (values (invoke-ocrad-ocr image
> +                              #:ocrad ocr
> +                              #:ocr-arguments ocr-arguments) image))
>     ((string-contains ocr "tesseract")
> -    (values (invoke-tesseract-ocr image #:tesseract ocr) image))
> +    (values (invoke-tesseract-ocr image
> +                                  #:tesseract ocr
> +                                  #:ocr-arguments ocr-arguments) image))
>     (else (error "unsupported ocr command"))))
>  
>  (define* (wait-for-screen-text marionette predicate
>                                 #:key
>                                 (ocr "ocrad")
> +                               ocr-arguments

Care must be taken here to avoid overwriting the default arguments of
the 'invoke-ocrad-ocr' and 'invoke-tesseract-ocr' procedures.  I've
handled this by extracting a %default-ocrad-arguments and or'ing the
argument here with it in this procedure, like:

--8<---------------cut here---------------start------------->8---
@@ -324,14 +334,22 @@ (define* (marionette-screen-text marionette #:key (ocr "ocrad"))
   ;; Process it via the OCR.
   (cond
    ((string-contains ocr "ocrad")
-    (values (invoke-ocrad-ocr image #:ocrad ocr) image))
+    (values (invoke-ocrad-ocr image
+                              #:ocrad ocr
+                              #:ocr-arguments
+                              (or ocr-arguments %default-ocrad-arguments))
+            image))
    ((string-contains ocr "tesseract")
-    (values (invoke-tesseract-ocr image #:tesseract ocr) image))
+    (values (invoke-tesseract-ocr image
+                                  #:tesseract ocr
+                                  #:ocr-arguments (or ocr-arguments '()))
+            image))
    (else (error "unsupported ocr command"))))
 
 (define* (wait-for-screen-text marionette predicate
                                #:key
                                (ocr "ocrad")
--8<---------------cut here---------------end--------------->8---

Otherwise, LGTM.

-- 
Thanks,
Maxim




This bug report was last modified 1 year and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.