From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#45748: [PATCH] * test/src/xdisp-tests.el Fix tests to work in batch mode Date: Sat, 16 Jan 2021 11:12:45 -0600 Message-ID: <20210116171245.89807-1-aaronjensen@gmail.com> References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36266"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Aaron Jensen To: 45748@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 16 18:13:10 2021 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 1l0p8P-0009Hg-1v for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Jan 2021 18:13:09 +0100 Original-Received: from localhost ([::1]:52422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0p8N-0004H3-VG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Jan 2021 12:13:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0p8I-0004Gk-5p for bug-gnu-emacs@gnu.org; Sat, 16 Jan 2021 12:13:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0p8H-0002TI-VF for bug-gnu-emacs@gnu.org; Sat, 16 Jan 2021 12:13:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l0p8H-0000Js-Qu for bug-gnu-emacs@gnu.org; Sat, 16 Jan 2021 12:13:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Jan 2021 17:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45748 X-GNU-PR-Package: emacs Original-Received: via spool by 45748-submit@debbugs.gnu.org id=B45748.16108171801222 (code B ref 45748); Sat, 16 Jan 2021 17:13:01 +0000 Original-Received: (at 45748) by debbugs.gnu.org; 16 Jan 2021 17:13:00 +0000 Original-Received: from localhost ([127.0.0.1]:43915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0p8G-0000Jd-KJ for submit@debbugs.gnu.org; Sat, 16 Jan 2021 12:13:00 -0500 Original-Received: from mail-io1-f54.google.com ([209.85.166.54]:36806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0p8E-0000JP-8y for 45748@debbugs.gnu.org; Sat, 16 Jan 2021 12:13:00 -0500 Original-Received: by mail-io1-f54.google.com with SMTP id d81so9346129iof.3 for <45748@debbugs.gnu.org>; Sat, 16 Jan 2021 09:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xlBoW2OUli21ovX6xo9jp/HQBYkznhddSmmNvgZGq5E=; b=WuCfiK0tWwbtYn80yKmwbhWpujmep09oFWdsD8NWYfX+dTkpDnymjawhhEpR4plOmW qWvK9PyzrXPd1EuPVIZomYoVR0bka1uhbkR9wuiX2OW1phCOUfkSAm8syd/3xEWO+qDq FvyZTP+rn4Rcc9btYr5nbhV2UipcMC+Itl3af2FES/eIQFW2eeqIzfFBvQZCPv1NGJPf mHafTxooLKyR19oDed+MZIUDJBDFIBoVREuGP1S7RjpWyV4VTEPJkz0c9rGIrDI00deQ QWn2Vwrrrd3zIp8qKn1Ztno/Rkhx0axrz0RU6o9qogQgJnWlSJ6X0lL3F9bmOWzBFInn i2Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xlBoW2OUli21ovX6xo9jp/HQBYkznhddSmmNvgZGq5E=; b=F8leVEAuDulCGI+PjTIbvsOtAEwPG5gQ9+miJJYIk5KiIl4t5QQ4Zhpb4rd2DpvK4Q 5SWaJ6f4sENJn5GfyHrdskMxDDXvm4l6qDNQrwUWmbQb0YKnJiUZoQXQP7P/o4IDxBuT eitBK8/Lf9XkYIFbgJbqLpw8qIjt3OU4bCmVfGT7d2AVTTnBVppYy0A8sz798a+Rx2WG DbhEo5DPUciOdy4ZsX/TdbRD72h/maTIxrhXj2Acr6YWwlL4jTV8MtiLrk+id5TH9cOQ G/GOD5w0RfGqFh/QdhU7NHrw0Hqmehf0BmjGooouoAv1QGLZ1w43brixIZGz6k4LT9aK KVgA== X-Gm-Message-State: AOAM532isYWC8NfP09Pni3waD0xThh3dWVV7+By3yLhCvCAwh8bCGOH4 F02G/DDw8yJtC/ex4uUOVTGIrOTo14HLQg== X-Google-Smtp-Source: ABdhPJzOA4gO/u40O+cgT1Qnkz90hWnZsHqJHLZ2sVcXNIKZ/bwb0u5DOVbRyIo8OyVzUdWCVeThzA== X-Received: by 2002:a05:6602:2c52:: with SMTP id x18mr4128701iov.5.1610817172495; Sat, 16 Jan 2021 09:12:52 -0800 (PST) Original-Received: from localhost.localdomain ([205.214.166.193]) by smtp.gmail.com with ESMTPSA id q2sm5526504ioh.36.2021.01.16.09.12.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Jan 2021 09:12:51 -0800 (PST) X-Mailer: git-send-email 2.28.0 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" Xref: news.gmane.io gmane.emacs.bugs:198025 Archived-At: (xdisp-tests--window-text-pixel-size) (xdisp-tests--window-text-pixel-size-leading-space) (xdisp-tests--window-text-pixel-size-trailing-space): Fix tests --- test/src/xdisp-tests.el | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el index ec96d777ff..09c2fa83b3 100644 --- a/test/src/xdisp-tests.el +++ b/test/src/xdisp-tests.el @@ -73,33 +73,36 @@ xdisp-tests--minibuffer-scroll (should (equal (nth 1 posns) (nth 2 posns))))) (ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748 - (with-temp-buffer + (with-current-buffer-window "*test*" 'display-buffer-reuse-window nil + (erase-buffer) (insert "xxx") - (let* ((window - (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) - (char-width (frame-char-width)) - (size (window-text-pixel-size nil t t))) - (delete-frame (window-frame window)) + (let* ((char-width (frame-char-width)) + (size (window-text-pixel-size (get-buffer-window) t t))) + (message "Size: %S" size) + (should (equal (/ (car size) char-width) 3))))) + +(ert-deftest xdisp-tests--window-text-pixel-size () ;; bug#45748 + (with-current-buffer (generate-new-buffer "*test*") + (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))))) (ert-deftest xdisp-tests--window-text-pixel-size-leading-space () ;; bug#45748 - (with-temp-buffer + (with-current-buffer (generate-new-buffer "*test*") (insert " xx") - (let* ((window - (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) - (char-width (frame-char-width)) - (size (window-text-pixel-size nil t t))) - (delete-frame (window-frame window)) + (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))))) (ert-deftest xdisp-tests--window-text-pixel-size-trailing-space () ;; bug#45748 - (with-temp-buffer + (with-current-buffer (generate-new-buffer "*test*") (insert "xx ") - (let* ((window - (display-buffer (current-buffer) '(display-buffer-in-child-frame . nil))) - (char-width (frame-char-width)) - (size (window-text-pixel-size nil t t))) - (delete-frame (window-frame window)) + (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))))) ;;; xdisp-tests.el ends here -- 2.28.0