output: Add footnote support.
[pspp] / tests / output / render.at
index edbe49ebef4481aba1993106e9df872a44b8bf69..9aaef8cf8e702b3f8ca6d7ef9f9b2c0d1adc223c 100644 (file)
@@ -11,8 +11,8 @@
 # +-+-+-+M+-+-+
 # |Q|RST|N|U|V|
 # +-+---+-+-+-+
-m4_define([RENDER_WEAVE_6X6],
-  [AT_DATA([input], [6 6 $1
+m4_define([WEAVE_6X6],
+  [6 6 $1
 @a
 1*2 @bcd
 @e
@@ -37,7 +37,7 @@ m4_define([RENDER_WEAVE_6X6],
 1*2 @RST
 @U
 @V
-])])
+])
 
 # +-+-+-+-+-+-+-+-+
 # |a|b|c|d|e|f|g|h|
@@ -56,8 +56,8 @@ m4_define([RENDER_WEAVE_6X6],
 # +-+-+-+-+-+-+-+-+
 # |i|j|k|l|m|n|o|p|
 # +-+-+-+-+-+-+-+-+
-m4_define([RENDER_8X8],
-  [AT_DATA([input], [8 8 $1
+m4_define([WEAVE_8X8],
+  [8 8 $1
 @a
 @b
 @c
@@ -108,7 +108,7 @@ m4_define([RENDER_8X8],
 @n
 @o
 @p
-])])
+])
 
 # This input is something of a counterexample, in that it could render
 # compactly as this if the algorithm for choosing cell widths and
@@ -131,8 +131,8 @@ m4_define([RENDER_8X8],
 # +---+-+RSTUV|456|
 # |abcde|WXYZ0|789|
 # +-----+-----+---+
-m4_define([RENDER_8X8_2],
-  [AT_DATA([input], [8 8 $1
+m4_define([WEAVE_8X8_2],
+  [8 8 $1
 2*2 @abc\ndef\nghi
 1*2 @jkl
 2*2 @mno\npqr\nstu
@@ -154,7 +154,7 @@ m4_define([RENDER_8X8_2],
 2*3 @MNOPQ\nRSTUV\nWXYZ0
 2*2 @123\n456\n789
 1*3 @abcde
-])])
+])
 \f
 AT_BANNER([output rendering -- no page breaking])
 
@@ -167,6 +167,17 @@ AT_CHECK([render-test input], [0], [abc
 ])
 AT_CLEANUP
 
+AT_SETUP([nested single cell])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [1 1
+abc
+1 1
+{0}
+])
+AT_CHECK([render-test input], [0], [abc
+])
+AT_CLEANUP
+
 AT_SETUP([single cell with border])
 AT_KEYWORDS([render rendering])
 AT_DATA([input], [1 1
@@ -179,6 +190,22 @@ AT_CHECK([render-test input], [0], [dnl
 ])
 AT_CLEANUP
 
+AT_SETUP([nested single cell with border])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [1 1
+@abc
+1 1
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++-----+
+|+---+|
+||abc||
+|+---+|
++-----+
+])
+AT_CLEANUP
+
 AT_SETUP([joined columns])
 AT_KEYWORDS([render rendering])
 AT_DATA([input], [2 2
@@ -215,9 +242,51 @@ AT_CHECK([render-test input], [0], [dnl
 ])
 AT_CLEANUP
 
+AT_SETUP([joined rows and columns (with footnotes)])
+AT_KEYWORDS([render rendering footnote])
+AT_DATA([input], [3 3
+1*2 @abc#Approximation.
+2*1 @d\ne\nf#This is a very long footnote that will have to wrap from one line to the next.  Let's see if the rendering engine does it acceptably.
+2*1 @g\nh\ni#One#Two#Three
+@j
+1*2 @klm
+])
+AT_CHECK([render-test --csv input], [0],
+[[+------------+----+
+|      abc[a]|   d|
++----------+-+   e|
+|         g|j|f[b]|
+|         h+-+----+
+|i[c][d][e]|   klm|
++----------+------+
+[a] Approximation.
+[b] This is a very long footnote that will have to wrap from one line to the
+    next.  Let's see if the rendering engine does it acceptably.
+[c] One
+[d] Two
+[e] Three
+]])
+AT_CHECK([cat render.csv], [0],
+[[abc[a],,"d
+e
+f[b]"
+"g
+h
+i[c][d][e]",j,
+,klm,
+
+Footnotes:
+a,Approximation.
+b,This is a very long footnote that will have to wrap from one line to the next.  Let's see if the rendering engine does it acceptably.
+c,One
+d,Two
+e,Three
+]])
+AT_CLEANUP
+
 AT_SETUP([6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_CHECK([render-test input], [0], [dnl
 +-+---+-+-+-+
 |a|bcd|e|f|i|
@@ -322,6 +391,26 @@ AT_CHECK([render-test input], [0], [dnl
 ])
 AT_CLEANUP
 
+AT_SETUP([nested joined rows])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [2 2
+2*1 @ab\ncd\nef
+@hij
+@klm
+1 1
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++--------+
+|+--+---+|
+||ab|hij||
+||cd+---+|
+||ef|klm||
+|+--+---+|
++--------+
+])
+AT_CLEANUP
+
 dnl This checks for bug #31346, a segmentation fault that surfaced
 dnl when two or more rows  had no unspanned cells and no rules.
 AT_SETUP([joined rows only, no rules])
@@ -437,7 +526,7 @@ AT_CLEANUP
 
 AT_SETUP([8x8 with many 2x2 joins])
 AT_KEYWORDS([render rendering])
-RENDER_8X8_2
+AT_DATA([input], [WEAVE_8X8_2])
 AT_CHECK([render-test input], [0],[dnl
 +---+---+----+----+
 |abc|jkl| mno| vwx|
@@ -463,6 +552,203 @@ AT_CHECK([render-test input], [0],[dnl
 +-----+------+----+
 ])
 AT_CLEANUP
+
+AT_SETUP([nested 8x8])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [WEAVE_8X8[]dnl
+1 1
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++-----------------+
+|+-+-+-+-+-+-+-+-+|
+||a|b|c|d|e|f|g|h||
+|+-+-+-+-+-+-+-+-+|
+||i|jkl|m|nop|q|t||
+|+-+-+-+-+-+-+r+-+|
+||u|v|wxy|z|A|s|D||
+|+-+-+-+-+-+B+-+-+|
+||E|F|I|JKL|C|M|P||
+|+-+G+-+---+-+N+-+|
+||Q|H|R|UVW|X|O|Y||
+|+-+-+S+-+-+-+-+-+|
+||Z|0|T|3|456|7|8||
+|+-+1+-+-+-+-+-+-+|
+||9|2|abc|d|efg|h||
+|+-+-+-+-+-+-+-+-+|
+||i|j|k|l|m|n|o|p||
+|+-+-+-+-+-+-+-+-+|
++-----------------+
+])
+AT_CLEANUP
+
+AT_SETUP([nested 8x8s and 6x6s])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [WEAVE_8X8[]WEAVE_6X6[]dnl
+4 2
+@{0}
+@{1}
+@{1}
+@|{1}
+@|{1}
+@({1}
+@({1}
+@{0}
+])
+AT_CHECK([render-test input], [0], [dnl
++-----------------+-----------------+
+|+-+-+-+-+-+-+-+-+|    +-+---+-+-+-+|
+||a|b|c|d|e|f|g|h||    |a|bcd|e|f|i||
+|+-+-+-+-+-+-+-+-+|    +-+-+-+-+g+-+|
+||i|jkl|m|nop|q|t||    |j|m|nop|h|q||
+|+-+-+-+-+-+-+r+-+|    |k+-+-+-+-+r||
+||u|v|wxy|z|A|s|D||    |l|t|w|xyz|s||
+|+-+-+-+-+-+B+-+-+|    +-+u+-+-+-+-+|
+||E|F|I|JKL|C|M|P||    |A|v|B|E|FGH||
+|+-+G+-+---+-+N+-+|    +-+-+C+-+-+-+|
+||Q|H|R|UVW|X|O|Y||    |IJK|D|L|O|P||
+|+-+-+S+-+-+-+-+-+|    +-+-+-+M+-+-+|
+||Z|0|T|3|456|7|8||    |Q|RST|N|U|V||
+|+-+1+-+-+-+-+-+-+|    +-+---+-+-+-+|
+||9|2|abc|d|efg|h||                 |
+|+-+-+-+-+-+-+-+-+|                 |
+||i|j|k|l|m|n|o|p||                 |
+|+-+-+-+-+-+-+-+-+|                 |
++-----------------+-----------------+
+|    +-+---+-+-+-+|  +-+---+-+-+-+  |
+|    |a|bcd|e|f|i||  |a|bcd|e|f|i|  |
+|    +-+-+-+-+g+-+|  +-+-+-+-+g+-+  |
+|    |j|m|nop|h|q||  |j|m|nop|h|q|  |
+|    |k+-+-+-+-+r||  |k+-+-+-+-+r|  |
+|    |l|t|w|xyz|s||  |l|t|w|xyz|s|  |
+|    +-+u+-+-+-+-+|  +-+u+-+-+-+-+  |
+|    |A|v|B|E|FGH||  |A|v|B|E|FGH|  |
+|    +-+-+C+-+-+-+|  +-+-+C+-+-+-+  |
+|    |IJK|D|L|O|P||  |IJK|D|L|O|P|  |
+|    +-+-+-+M+-+-+|  +-+-+-+M+-+-+  |
+|    |Q|RST|N|U|V||  |Q|RST|N|U|V|  |
+|    +-+---+-+-+-+|  +-+---+-+-+-+  |
++-----------------+-----------------+
+|  +-+---+-+-+-+  |+-+---+-+-+-+    |
+|  |a|bcd|e|f|i|  ||a|bcd|e|f|i|    |
+|  +-+-+-+-+g+-+  |+-+-+-+-+g+-+    |
+|  |j|m|nop|h|q|  ||j|m|nop|h|q|    |
+|  |k+-+-+-+-+r|  ||k+-+-+-+-+r|    |
+|  |l|t|w|xyz|s|  ||l|t|w|xyz|s|    |
+|  +-+u+-+-+-+-+  |+-+u+-+-+-+-+    |
+|  |A|v|B|E|FGH|  ||A|v|B|E|FGH|    |
+|  +-+-+C+-+-+-+  |+-+-+C+-+-+-+    |
+|  |IJK|D|L|O|P|  ||IJK|D|L|O|P|    |
+|  +-+-+-+M+-+-+  |+-+-+-+M+-+-+    |
+|  |Q|RST|N|U|V|  ||Q|RST|N|U|V|    |
+|  +-+---+-+-+-+  |+-+---+-+-+-+    |
++-----------------+-----------------+
+|+-+---+-+-+-+    |+-+-+-+-+-+-+-+-+|
+||a|bcd|e|f|i|    ||a|b|c|d|e|f|g|h||
+|+-+-+-+-+g+-+    |+-+-+-+-+-+-+-+-+|
+||j|m|nop|h|q|    ||i|jkl|m|nop|q|t||
+||k+-+-+-+-+r|    |+-+-+-+-+-+-+r+-+|
+||l|t|w|xyz|s|    ||u|v|wxy|z|A|s|D||
+|+-+u+-+-+-+-+    |+-+-+-+-+-+B+-+-+|
+||A|v|B|E|FGH|    ||E|F|I|JKL|C|M|P||
+|+-+-+C+-+-+-+    |+-+G+-+---+-+N+-+|
+||IJK|D|L|O|P|    ||Q|H|R|UVW|X|O|Y||
+|+-+-+-+M+-+-+    |+-+-+S+-+-+-+-+-+|
+||Q|RST|N|U|V|    ||Z|0|T|3|456|7|8||
+|+-+---+-+-+-+    |+-+1+-+-+-+-+-+-+|
+|                 ||9|2|abc|d|efg|h||
+|                 |+-+-+-+-+-+-+-+-+|
+|                 ||i|j|k|l|m|n|o|p||
+|                 |+-+-+-+-+-+-+-+-+|
++-----------------+-----------------+
+])
+AT_CLEANUP
+
+AT_SETUP([doubly nested cells])
+AT_KEYWORDS([render rendering])
+AT_DATA([input], [WEAVE_8X8[]WEAVE_6X6[]dnl
+4 2
+@{0}
+@{1}
+@{1}
+@|{1}
+@|{1}
+@({1}
+@({1}
+@{0}
+1 1
+@{2}
+])
+AT_CHECK([render-test input --length=70], [0], [dnl
++-------------------------------------+
+|+-----------------+-----------------+|
+||+-+-+-+-+-+-+-+-+|    +-+---+-+-+-+||
+|||a|b|c|d|e|f|g|h||    |a|bcd|e|f|i|||
+||+-+-+-+-+-+-+-+-+|    +-+-+-+-+g+-+||
+|||i|jkl|m|nop|q|t||    |j|m|nop|h|q|||
+||+-+-+-+-+-+-+r+-+|    |k+-+-+-+-+r|||
+|||u|v|wxy|z|A|s|D||    |l|t|w|xyz|s|||
+||+-+-+-+-+-+B+-+-+|    +-+u+-+-+-+-+||
+|||E|F|I|JKL|C|M|P||    |A|v|B|E|FGH|||
+||+-+G+-+---+-+N+-+|    +-+-+C+-+-+-+||
+|||Q|H|R|UVW|X|O|Y||    |IJK|D|L|O|P|||
+||+-+-+S+-+-+-+-+-+|    +-+-+-+M+-+-+||
+|||Z|0|T|3|456|7|8||    |Q|RST|N|U|V|||
+||+-+1+-+-+-+-+-+-+|    +-+---+-+-+-+||
+|||9|2|abc|d|efg|h||                 ||
+||+-+-+-+-+-+-+-+-+|                 ||
+|||i|j|k|l|m|n|o|p||                 ||
+||+-+-+-+-+-+-+-+-+|                 ||
+|+-----------------+-----------------+|
+||    +-+---+-+-+-+|  +-+---+-+-+-+  ||
+||    |a|bcd|e|f|i||  |a|bcd|e|f|i|  ||
+||    +-+-+-+-+g+-+|  +-+-+-+-+g+-+  ||
+||    |j|m|nop|h|q||  |j|m|nop|h|q|  ||
+||    |k+-+-+-+-+r||  |k+-+-+-+-+r|  ||
+||    |l|t|w|xyz|s||  |l|t|w|xyz|s|  ||
+||    +-+u+-+-+-+-+|  +-+u+-+-+-+-+  ||
+||    |A|v|B|E|FGH||  |A|v|B|E|FGH|  ||
+||    +-+-+C+-+-+-+|  +-+-+C+-+-+-+  ||
+||    |IJK|D|L|O|P||  |IJK|D|L|O|P|  ||
+||    +-+-+-+M+-+-+|  +-+-+-+M+-+-+  ||
+||    |Q|RST|N|U|V||  |Q|RST|N|U|V|  ||
+||    +-+---+-+-+-+|  +-+---+-+-+-+  ||
+|+-----------------+-----------------+|
+||  +-+---+-+-+-+  |+-+---+-+-+-+    ||
+||  |a|bcd|e|f|i|  ||a|bcd|e|f|i|    ||
+||  +-+-+-+-+g+-+  |+-+-+-+-+g+-+    ||
+||  |j|m|nop|h|q|  ||j|m|nop|h|q|    ||
+||  |k+-+-+-+-+r|  ||k+-+-+-+-+r|    ||
+||  |l|t|w|xyz|s|  ||l|t|w|xyz|s|    ||
+||  +-+u+-+-+-+-+  |+-+u+-+-+-+-+    ||
+||  |A|v|B|E|FGH|  ||A|v|B|E|FGH|    ||
+||  +-+-+C+-+-+-+  |+-+-+C+-+-+-+    ||
+||  |IJK|D|L|O|P|  ||IJK|D|L|O|P|    ||
+||  +-+-+-+M+-+-+  |+-+-+-+M+-+-+    ||
+||  |Q|RST|N|U|V|  ||Q|RST|N|U|V|    ||
+||  +-+---+-+-+-+  |+-+---+-+-+-+    ||
+|+-----------------+-----------------+|
+||+-+---+-+-+-+    |+-+-+-+-+-+-+-+-+||
+|||a|bcd|e|f|i|    ||a|b|c|d|e|f|g|h|||
+||+-+-+-+-+g+-+    |+-+-+-+-+-+-+-+-+||
+|||j|m|nop|h|q|    ||i|jkl|m|nop|q|t|||
+|||k+-+-+-+-+r|    |+-+-+-+-+-+-+r+-+||
+|||l|t|w|xyz|s|    ||u|v|wxy|z|A|s|D|||
+||+-+u+-+-+-+-+    |+-+-+-+-+-+B+-+-+||
+|||A|v|B|E|FGH|    ||E|F|I|JKL|C|M|P|||
+||+-+-+C+-+-+-+    |+-+G+-+---+-+N+-+||
+|||IJK|D|L|O|P|    ||Q|H|R|UVW|X|O|Y|||
+||+-+-+-+M+-+-+    |+-+-+S+-+-+-+-+-+||
+|||Q|RST|N|U|V|    ||Z|0|T|3|456|7|8|||
+||+-+---+-+-+-+    |+-+1+-+-+-+-+-+-+||
+||                 ||9|2|abc|d|efg|h|||
+||                 |+-+-+-+-+-+-+-+-+||
+||                 ||i|j|k|l|m|n|o|p|||
+||                 |+-+-+-+-+-+-+-+-+||
+|+-----------------+-----------------+|
++-------------------------------------+
+])
+AT_CLEANUP
 \f
 AT_BANNER([output rendering -- horizontal page breaks])
 
@@ -827,7 +1113,7 @@ AT_CLEANUP
 
 AT_SETUP([horz break 6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_DATA([expout], [dnl
 +-+--
 |a|bc
@@ -877,7 +1163,7 @@ AT_CLEANUP
 
 AT_SETUP([horz break 6x6, joined rows and columns, left header])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6([1 0 0 0])
+AT_DATA([input], [WEAVE_6X6([1 0 0 0])])
 AT_DATA([expout], [dnl
 +-+---+-+
 |a|bcd|e|
@@ -913,7 +1199,7 @@ AT_CLEANUP
 
 AT_SETUP([horz break 6x6, joined rows and columns, right header])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6([0 1 0 0])
+AT_DATA([input], [WEAVE_6X6([0 1 0 0])])
 AT_DATA([expout], [dnl
 +-+---+-+
 |a|bcd|i|
@@ -1170,7 +1456,7 @@ AT_CLEANUP
 
 AT_SETUP([horz break 8x8 with many 2x2 joins])
 AT_KEYWORDS([render rendering])
-RENDER_8X8_2
+AT_DATA([input], [WEAVE_8X8_2])
 AT_CHECK([render-test --width=8 input], [0],[dnl
 +---+--
 |abc|jk
@@ -1921,7 +2207,7 @@ AT_CLEANUP
 
 AT_SETUP([vert break 6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_CHECK([render-test --length=6 input], [0], [dnl
 +-+---+-+-+-+
 |a|bcd|e|f|i|
@@ -2091,12 +2377,44 @@ AT_CHECK([render-test --width=7 --length=6 input], [0], [expout])
 AT_CHECK([render-test -o mb0 --min-break=0 --width=7 --length=6 input],
   [0], [expout])
 AT_CLEANUP
+
+AT_SETUP([breaking nested cell too tall for page])
+AT_KEYWORDS([render rendering])
+AT_CAPTURE_FILE([input])
+AT_DATA([input], [WEAVE_8X8[]WEAVE_6X6[]dnl
+1 2
+@{0}
+@{1}
+])
+AT_CHECK([render-test input --length=10], [0], [dnl
++-----------------+-------------+
+|+-+-+-+-+-+-+-+-+|+-+---+-+-+-+|
+||a|b|c|d|e|f|g|h|||a|bcd|e|f|i||
+|+-+-+-+-+-+-+-+-+|+-+-+-+-+g+-+|
+||i|jkl|m|nop|q|t|||j|m|nop|h|q||
+|+-+-+-+-+-+-+r+-+||k+-+-+-+-+r||
+||u|v|wxy|z|A|s|D|||l|t|w|xyz|s||
+|+-+-+-+-+-+B+-+-+|+-+u+-+-+-+-+|
+||E|F|I|JKL|C|M|P|||A|v|B|E|FGH||
+|+-+G+-+---+-+N+-+|+-+-+C+-+-+-+|
+
+||Q|H|R|UVW|X|O|Y|||IJK|D|L|O|P||
+|+-+-+S+-+-+-+-+-+|+-+-+-+M+-+-+|
+||Z|0|T|3|456|7|8|||Q|RST|N|U|V||
+|+-+1+-+-+-+-+-+-+|+-+---+-+-+-+|
+||9|2|abc|d|efg|h||             |
+|+-+-+-+-+-+-+-+-+|             |
+||i|j|k|l|m|n|o|p||             |
+|+-+-+-+-+-+-+-+-+|             |
++-----------------+-------------+
+])
+AT_CLEANUP
 \f
 AT_BANNER([output rendering -- double page breaks])
 
 AT_SETUP([double break 6x6, joined rows and columns])
 AT_KEYWORDS([render rendering])
-RENDER_WEAVE_6X6
+AT_DATA([input], [WEAVE_6X6])
 AT_CHECK([render-test --width=6 --length=6 input], [0], [dnl
 +-+--
 |a|bc
@@ -2211,7 +2529,7 @@ AT_CLEANUP
 
 AT_SETUP([double break 8x8, with joins, left and right headers])
 AT_KEYWORDS([render rendering])
-RENDER_8X8([1 1 0 0])
+AT_DATA([input], [WEAVE_8X8([1 1 0 0])])
 AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 +-+-+-+-+-+-+
 |a|b|c|d|e|h|
@@ -2298,7 +2616,7 @@ AT_CLEANUP
 
 AT_SETUP([double break 8x8, with joins, top and bottom headers])
 AT_KEYWORDS([render rendering])
-RENDER_8X8([0 0 1 1])
+AT_DATA([input], [WEAVE_8X8([0 0 1 1])])
 AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 +-+-+-+-+-+-+
 |a|b|c|d|e|f|
@@ -2405,7 +2723,7 @@ AT_CLEANUP
 
 AT_SETUP([double break 8x8, with joins, all headers])
 AT_KEYWORDS([render rendering])
-RENDER_8X8([1 1 1 1])
+AT_DATA([input], [WEAVE_8X8([1 1 1 1])])
 AT_CHECK([render-test input --width=14 --length=14], [0], [dnl
 +-+-+-+-+-+-+
 |a|b|c|d|e|h|