Permalink
Browse files

Merge branch 'testsuite'

  • Loading branch information...
2 parents 04fd550 + c6924d5 commit 9ace4c842f4bceffaa0a8cc5efdc675cda63a71e @mskala committed Apr 3, 2012
Showing with 429 additions and 49 deletions.
  1. +40 −0 Makefile.am
  2. +35 −0 configure.ac
  3. +98 −0 test/gpmix
  4. +189 −49 test/run-tests
  5. +33 −0 test/strokenum
  6. +34 −0 test/xml
View
@@ -1,5 +1,41 @@
## Process this file with automake to produce Makefile.in
+#
+# Makefile description for KanjiVG
+# Copyright (C) 2012 Matthew Skala
+#
+# This program is dual licensed. At your option, you may follow either of
+# the two license notices below.
+#
+# Matthew Skala
+# http://ansuz.sooke.bc.ca/
+# mskala@ansuz.sooke.bc.ca
+#
+# GPL license:
+#
+# 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 the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Creative Commons license:
+#
+# This work is made available under the terms of the Creative Commons
+# Attribution-ShareAlike 3.0 license,
+# http://creativecommons.org/licenses/by-sa/3.0/.
+#
+
+########################################################################
+
+
ACLOCAL_AMFLAGS = -I m4
KANJI_NAMES := $(patsubst kanji/%.svg,%,$(wildcard kanji/*.svg))
@@ -20,3 +56,7 @@ kanjivg-@release_date@.xml.gz: kanjivg.xml
check:
rm -rf test_logs
$(PERL) -CDS test/run-tests
+
+# check only the SVG files that are newer than their logs
+check-new:
+ $(PERL) -CDS test/run-tests -n
View
@@ -1,6 +1,41 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
+#
+# configure script description for KanjiVG
+# Copyright (C) 2012 Matthew Skala
+#
+# This program is dual licensed. At your option, you may follow either of
+# the two license notices below.
+#
+# Matthew Skala
+# http://ansuz.sooke.bc.ca/
+# mskala@ansuz.sooke.bc.ca
+#
+# GPL license:
+#
+# 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 the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Creative Commons license:
+#
+# This work is made available under the terms of the Creative Commons
+# Attribution-ShareAlike 3.0 license,
+# http://creativecommons.org/licenses/by-sa/3.0/.
+#
+
+########################################################################
+
AC_PREREQ([2.68])
AC_INIT([KanjiVG], [0.0], [kanjivg@googlegroups.com], [kanjivg],
[http://kanjivg.tagaini.net/])
View
@@ -0,0 +1,98 @@
+#!/usr/bin/perl -CDS
+
+#
+# KanjiVG per-kanji test
+# checks for nodes that have groups and paths as siblings
+# Copyright (C) 2012 Matthew Skala
+#
+# This program is dual licensed. At your option, you may follow either of
+# the two license notices below.
+#
+# Matthew Skala
+# http://ansuz.sooke.bc.ca/
+# mskala@ansuz.sooke.bc.ca
+#
+# GPL license:
+#
+# 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 the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Creative Commons license:
+#
+# This work is made available under the terms of the Creative Commons
+# Attribution-ShareAlike 3.0 license,
+# http://creativecommons.org/licenses/by-sa/3.0/.
+#
+
+########################################################################
+
+use XML::Parser;
+use utf8;
+
+$parser=new XML::Parser(Style=>'Tree');
+
+$parser->setHandlers(Char=>\&ignore_char);
+
+sub ignore_char { }
+
+$/=undef;
+open(SVG,'kanji/'.shift.'.svg');
+$_=<SVG>;
+close(SVG);
+$db=$parser->parse($_);
+
+$exit_code=0;
+
+($db->[0] eq 'svg') || die "unknown document tag";
+
+for ($i=1;$i<=$#{$db->[1]};$i+=2) {
+ next if $db->[1]->[$i] eq 0;
+ next if $db->[1]->[$i] ne 'g';
+ next if $db->[1]->[$i+1]->[0]->{'id'}=~/StrokeNumbers/;
+
+ $db->[1]->[$i+1]->[0]->{'id'}=~/StrokePaths/
+ || die 'unknown top-level group';
+ for ($j=1;$j<=$#{$db->[1]->[$i+1]};$j+=2) {
+ next if $db->[1]->[$i+1]->[$j] eq 0;
+ $db->[1]->[$i+1]->[$j] eq 'g'
+ || die 'unknown tag in top-level group';
+ $in_top_group<1 || die 'too many children in top-level group';
+ &process_group($db->[1]->[$i+1]->[$j+1]);
+ $in_top_group++;
+ }
+}
+
+sub process_group {
+ my($group)=@_;
+ my($i,$pcnt,$gcnt);
+
+ $pcnt=0;
+ $gcnt=0;
+ for ($i=1;$i<=$#$group;$i+=2) {
+ $pcnt++ if $group->[$i] eq 'path';
+ $gcnt++ if $group->[$i] eq 'g';
+ }
+
+ if (($pcnt>0) && ($gcnt>0)) {
+ print "Found $gcnt group".($gcnt>1?'s':'').
+ " and $pcnt path".($pcnt>1?'s':'').
+ " in the same node.\n";
+ $exit_code=1;
+ }
+
+ for ($i=1;$i<=$#$group;$i+=2) {
+ &process_group($group->[$i+1]) if $group->[$i] eq 'g';
+ }
+}
+
+exit $exit_code;
Oops, something went wrong.

0 comments on commit 9ace4c8

Please sign in to comment.