draw_segment(ch,
centre_x, centre_y, radius,
angle, segment_angle,
- data_colour[i]);
+ data_colour[i % N_CHART_COLOURS]);
/* Now add the labels */
if ( label_x < centre_x )
tests/bugs/multipass.sh \
tests/bugs/overwrite-input-file.sh \
tests/bugs/overwrite-special-file.sh \
+ tests/bugs/piechart.sh \
tests/bugs/random.sh \
tests/bugs/signals.sh \
tests/bugs/t-test-with-temp.sh \
--- /dev/null
+#!/bin/sh
+
+# This program tests for a bug which crashed pspp when a
+# piechart with too many segments was requested.
+
+
+TEMPDIR=/tmp/pspp-tst-$$
+TESTFILE=$TEMPDIR/`basename $0`.sps
+
+# ensure that top_builddir are absolute
+if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
+if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
+top_builddir=`cd $top_builddir; pwd`
+PSPP=$top_builddir/src/ui/terminal/pspp
+
+# ensure that top_srcdir is absolute
+top_srcdir=`cd $top_srcdir; pwd`
+
+STAT_CONFIG_PATH=$top_srcdir/config
+export STAT_CONFIG_PATH
+
+
+cleanup()
+{
+ if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
+ echo "NOT cleaning $TEMPDIR"
+ return ;
+ fi
+ cd /
+ chmod u+w $TEMPDIR
+ rm -rf $TEMPDIR
+}
+
+
+fail()
+{
+ echo $activity
+ echo FAILED
+ cleanup;
+ exit 1;
+}
+
+
+no_result()
+{
+ echo $activity
+ echo NO RESULT;
+ cleanup;
+ exit 2;
+}
+
+pass()
+{
+ cleanup;
+ exit 0;
+}
+
+mkdir -p $TEMPDIR
+
+cd $TEMPDIR
+
+activity="create test syntax"
+cat > $TESTFILE <<EOF
+data list list /x * w *.
+begin data.
+1 4
+34 10
+-9 15
+232 6
+11 4
+134 1
+9 5
+32 16
+-2 6
+2 16
+20 6
+end data.
+
+weight by w.
+
+frequencies /x
+ /piechart.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 1"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;