"4dc72dd9deb1c3394ada3de3f52bc7c1ff831ab6 Fix 'window-text-pixel-size' when there are leading/trailing spaces" adds some tests that don't run correctly in my environment. The tests do run fine interactively. The output log: Test xdisp-tests--window-text-pixel-size backtrace: make-terminal-frame(((parent-frame . #<frame F1 0x56424bb8b2c8>))) tty-create-frame-with-faces(((parent-frame . #<frame F1 0x56424bb8b2 #f(compiled-function (params) #<bytecode 0x6b0cf7c833dbfd2>)(((paren apply(#f(compiled-function (params) #<bytecode 0x6b0cf7c833dbfd2>) ( frame-creation-function(((parent-frame . #<frame F1 0x56424bb8b2c8>) make-frame(((parent-frame . #<frame F1 0x56424bb8b2c8>))) display-buffer-in-child-frame(#<killed buffer> nil) display-buffer(#<killed buffer> (display-buffer-in-child-frame)) #f(compiled-function () #<bytecode -0x18c672b9d813486f>)() ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test ert-run-test(#s(ert-test :name xdisp-tests--window-text-pixel-size : ert-run-or-rerun-test(#s(ert--stats :selector (not (or ... ...)) :te ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable))) ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) ( command-line-1(("-L" ":." "-l" "ert" "-l" "src/xdisp-tests" "--eval" command-line() normal-top-level() Test xdisp-tests--window-text-pixel-size condition: (error "Unknown terminal type") xdisp-tests--window-text-pixel-size-leading-space and xdisp-tests--window-text-pixel-size-trailing-space fail in the same way. I don't know if these tests should just be marked expected to fail or not. -- MJF
On Sat, Jan 16, 2021 at 12:33 AM Jared Finder <jared@finder.org> wrote:
>
> "4dc72dd9deb1c3394ada3de3f52bc7c1ff831ab6 Fix 'window-text-pixel-size'
> when there are leading/trailing spaces" adds some tests that don't run
> correctly in my environment. The tests do run fine interactively.
>
Yes, Eli mentioned this in the bug thread. I don't know how to make
these tests pass in batch mode. I modified it to something that seems
like it should pass in batch mode, but I get a size of 0x0, which
isn't what I'm going for.
This is what I tried:
(ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748
(with-current-buffer-window "*test*" 'display-buffer-same-window nil
(erase-buffer)
(insert "xxx")
(let* ((char-width (frame-char-width))
(size (window-text-pixel-size (get-buffer-window) t t)))
(should (equal (/ (car size) char-width) 3)))))
Eli mentioned moving the tests to manual/redisplay-testsuite.el, which is fine.
If anyone else has an idea how to make this test work in batch mode,
I'm all ears.
Thanks,
Aaron
> From: Aaron Jensen <aaronjensen@gmail.com>
> Date: Sat, 16 Jan 2021 00:38:37 -0600
> Cc: emacs-devel@gnu.org
>
> (ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748
> (with-current-buffer-window "*test*" 'display-buffer-same-window nil
> (erase-buffer)
> (insert "xxx")
> (let* ((char-width (frame-char-width))
> (size (window-text-pixel-size (get-buffer-window) t t)))
> (should (equal (/ (car size) char-width) 3)))))
>
> Eli mentioned moving the tests to manual/redisplay-testsuite.el, which is fine.
>
> If anyone else has an idea how to make this test work in batch mode,
> I'm all ears.
This works for me, both interactively and in batch:
(ert-deftest xdisp-tests--window-text-pixel-size ()
(with-current-buffer (generate-new-buffer "*test*")
(erase-buffer)
(insert "xxx")
(switch-to-buffer (current-buffer))
(let* ((char-width (frame-char-width))
(size (window-text-pixel-size nil t t)))
(should (equal (/ (car size) char-width) 3)))))
On Sat, Jan 16, 2021 at 2:42 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> This works for me, both interactively and in batch:
Ah! I don't need to control the window directly at all. Thank you. I
emailed a patch to the original bug.
Thanks,
Aaron