Commit a9dc96be authored by Morten Welinder's avatar Morten Welinder

Tests: add basic test for introspection.

parent 17f7b3e5
......@@ -9,6 +9,7 @@ Morten:
* Add GUI for comparing sheets.
* Introspection fixes.
* Clean up workbook view construction.
* Test suite improvements.
--------------------------------------------------------------------------
Gnumeric 1.12.39
......
......@@ -13,15 +13,18 @@ $| = 1;
test_csv_format_guessing
test_ssindex sstest test_command message subtest
test_tool
setup_python_environment
$ssconvert $sstest $ssdiff $ssgrep $gnumeric
$topsrc $top_builddir
$subtests $samples corpus $PERL);
$subtests $samples corpus $PERL $PYTHON);
@GnumericTest::EXPORT_OK = qw(junkfile);
use vars qw($topsrc $top_builddir $samples $default_subtests $default_corpus $PERL $verbose);
use vars qw($topsrc $top_builddir $samples $default_subtests $default_corpus $PERL $PYTHON $verbose);
use vars qw($ssconvert $ssindex $sstest $ssdiff $ssgrep $gnumeric);
use vars qw($normalize_gnumeric);
$PYTHON = undef;
$PERL = $Config{'perlpath'};
$PERL .= $Config{'_exe'} if $^O ne 'VMS' && $PERL !~ m/$Config{'_exe'}$/i;
......@@ -881,6 +884,16 @@ sub has_linear_solver {
# -----------------------------------------------------------------------------
sub setup_python_environment {
$PYTHON = '/usr/bin/python';
&report_skip ("Missing $PYTHON") unless -x $PYTHON;
# Make sure we load introspection preferentially from build directory
my $v = 'GI_TYPELIB_PATH';
my $dir = "$top_builddir/src";
$ENV{$v} = ($ENV{$v} || '') eq '' ? $dir : $dir . ':' . $ENV{$v};
}
sub quotearg {
return join (' ', map { &quotearg1 ($_) } @_);
}
......
......@@ -8,6 +8,8 @@
#
# 2xxx: Internal sstest
#
# 3xxx: Introspection tests
#
# 5xxx: Importers
# 5800: csv
# 59xx: Minor formats with import-db
......@@ -177,10 +179,24 @@ TESTS = t1000-statfuns.pl \
SUPPS = common.supp gui.supp t8003-valgrind-pdf.supp
INTROSPECTION_TSTS = \
t3000-introspection-basic.pl
INTROSPECTION_SUPPS = \
$(INTROSPECTION_TSTS:.pl=.py)
if HAVE_INTROSPECTION
TESTS += $(INTROSPECTION_TSTS)
SUPPS += $(INTROSPECTION_SUPPS)
endif
import-db:
for t in $(srcdir)/t59[0-9][0-9]-*.pl; do echo "*** $$t ***"; $(PERL) $$t create-db; done
EXTRA_DIST = GnumericTest.pm \
$(SUPPS) $(TESTS) \
$(INTROSPECTION_SUPPS) $(INTROSPECTION_TSTS) \
normalize-gnumeric \
ods-ext-schema.patch
EXTRA_DIST = GnumericTest.pm $(SUPPS) normalize-gnumeric ods-ext-schema.patch $(TESTS)
.PHONY: import-db $(TESTS)
.PHONY: import-db
.NOTPARALLEL:
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------
use strict;
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;
&setup_python_environment ();
my $python_script = $0;
$python_script =~ s/\.pl$/.py/;
&test_command ($PYTHON . ' ' . &GnumericTest::quotearg ($python_script),
sub { /^[-+.0-9]+$/ && abs ($_ - -0.253347103136) < 1e-10 });
#!/usr/bin/python
# -----------------------------------------------------------------------------
import gi
gi.require_version('Gnm', '1.12')
from gi.repository import Gnm
print Gnm.qnorm(0.4,0,1,1,0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment