Skip to content

Commit

Permalink
Merge pull request #56 from danieljprice/test-suite
Browse files Browse the repository at this point in the history
Test suite
  • Loading branch information
danieljprice authored Dec 2, 2024
2 parents b345d85 + 3d3ead5 commit 1c4cb49
Show file tree
Hide file tree
Showing 23 changed files with 1,222 additions and 143 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]

env:
DISPLAY: :99

steps:

# make sure we have gfortran installed and linked
Expand All @@ -29,6 +32,22 @@ jobs:

- name: compile and install giza
run: |
./configure
make
sudo make install
./configure
make
sudo make install
# Set up Xvfb for graphical tests
- name: Install Xvfb to pretend to launch X-windows in the workflow
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y xvfb
# Run tests
- name: Run test programs, pressing enter to all prompts
if: matrix.os == 'ubuntu-latest'
run: |
Xvfb :99 -screen 0 1920x1080x24 &
echo "Current DISPLAY: $DISPLAY"
yes "" | make check || { echo "Tests failed. Printing test-suite.log..."; cat test/C/test-suite.log; exit 1; }
6 changes: 5 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Contributors (for updated list, use git shortlog -s -n -e):
Daniel Price <[email protected]> (main contact)
Harro Verkouter <[email protected]>
James Wetter <[email protected]>
Joachim Frieben <[email protected]>
Harro Verkouter <[email protected]>
Hiroyuki Ito <[email protected]>
Mark Hutchison <[email protected]>
Terrence Tricco <[email protected]>
Aard Keimpema <[email protected]>
Benson Muite <[email protected]>
Fabian P. Schmidt <[email protected]>
10 changes: 7 additions & 3 deletions LATEST.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Changes in v1.4.1
Changes in v1.4.2
------------------
- quieter output from mp4 device
- bug fix in release workflow
- bug fix with build on Mac OS: explicitly request static libs for libgiza.a and libpglot.a
- bug fix with pkg-config failing to find cairo.h
- bug fix with weird black screen on Mac OS after clicking in a plot window (#55)
- issues in test suite fixed (#50)
- bug fix with giza_circle (#52)
- added automated build and test suite to github actions workflow
2 changes: 1 addition & 1 deletion config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if all of the C90 standard headers exist (not just the ones
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
Expand Down
24 changes: 12 additions & 12 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.72 for giza 1.4.1.
# Generated by GNU Autoconf 2.72 for giza 1.4.2.
#
# Report bugs to <[email protected]>.
#
Expand Down Expand Up @@ -614,8 +614,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='giza'
PACKAGE_TARNAME='giza'
PACKAGE_VERSION='1.4.1'
PACKAGE_STRING='giza 1.4.1'
PACKAGE_VERSION='1.4.2'
PACKAGE_STRING='giza 1.4.2'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_URL='http://danieljprice.github.io/giza'

Expand Down Expand Up @@ -1383,7 +1383,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
'configure' configures giza 1.4.1 to adapt to many kinds of systems.
'configure' configures giza 1.4.2 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1454,7 +1454,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of giza 1.4.1:";;
short | recursive ) echo "Configuration of giza 1.4.2:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1584,7 +1584,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
giza configure 1.4.1
giza configure 1.4.2
generated by GNU Autoconf 2.72

Copyright (C) 2023 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1896,7 +1896,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by giza $as_me 1.4.1, which was
It was created by giza $as_me 1.4.2, which was
generated by GNU Autoconf 2.72. Invocation command line was

$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3370,7 +3370,7 @@ fi

# Define the identity of the package.
PACKAGE='giza'
VERSION='1.4.1'
VERSION='1.4.2'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -4998,7 +4998,7 @@ GIZA_VERSION_MAJOR=1

GIZA_VERSION_MINOR=4

GIZA_VERSION_MICRO=1
GIZA_VERSION_MICRO=2

#
# The following specify the interface version numbers for giza.
Expand All @@ -5014,7 +5014,7 @@ GIZA_VERSION_MICRO=1
#
LT_CURRENT=1

LT_REVISION=1
LT_REVISION=2

LT_AGE=1

Expand Down Expand Up @@ -17367,7 +17367,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by giza $as_me 1.4.1, which was
This file was extended by giza $as_me 1.4.2, which was
generated by GNU Autoconf 2.72. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -17436,7 +17436,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
giza config.status 1.4.1
giza config.status 1.4.2
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_PREREQ(2.61)
m4_define(giza_version_major,1)
m4_define(giza_version_minor,4)
m4_define(giza_version_micro,1)
m4_define(giza_version_micro,2)
AC_INIT([giza],
[giza_version_major.giza_version_minor.giza_version_micro],
[[email protected]],[],
Expand Down
1 change: 1 addition & 0 deletions docs/news/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<div id="content">
<h1>News</h1>
<p>2024.12.02: <a href="https://github.com/danieljprice/giza/releases">1.4.2</a> released.</p>
<p>2023.11.30: <a href="https://github.com/danieljprice/giza/releases">1.4.1</a> released.</p>
<p>2023.11.28: <a href="https://github.com/danieljprice/giza/releases">1.4.0</a> released.</p>
<p>2022.03.28: <a href="https://github.com/danieljprice/giza/releases">1.3.2</a> released.</p>
Expand Down
2 changes: 1 addition & 1 deletion src/giza-driver-xw.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ _giza_open_device_xw (double width, double height, int units)
XW[id].display = XOpenDisplay (NULL);
if (!XW[id].display)
{
_giza_error ("_giza_open_device_xw", "Cannot launch X window (use ssh -Y not ssh / install XQuartz if on Mac)");
_giza_error ("_giza_open_device_xw", "Cannot launch X window (use ssh -Y if remote; install XQuartz if on Mac)");
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/giza-format-number.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ giza_format_number (int mantissa, int power, int form, char *string, int maxchar
/* Integers of four or less digits (or forced integers) */
if ((power >= 0) && ((form == GIZA_NUMBER_FORMAT_AUTO && (power + numDigits) <= 4) || (form == GIZA_NUMBER_FORMAT_DEC && power + numDigits <= 10)))
{
for (; power > 0 && numDigits < (sizeof(tmp)-1); --power)
for (; power > 0 && numDigits < (int) (sizeof(tmp)-1); --power)
{
tmp[numDigits] = '0';
++numDigits;
Expand Down
2 changes: 1 addition & 1 deletion src/giza-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ _giza_get_log_file (char *string, int len)
void
_giza_write_log_file (cairo_surface_t *surface)
{
char msg[80];
char msg[120];
char string[80];
_giza_get_log_file(string,sizeof(string));
sprintf(msg,"writing %s",string);
Expand Down
1 change: 0 additions & 1 deletion src/giza-render-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

static void _giza_colour_pixel (unsigned char *array, int pixNum, double pos);
static void _giza_colour_pixel_transparent (unsigned char *array, int pixNum, double pos);
static void _giza_colour_pixel_alpha (unsigned char *array, int pixNum, double pos, double alpha);
static void _giza_colour_pixel_index_alpha (unsigned char *array, int pixNum, int ci, double alpha);
void _giza_render (int sizex, int sizey, const double* data, int i1, int i2,
Expand Down
32 changes: 2 additions & 30 deletions src/giza-render.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ _giza_render (int sizex, int sizey, const double* data, int i1, int i2,
cairo_matrix_t mat;
int stride, pixnum, width = i2 - i1 + 1, height = j2 - j1 + 1;
int cimin, cimax;
double pos, alpha;

cairo_extend_t cairoextendtype;
_giza_get_extend(extend,&cairoextendtype);
Expand Down Expand Up @@ -162,12 +161,12 @@ _giza_render (int sizex, int sizey, const double* data, int i1, int i2,
}
} else if (transparent==1) {
/* render each pixel, using transparent routine */
int idx;
int idx;
for (j = j1; j <= j2; j++)
{
for (i = i1; i <= i2; i++)
{
idx = itf_idx(data[j*sizex + i], valMin, valMax, cimin, cimax);
idx = itf_idx(data[j*sizex + i], valMin, valMax, cimin, cimax);
_giza_colour_pixel_index_alpha (pixdata, pixnum, idx, idx==cimin ? 0. : 1.);
pixnum = pixnum + 1;
}
Expand Down Expand Up @@ -276,13 +275,6 @@ _giza_render_float (int sizex, int sizey, const float* data, int i1,
cairo_matrix_t mat;
int stride, pixnum, width = i2 - i1 + 1, height = j2 - j1 + 1;
int cimin, cimax;
double pos,alpha,ddval;
double dvalMin = (double) valMin;
if (valMax - valMin > 0.) {
ddval = 1./((double) valMax - dvalMin);
} else {
ddval = 0.;
}

cairo_extend_t cairoextendtype;
_giza_get_extend(extend,&cairoextendtype);
Expand Down Expand Up @@ -414,26 +406,6 @@ _giza_colour_pixel (unsigned char *array, int pixNum, double pos)
array[pixNum * 4 + 0] = (unsigned char) (b * 255.);
}

/**
* As in _giza_colour_pixel, but sets the pixels to be transparent if pos <= 0
*/
static void
_giza_colour_pixel_transparent (unsigned char *array, int pixNum, double pos)
{
double r, g, b;
giza_rgb_from_table (pos, &r, &g, &b);
/* set the alpha */
if (pos <= 0.) {
array[pixNum * 4 + 3] = 0.;
} else {
array[pixNum * 4 + 3] = 255.;
}
/* set the red, green, and blue */
array[pixNum * 4 + 2] = (unsigned char) (r * 255.);
array[pixNum * 4 + 1] = (unsigned char) (g * 255.);
array[pixNum * 4 + 0] = (unsigned char) (b * 255.);
}

/**
* As in _giza_colour_pixel, but takes an additional alpha parameter
*/
Expand Down
4 changes: 2 additions & 2 deletions test/C/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ LDADD = ../../src/libgiza.la

CLEANFILES = *.png *.pdf *.svg

ctests = test-arrow test-band test-box test-cairo-xw test-change-page \
ctests = test-arrow test-box test-cairo-xw test-change-page \
test-circle test-colour-index \
test-environment \
test-error-bars test-format-number test-giza-xw test-line-cap \
test-line-style test-openclose test-pdf test-png test-points \
test-qtext test-rectangle test-set-line-width \
test-svg test-vector test-window test-XOpenDisplay # test-contour test-render

#TESTS = $(ctests)
TESTS = $(ctests)
check_PROGRAMS = $(ctests)
Loading

0 comments on commit 1c4cb49

Please sign in to comment.