From: Ben Pfaff Date: Sat, 28 Sep 2013 20:55:14 +0000 (-0700) Subject: render: Fix bug measuring spanned cells. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa047128eb8dab357f51837942540b14cb07c78f;p=pspp render: Fix bug measuring spanned cells. --- diff --git a/src/output/render.c b/src/output/render.c index 8332b85d98..a91e1f7b79 100644 --- a/src/output/render.c +++ b/src/output/render.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011, 2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -384,7 +384,7 @@ distribute_spanned_width (int width, w += width * unspanned * d0; } - rows[x].width = w / d; + rows[x].width = MAX (rows[x].width, w / d); w -= rows[x].width * d; } } diff --git a/tests/output/render.at b/tests/output/render.at index 230299223f..c12cb91753 100644 --- a/tests/output/render.at +++ b/tests/output/render.at @@ -1831,3 +1831,32 @@ AT_CHECK([render-test --width=15 --length=15 input], [0], [dnl +-+-+-----+ ]) AT_CLEANUP + +# There was a bug that, when multiple cells spanned a single column +# (or row), only the dimensions of the cell nearest the bottom of the +# table were actually considered. This checks for regression. (This +# problem was most easily observed with SYSFILE INFO, which uses lots +# of spanned cells). +# +# Without the fix, the output looks like this: +# +-------+ +# | A long| +# | text| +# |string.| +# +-------+ +# |shorter| +AT_SETUP([multiple spanned cells all contribute to dimensions]) +AT_KEYWORDS([render rendering]) +AT_DATA([input], [dnl +2 2 +1*2 @A long text string. +1*2 @shorter +]) +AT_CHECK([render-test --width=30 --length=15 input], [0], [dnl ++-------------------+ +|A long text string.| ++-------------------+ +| shorter| ++-------------------+ +]) +AT_CLEANUP