Re: master d5f515e4a33 1/2: New image type canvas

Divya Ranjan Pattanaik <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Michael Albinus <[email protected]> writes:

>
> Likely, the tests would profit from
>
> (skip-unless (functionp 'canvas-refresh))
>
> Best regards, Michael.
>

Hello Michael, thank you for reporting this. Here's a patch, it uses (display-graphic-p) instead. Do we need to do anything about the canvas module function in emacs-module-resources/mod-test.c? Or, is it okay if those never get called from emacs-module-tests.el?


Regards,
-- 
Divya Ranjan Pattanaik,
Philosophy, Mathematics, Libre Software.

PGP Fingerprint: F0B3 1A69 8006 8FB8 096A  2F12 B245 10C6 108C 8D4A
fix-canvas-tests.patch (text/x-patch, 2.8 KB)
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 5ee775d12f8..b541c99194d 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -591,6 +591,7 @@ mod-test-make-string/nonempty
 ;;; Canvas tests
 
 (defun test-canvas-gen-file (width height pixel)
+  (skip-unless (display-graphic-p))
   (let* ((bytes (unibyte-string (logand pixel #xff)
                                 (logand (ash pixel -8) #xff)
                                 (logand (ash pixel -16) #xff)
@@ -603,6 +604,7 @@ test-canvas-gen-file
     t))
 
 (ert-deftest mod-test-canvas/valid ()
+  (skip-unless (display-graphic-p))
   (let* ((width 128) (height 215)
          (canvas `(image :type canvas :id test-canvas
                          :data-width ,width :data-height ,height))
@@ -614,6 +616,7 @@ mod-test-canvas/valid
       (should (not (eql hash-before hash-after))))))
 
 (ert-deftest mod-test-canvas/invalid ()
+  (skip-unless (display-graphic-p))
   (should-error (mod-test-canvas-read nil nil nil))
   (should-error (mod-test-canvas-write nil nil nil))
   (should (mod-test-canvas-invalid nil))
@@ -622,6 +625,7 @@ mod-test-canvas/invalid
   (should-error (mod-test-canvas-write '(image :type canvas) 256 527)))
 
 (ert-deftest mod-test-canvas/vector ()
+  (skip-unless (display-graphic-p))
   (let* ((width 327) (height 98)
          (canvas `(image :type canvas :id test-canvas
                          :data-width ,width :data-height ,height
@@ -639,6 +643,7 @@ mod-test-canvas/vector
     (should-error (mod-test-canvas-write canvas 187 210))))
 
 (ert-deftest mod-test-canvas/vector-reload ()
+  (skip-unless (display-graphic-p))
   (let* ((width 198) (height 720)
          (test-vector (make-vector (* width height) #xFFFF0000))
          (canvas `(image :type canvas :id test-canvas
@@ -654,6 +659,7 @@ mod-test-canvas/vector-reload
       (should (not (eql hash-initial hash-mutated))))))
 
 (ert-deftest mod-test-canvas/unibyte ()
+  (skip-unless (display-graphic-p))
   (let* ((width 458) (height 278)
          (pixel (unibyte-string #xFF #x80 #x40 #x80))
          (string-data (apply #'concat (make-list (* width height) pixel)))
@@ -675,6 +681,7 @@ mod-test-canvas/unibyte
     (should-error (mod-test-canvas-write canvas 378 453))))
 
 (ert-deftest mod-test-canvas/file ()
+  (skip-unless (display-graphic-p))
   ;; Generate the canvas data file
   (test-canvas-gen-file 128 98 #x80800000)
   (let* ((width 128) (height 98)
@@ -693,6 +700,7 @@ mod-test-canvas/file
     (should-error (mod-test-canvas-write canvas 398 712))))
 
 (ert-deftest mod-test-canvas/gc-stress ()
+  (skip-unless (display-graphic-p))
   "Allocate canvases in batches with GC between batches.
 Verifies that canvas pixel buffers are freed correctly and do not
 cause use-after-free crashes or GC assertion failures."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.