groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 07/17: [pdf]: Regression-test Savannah #65320.


From: G. Branden Robinson
Subject: [groff] 07/17: [pdf]: Regression-test Savannah #65320.
Date: Sat, 17 Feb 2024 22:08:43 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 63f38e5d456065c456d66b1274f7b555641f27fe
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Feb 16 12:52:05 2024 -0600

    [pdf]: Regression-test Savannah #65320.
    
    * tmac/tests/pdf_bookmark-starting-with-control-char-works.sh: Do it.
    * tmac/tmac.am (tmac_TESTS): Run test.
    
      (tmac_XFAIL_TESTS): Mark as an expected failure since resolution of
      this bug is blocked by resolution of Savannah #65322.
---
 ChangeLog                                          | 10 +++
 ...df_bookmark-starting-with-control-char-works.sh | 82 ++++++++++++++++++++++
 tmac/tmac.am                                       |  4 +-
 3 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 202899023..f23960c4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-16  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [pdf]: Regression-test Savannah #65320.
+
+       * tmac/tests/pdf_bookmark-starting-with-control-char-works.sh:
+       Do it.
+       * tmac/tmac.am (tmac_TESTS): Run test.
+       (tmac_XFAIL_TESTS): Mark as an expected failure since resolution
+       of this bug is blocked by resolution of Savannah #65322.
+
 2024-02-11  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [troff]: Implement `.it`, `.itc`, and `.itm` registers.  These
diff --git a/tmac/tests/pdf_bookmark-starting-with-control-char-works.sh 
b/tmac/tests/pdf_bookmark-starting-with-control-char-works.sh
new file mode 100755
index 000000000..09042ccad
--- /dev/null
+++ b/tmac/tests/pdf_bookmark-starting-with-control-char-works.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+fail=
+
+wail () {
+    echo ...FAILED >&2
+    fail=YES
+}
+
+# Regression-test Savannah #65320.
+#
+# Ensure that a bookmark starting with a roff control character makes it
+# into the PDF bookmark.
+input='Intro.
+.sp
+.ft B
+.pdfbookmark 1 Attack...
+Attack\|.\|.\|.
+.sp
+.pdfbookmark 1 ...Decay...
+\&.\|.\|.\|Decay\|.\|.\|.
+.sp
+.pdfbookmark 1 \&...Sustain...
+\&.\|.\|.\|Sustain\|.\|.\|.
+.sp
+.pdfbookmark 1 Release
+Release'
+
+# Expected:
+# x X ps:exec [/Dest /pdf:bm1 /Title (Attack...) /Level 1 /OUT pdfmark
+# x X ps:exec [/Dest /pdf:bm2 /Title (...Decay...) /Level 1 /OUT pdfmark
+# x X ps:exec [/Dest /pdf:bm3 /Title (...Sustain...) /Level 1 /OUT pdfmark
+# x X ps:exec [/Dest /pdf:bm4 /Title (Release) /Level 1 /OUT pdfmark
+
+output=$(printf "%s\n" "$input" | "$groff" -b -ww -Tpdf -Z \
+    | grep '^x X')
+echo "$output"
+
+echo "checking bookmark with trailing ellipsis" >&2
+echo "$output" \
+    | grep -qx 'x X ps:exec .*pdf:bm1 /Title (Attack\.\.\.).*pdfmark' \
+    || wail
+
+echo "checking bookmark with leading and trailing ellipsis" >&2
+echo "$output" \
+    | grep -qx 'x X ps:exec .*pdf:bm2 /Title (\.\.\.Decay\.\.\.).*pdfmark' \
+    || wail
+
+echo "checking bookmark with leading and trailing ellipsis" \
+    "(and dummy character workaround)" >&2
+echo "$output" \
+    | grep -qx 'x X ps:exec .*pdf:bm3 /Title (\.\.\.Sustain\.\.\.).*pdfmark' \
+    || wail
+
+echo "checking bookmark with no ellipsis" >&2
+echo "$output" \
+    | grep -qx 'x X ps:exec .*pdf:bm4 /Title (Release).*pdfmark' \
+    || wail
+
+test -z "$fail"
+
+# vim:set ai et sw=4 ts=4 tw=72:
diff --git a/tmac/tmac.am b/tmac/tmac.am
index d97d1cb9e..e7b9bcb7b 100644
--- a/tmac/tmac.am
+++ b/tmac/tmac.am
@@ -228,6 +228,7 @@ tmac_TESTS = \
   tmac/tests/latin5_works.sh \
   tmac/tests/latin9_works.sh \
   tmac/tests/localization-works.sh \
+  tmac/tests/pdf_bookmark-starting-with-control-char-works.sh \
   tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh \
   tmac/tests/pdfpic_falls-back-to-PSPIC.sh \
   tmac/tests/s_EQ-handles-empty-first-arg.sh \
@@ -250,7 +251,8 @@ tmac_XFAIL_TESTS = \
   tmac/tests/an-ext_ME-punct-hyphenates.sh \
   tmac/tests/an-ext_UE-punct-hyphenates.sh \
   tmac/tests/an-ext_UE-breaks-before-long-URIs.sh \
-  tmac/tests/e_footnotes-work-with-columns.sh
+  tmac/tests/e_footnotes-work-with-columns.sh \
+  tmac/tests/pdf_bookmark-starting-with-control-char-works.sh
 XFAIL_TESTS += $(tmac_XFAIL_TESTS)
 
 tmac/www.tmac: tmac/www.tmac.in



reply via email to

[Prev in Thread] Current Thread [Next in Thread]