diff options
author | Dodji Seketeli <dodji@src.gnome.org> | 2003-02-27 19:11:25 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@src.gnome.org> | 2003-02-27 19:11:25 +0000 |
commit | 1bab70f1eff9d282467d6b9188d6f4f22fdd4e1b (patch) | |
tree | 2e89ee75d71eb8ece979b1560c209a2438e06a25 /tests | |
download | libcroco-1bab70f1eff9d282467d6b9188d6f4f22fdd4e1b.tar.gz |
Initial revision
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 17 | ||||
-rw-r--r-- | tests/Makefile.in | 395 | ||||
-rw-r--r-- | tests/core.17057 | bin | 0 -> 212992 bytes | |||
-rw-r--r-- | tests/core.17936 | bin | 0 -> 212992 bytes | |||
-rw-r--r-- | tests/cr-test-utils.c | 43 | ||||
-rw-r--r-- | tests/cr-test-utils.h | 54 | ||||
-rw-r--r-- | tests/more | 189 | ||||
-rw-r--r-- | tests/test-inputs/test2.1.css | 35 | ||||
-rw-r--r-- | tests/test-inputs/test2.2.css | 674 | ||||
-rw-r--r-- | tests/test-inputs/test2.css | 9 | ||||
-rw-r--r-- | tests/test-inputs/test3.1.css | 36 | ||||
-rw-r--r-- | tests/test-inputs/test3.2.css | 693 | ||||
-rw-r--r-- | tests/test-inputs/test3.css | 9 | ||||
-rw-r--r-- | tests/test-inputs/test4.1.css | 679 | ||||
-rw-r--r-- | tests/test-inputs/test4.2.css | 24 | ||||
-rw-r--r-- | tests/test-outputs/test4.1.out | 762 | ||||
-rw-r--r-- | tests/test0-main.c | 215 | ||||
-rw-r--r-- | tests/test1-main.c | 211 | ||||
-rw-r--r-- | tests/test2-main.c | 640 | ||||
-rw-r--r-- | tests/test3-main.c | 643 | ||||
-rw-r--r-- | tests/test4-main.c | 154 | ||||
-rw-r--r-- | tests/valgrind.log | 144 | ||||
-rwxr-xr-x | tests/vg | 15 |
23 files changed, 5641 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..20fa73c --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,17 @@ +#SUBDIRS=test-inputs + +noinst_PROGRAMS=test0 test1 test2 test3 test4 +test0_SOURCES=test0-main.c +test1_SOURCES=test1-main.c +test2_SOURCES=test2-main.c cr-test-utils.c cr-test-utils.h +test3_SOURCES=test3-main.c cr-test-utils.c cr-test-utils.h +test4_SOURCES=test4-main.c cr-test-utils.c cr-test-utils.h + +LDADD=$(top_srcdir)/src/libcroco.la + +INCLUDES=-I$(top_srcdir)/intl \ + -I$(top_srcdir)/src \ + `pkg-config --cflags glib-2.0` + +LDFLAGS=`pkg-config --libs glib-2.0` @LIBXML2_LIBS@ +AM_CFLAGS=-Wall -I.
\ No newline at end of file diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..72c68b6 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,395 @@ +# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +#SUBDIRS=test-inputs + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CROCO_CFLAGS = @CROCO_CFLAGS@ +CROCO_LIBS = @CROCO_LIBS@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LIBCROCO_MAJOR_VERSION = @LIBCROCO_MAJOR_VERSION@ +LIBCROCO_MICRO_VERSION = @LIBCROCO_MICRO_VERSION@ +LIBCROCO_MINOR_VERSION = @LIBCROCO_MINOR_VERSION@ +LIBCROCO_VERSION = @LIBCROCO_VERSION@ +LIBCROCO_VERSION_INFO = @LIBCROCO_VERSION_INFO@ +LIBCROCO_VERSION_NUMBER = @LIBCROCO_VERSION_NUMBER@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +REQUIRE_LIBXML2 = @REQUIRE_LIBXML2@ +STRIP = @STRIP@ +U = @U@ +VERSION = @VERSION@ +WITH_SELENG = @WITH_SELENG@ + +noinst_PROGRAMS = test0 test1 test2 test3 test4 +test0_SOURCES = test0-main.c +test1_SOURCES = test1-main.c +test2_SOURCES = test2-main.c cr-test-utils.c cr-test-utils.h +test3_SOURCES = test3-main.c cr-test-utils.c cr-test-utils.h +test4_SOURCES = test4-main.c cr-test-utils.c cr-test-utils.h + +LDADD = $(top_srcdir)/src/libcroco.la + +INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/src `pkg-config --cflags glib-2.0` + + +LDFLAGS = `pkg-config --libs glib-2.0` @LIBXML2_LIBS@ +AM_CFLAGS = -Wall -I. +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../libcroco-config.h +CONFIG_CLEAN_FILES = +noinst_PROGRAMS = test0$(EXEEXT) test1$(EXEEXT) test2$(EXEEXT) \ +test3$(EXEEXT) test4$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +CPPFLAGS = @CPPFLAGS@ +LIBS = @LIBS@ +test0_OBJECTS = test0-main.$(OBJEXT) +test0_LDADD = $(LDADD) +test0_DEPENDENCIES = $(top_srcdir)/src/libcroco.la +test0_LDFLAGS = +test1_OBJECTS = test1-main.$(OBJEXT) +test1_LDADD = $(LDADD) +test1_DEPENDENCIES = $(top_srcdir)/src/libcroco.la +test1_LDFLAGS = +test2_OBJECTS = test2-main.$(OBJEXT) cr-test-utils.$(OBJEXT) +test2_LDADD = $(LDADD) +test2_DEPENDENCIES = $(top_srcdir)/src/libcroco.la +test2_LDFLAGS = +test3_OBJECTS = test3-main.$(OBJEXT) cr-test-utils.$(OBJEXT) +test3_LDADD = $(LDADD) +test3_DEPENDENCIES = $(top_srcdir)/src/libcroco.la +test3_LDFLAGS = +test4_OBJECTS = test4-main.$(OBJEXT) cr-test-utils.$(OBJEXT) +test4_LDADD = $(LDADD) +test4_DEPENDENCIES = $(top_srcdir)/src/libcroco.la +test4_LDFLAGS = +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/cr-test-utils.P .deps/test0-main.P .deps/test1-main.P \ +.deps/test2-main.P .deps/test3-main.P .deps/test4-main.P +SOURCES = $(test0_SOURCES) $(test1_SOURCES) $(test2_SOURCES) $(test3_SOURCES) $(test4_SOURCES) +OBJECTS = $(test0_OBJECTS) $(test1_OBJECTS) $(test2_OBJECTS) $(test3_OBJECTS) $(test4_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-noinstPROGRAMS: + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +test0$(EXEEXT): $(test0_OBJECTS) $(test0_DEPENDENCIES) + @rm -f test0$(EXEEXT) + $(LINK) $(test0_LDFLAGS) $(test0_OBJECTS) $(test0_LDADD) $(LIBS) + +test1$(EXEEXT): $(test1_OBJECTS) $(test1_DEPENDENCIES) + @rm -f test1$(EXEEXT) + $(LINK) $(test1_LDFLAGS) $(test1_OBJECTS) $(test1_LDADD) $(LIBS) + +test2$(EXEEXT): $(test2_OBJECTS) $(test2_DEPENDENCIES) + @rm -f test2$(EXEEXT) + $(LINK) $(test2_LDFLAGS) $(test2_OBJECTS) $(test2_LDADD) $(LIBS) + +test3$(EXEEXT): $(test3_OBJECTS) $(test3_DEPENDENCIES) + @rm -f test3$(EXEEXT) + $(LINK) $(test3_LDFLAGS) $(test3_OBJECTS) $(test3_LDADD) $(LIBS) + +test4$(EXEEXT): $(test4_OBJECTS) $(test4_DEPENDENCIES) + @rm -f test4$(EXEEXT) + $(LINK) $(test4_LDFLAGS) $(test4_OBJECTS) $(test4_LDADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = tests + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tests/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-noinstPROGRAMS clean-compile clean-libtool clean-tags \ + clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-noinstPROGRAMS distclean-compile \ + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-noinstPROGRAMS \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \ +clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/core.17057 b/tests/core.17057 Binary files differnew file mode 100644 index 0000000..9839108 --- /dev/null +++ b/tests/core.17057 diff --git a/tests/core.17936 b/tests/core.17936 Binary files differnew file mode 100644 index 0000000..a57d90f --- /dev/null +++ b/tests/core.17936 diff --git a/tests/cr-test-utils.c b/tests/cr-test-utils.c new file mode 100644 index 0000000..b39419e --- /dev/null +++ b/tests/cr-test-utils.c @@ -0,0 +1,43 @@ +#include <string.h> +#include "cr-test-utils.h" + +/** + *Parses the command line. + *@param a_argc the argc parameter of the main routine. + *@param the argv parameter of the main routine. + *@param a_options out parameter the parsed options. + */ +void +cr_test_utils_parse_cmd_line (int a_argc, char **a_argv, + struct Options *a_options) +{ + int i= 0 ; + + g_return_if_fail (a_options) ; + + memset (a_options, 0, sizeof (struct Options)) ; + + for (i = 1 ; i < a_argc ; i++) + { + if (a_argv[i][0] != '-') break ; + + if (!strcmp (a_argv[i], "-h") || !strcmp (a_argv[i], "--help")) + { + a_options->display_help = TRUE ; + } + if (!strcmp (a_argv[i], "--about")) + { + a_options->display_about = TRUE ; + } + } + + if (i >= a_argc) + { + /*No file parameter where given*/ + a_options->files_list = NULL ; + } + else + { + a_options->files_list = &a_argv[i] ; + } +} diff --git a/tests/cr-test-utils.h b/tests/cr-test-utils.h new file mode 100644 index 0000000..579e6ca --- /dev/null +++ b/tests/cr-test-utils.h @@ -0,0 +1,54 @@ +/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */ + +/* + *This file is part of the Croco Library + * + *The Croco Library 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 2, + *or (at your option) any later version. + * + *The Croco Library 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 The Croco Library; + *see the file COPYING. If not, write to + *the Free Software Foundation, Inc., + *59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *Copyright 2002-2003 Dodji Seketeli <dodji@seketeli.org> + */ + +/* + *$Id$ + */ +#ifndef __CR_TEST_UTILS_H__ +#define __CR_TEST_UTILS_H__ + +#include <stdio.h> +#include <glib.h> + +/** + *The options data structure. + *The variable of this data structure are set + *during the parsing the command line by the + *parse_command_line() function. + */ +struct Options +{ + gboolean display_help ; + gboolean display_about ; + gchar ** files_list ; +}; + + +void +cr_test_utils_parse_cmd_line (int a_argc, char **a_argv, + struct Options *a_options) ; + +#endif /*__CR_TEST_UTILS_H__*/ diff --git a/tests/more b/tests/more new file mode 100644 index 0000000..dc336d6 --- /dev/null +++ b/tests/more @@ -0,0 +1,189 @@ +*************** +start_document +*************** + +*************** +start_selector +h1.rubrique_info +*************** + +*************** +property +color: #990033 +*************** + +*************** +property +margin: 0px 0px 0px 0px +*************** + +*************** +property +padding: 0em +*************** + +*************** +property +border: 0px +*************** + +*************** +property +font-size: 12px +*************** + +*************** +end_selector +h1.rubrique_info +*************** + +*************** +start_selector +* +*************** + +*************** +property +font-family: Verdana, Arial, Helvetica, sans-serif, monospace +*************** + +*************** +end_selector +* +*************** + +*************** +start_selector +body +*************** + +*************** +property +background: #606060 +*************** + +*************** +property +color: #000000 +*************** + +*************** +end_selector +body +*************** + +*************** +start_selector +a:link +*************** + +*************** +property +color: #0000FF +*************** + +*************** +property +background: transparent +*************** + +*************** +property +text-decoration: none +*************** + +*************** +end_selector +a:link +*************** + +*************** +start_selector +a:visited +*************** + +*************** +property +color: #990099 +*************** + +*************** +property +background: transparent +*************** + +*************** +property +text-decoration: none +*************** + +*************** +end_selector +a:visited +*************** + +*************** +start_selector +a:active +*************** + +*************** +property +color: #000000 +*************** + +*************** +property +background: #ADD8E6 +*************** + +*************** +property +text-decoration: none +*************** + +*************** +end_selector +a:active +*************** + +*************** +start_selector +h1.rubrique_info +*************** + +*************** +property +color: #990033 +*************** + +*************** +property +margin: 0px 0px 0px 0px +*************** + +*************** +property +padding: 0em +*************** + +*************** +property +border: 0px +*************** + +*************** +property +font-size: 12px +*************** + +*************** +end_selector +h1.rubrique_info +*************** + +*************** +end_document +*************** + +OK diff --git a/tests/test-inputs/test2.1.css b/tests/test-inputs/test2.1.css new file mode 100644 index 0000000..7b3e88c --- /dev/null +++ b/tests/test-inputs/test2.1.css @@ -0,0 +1,35 @@ + +/*simple Attribute set selectors*/ +s1[foo] {prop1 : value1} + +/*simple exact attribute selector, simple ruleset*/ +s1[foo="warning"] {prop1 : value1} + +/** + *"space separated value list" + *attribute selector, simple ruleset + */ +s1[foo~="warning"] {prop1 :value1} + +/** + *"hyphen separated value list" attribute selector, + * simple ruleset + */ + + /*simple class selector, simple ruleset*/ + s1.warning {prop1 : value} + + E#myid {prop1 : value1} + + +/*below are tests that we know are working*/ + +/*simple ident pseudo class selector, simple ruleset test*/ +S1:first-child {prop1 : value1 ; prop2 : value2} + +/*function pseudo class selector, simple ruleset test*/ +S1:lang(c) {prop1 : value1} + +/*Adjacent selectors, simple ruleset test*/ +S1 + s2 {prop1: value1} + diff --git a/tests/test-inputs/test2.2.css b/tests/test-inputs/test2.2.css new file mode 100644 index 0000000..658e545 --- /dev/null +++ b/tests/test-inputs/test2.2.css @@ -0,0 +1,674 @@ +* { + font-family: Verdana, Arial, Helvetica, sans-serif, monospace; +} + +body { + background: #606060; + color: #000000; +} + +a:link { + color: #0000FF; + background: transparent; + text-decoration: none; +} + +a:visited { + color: #990099; + background: transparent; + text-decoration: none; +} + + +a:active { + color: #000000; + background: #ADD8E6; + text-decoration: none; +} + +h1.rubrique_info { + color: #990033; + margin: 0px 0px 0px 0px; + padding: 0em; + border: 0px; + font-size: 12px; +} +h1.connexe { + font-size: 12px; + padding: 0em; + margin: 0px 0px 0px 0px; + color: #990033; +} + +a.rubrique_infolink { + text-decoration: none; +} + +ul.rubrique_infoul { + display: inline; + list-style-type: square; +} +ul.rubrique_infoul * { + width: 100%; +} +li.rubrique_infoul { + margin-left: 15px; +} +h1 { + color: #990033; +} + +div.main { + background: white; + color: #000000; + margin-left: 5px; + margin-right: 5px; + border: 1px black solid; + text-align: left; + font-size: 12px; +} +div.lsfnbanner { + margin-left: 150px; + margin-right: 170px; + border-top: none; + padding-left: 10px; + padding-right: 10px; + border-bottom: 1px black solid; + border-right: 1px black solid; + border-left: 1px black solid; + text-align: left; + font-size: 11px; + padding-top: 2px; + background-color: #eeeae6; +} +div.footer { + padding-top: 5px; + padding-bottom: 3px; + border-top: 1px black solid; + border-left: 1px black solid; + border-right: 1px black solid; + text-align: left; + font-size: 9px; + background: #dcdff4; + width: 600px; + margin-top: 40px; + margin-left: 20px; +} +div.footer p { + margin-left: 10px; + margin-top: 2px; + margin-bottom: 2px; +} + +a.lsfnlink:link,a.lsfnlink:visited,a.lsfnlink:active { + text-decoration: none; + color: #333333; + font-size: 10px; +} +a.lsfnlink:hover { + text-decoration: underline; + color: black; +} +div.menubartop { + margin-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + font-size: 13px; +} +div.smallmenubar { + background: white; + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + padding-bottom: 0px; + font-weight:bold; + font-size: 10px; + text-align: right; +} +div.menuevent { + float: left; + width: 350px; + font-size: 11px; + text-align: left; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 10px; + font-weight: bold; + margin: 0px; +} +div.menubar { + background: #cac2a8; + border-top: 1px black solid; + border-bottom: 1px black solid; + padding-left: 10px; + padding-right: 10px; + padding-top: 3px; + padding-bottom: 2px; + font-weight:bold; + font-size: 13px; +} +div.menubar a { + text-decoration: none; +} +div.menudate { + float: left; + width: 130px; + padding-top: 5px; +} +div.menuaccroche { + margin-left: 30px; + float: left; + text-decoration: underline; + font-size: 14px; +} +div.menusearch { + float: right; + text-align: right; + padding-top: 5px; + width: 170px; +} +div.menusearch p { + margin: 0px 0px 0px 0px; +} +.searchinput { + border: solid 1px black; +} +a#menulinkselect { + color: #ed7e00; +} + +div.leftbox { + width: 200px; + float: left; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; + border-right: 1px black solid; + border-bottom: 1px black solid; + background: white; + margin-bottom: 10px; +} +div.leftbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.leftbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.leftbox ul { + list-style-type: square; + margin-bottom: 10px; + margin-left: 0em; + padding-left: 0em; +} +div.leftbox li { + margin-left: 10px; +} + +div.rightbox { + width: 150px; + float: right; + padding-top: 10px; + padding-left: 5px; + padding-right: 15px; + padding-bottom: 5px; + border-left: 1px black solid; + border-bottom: 1px black solid; + text-align: left; +} +div.newjournaldiv { + text-align: justify; + margin-left: 10%; + font-size: 12px; + width: 600px; +} +div.newjournaldiv p { + margin-bottom: 0px; + margin-top: 20px; +} +div.journaldiv { + margin-left: 0px; + margin-right: 0px; + margin-top: 20px; + margin-bottom: 20px; + border: 1px black solid; + padding-top: 5px; + padding-bottom: 5px; + padding-right: 10px; + padding-left: 10px; + background-color: #eef; +} +div.journaldiv p { + margin-top: 10px; + margin-bottom: 0px; +} +div.journaldiv h1 { + color: #990033; + font-size: 14px; + margin: 0px; +} +div.journaldiv h2 { + font-size: 10px; + margin: 0px; +} +div.tipdiv { + margin-left: 220px; + margin-right: 50px; + margin-top: 20px; + padding-top: 5px; + padding-right: 10px; + padding-left: 10px; + text-align: justify; + background-color: #eee; + border: black solid 1px; +} +div.tipdiv h1 { + font-weight: bold; + font-size: 14px; + color: black; + margin-top: 0px; + margin-bottom: 20px; +} +div.tipdiv h2 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 12px; + margin: 0px; +} + +div.newsdiv { + margin-left: 220px; + margin-right: 180px; + margin-top: 10px; + margin-bottom: 20px; + text-align: justify; +} +div.newsdiv h1 { + font-weight: bold; + font-size: 14px; + margin: 0px; +} +div.newsdiv h2 { + font-weight: normal; + font-size: 12px; + margin: 0px; +} +div.newsdiv h3 { + font-weight: normal; + font-size: 12px; + margin-bottom: 20px; +} +div.objdiv { + margin-left: 220px; + margin-right: 20px; + margin-top: 10px; + margin-bottom: 20px; +} + +h1.newstitle { + text-align: left; + font-size: 14px; + margin: 0px 0px 0px 0px; + color: black; +} +div.titlediv { + border-top: solid #cac2a8 2px; + margin-top: 20px; + background-color: #eeeae6; + padding-left: 10px; + font-size: 11px; +} +div.bodydiv { + border: solid #9e9784 1px; + padding-left: 10px; + padding-right: 10px; + padding-top: 10px; + padding-bottom: 5px; + margin-top: 2px; + text-align: justify; +} + +div.comments { + padding: 10px; + border-top: solid 2px #d37537; + border-bottom: solid 2px #d37537; + margin-top: 20px; + margin-bottom: 10px; + background-color: #cacaca; + font-size: 12px; + line-height: 1.3em; +} + +p.commentsbody { + border-left-style: solid; + border-width: 1px; + border-color: rgb(0, 0, 0); + padding-left: 10px; + text-align: justify; + margin-right: 20px; +} + +div.commentsreply { + margin-left: 220px; + text-align: center; + margin-top: 50px; +} + +ul.commentsul { + list-style-type: none; + margin-bottom: 10px; + margin-left: 1.25em; + padding-left: 0em; + border-left: 1px solid black; +} +ul.commentsli { + margin: 10px; +} +div.comments li { + margin-top: 20px; + margin-left: 2px; +} + +div.comments h1 { + font-size: 12px; + color: black; + margin: 0px 20px 3px 0px; + background-color: rgb(226, 226, 226); + padding-left: 1px; + font-weight: none; +} + +div.articlediv { + padding-left: 20px; + padding-right: 20px; + padding-top: 10px; + padding-bottom: 20px; + margin-right: 10px; + margin-left: 220px; + border: solid 1px black; + margin-top: 10px; + text-align: justify; + background-color: #E2E2E2; +} +img { + border: 0px; +} +div.sectionimg { + float: left; + margin-right: 10px; + margin-top: 5px; +} +p.hautpage { + margin-top: 20px; + margin-bottom: 20px; + margin-left: 10px; +} +div.leftcol { + width: 202px; + width: 202px; + float: left; + padding: 0px; +} +div.logodiv { + border-right: 1px black solid; + border-bottom: 1px black solid; + padding: 0px; + line-height: 0px +} +div.loginbox { + margin-left: 4px; + border: solid #a59f8b 1px; + margin-top: 2px; + padding: 5px; + background-color: #fff2e8; + font-size: 10px; +} +div.loginbox p { + margin: 0px; + padding: 0px; +} +div.loginbox ul { + margin-left: 10px; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; + list-style-type: none; +} +div.loginbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.loginbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.loginbox h3 { + margin-top: 0px; + margin-bottom: 5px; + font-size: 12px; +} +div.polldivtitle { + margin-bottom: 1px; + background-color: #cac2a8; + margin-left: 4px; + margin-top: 15px; + padding-left: 5px; + font-size: 10px; + border-top: solid #a59f8b 1px; + border-bottom: solid #a59f8b 1px; + text-transform: uppercase; +} +div.polldiv { + margin-left: 4px; + border: 1px #a59f8b solid; + margin-top: 0px; + padding: 5px; + background: #fff2e8; +} +div.polldiv p { +margin: 5px; padding: 0px; +} +div.polldiv ul { + margin-left: 5px; + margin-top: 0px; + margin-bottom: 10px; + padding: 0px; + list-style-type: none; +} +div.otherboxtitle { + margin-bottom: 2px; + background-color: #e3dabc; + margin-left: 4px; + margin-top: 15px; + padding-left: 5px; + padding-top: 2px; + font-size: 11px; + border-top: solid #777364 1px; + border-bottom: solid #777364 1px; + text-transform: uppercase; + font-weight: bold; +} +div.otherbox { + margin-left: 4px; + border: 1px #a59f8b solid; + margin-top: 0px; + padding: 5px; + text-align: justify; + background: #fff2e8; + font-size: 10px; +} +div.otherbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.otherbox h2 { + font-weight: bold; + font-size: 11px; + margin: 0px; +} +div.otherbox p { + margin-top: 5px; + margin-bottom: 10px; +} +div.rightlogo { + width: 90px; + float: right; + margin-right: 0px; + padding-top: 0px; + padding-left: 0px; + padding-bottom: 0px; +} +div.centraldiv { + margin-left: 220px; + margin-right: 10px; + margin-bottom: 20px; + margin-top: 10px; +} +div.centraldiv h1 { + font-weight: bold; + font-size: 14px; + margin: 0px; +} +div.centraldiv h2 { + font-weight: normal; + font-size: 12px; + margin: 0px; +} +div.centraldiv h3 { + font-weight: normal; + font-size: 12px; + margin-bottom: 20px; +} +div.centralinfo { + position:relative; + height:160px; +} +div.lefttopbox { + position:relative; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; + border: 1px #a59f8b solid; + text-align: justify; + background: #fff2e8; + font-size: 12px; + width: 47%; + float: left; +} +div.lefttopbox p { + margin-top: 5px; margin-bottom: 10px; +} +div.lefttopbox h1 { + font-size: 13px; + font-weight: bold; + margin: 0px; + text-align: right; +} +div.lefttopbox h2 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.lefttopbox h3 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.righttopbox { + position:relative; + border: 1px #a59f8b solid; + background: white; + padding: 5px; + text-align: justify; + font-size: 12px; + width: 47%; + float: right; +} +div.righttopbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.righttopbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.boardindex { + text-align: justify; + font-size: 11px; + padding: 10px; + margin-left: 20px; + margin-right: 20px; +} +a.boardindex:link,a.boardindex:visited,a.boardindex:active { + text-decoration:none; + color: red; +} +div.boardleftmsg { + float: left; + margin-top: 3px; +} +div.boardrightmsg { + margin-left: 130px; + margin-top: 3px; + padding-left: 5px; +} +div.journalbody { + margin-left: 40px; + margin-top: 40px; +} +div.journalbody h1 { + font-size: 15px; + font-weight: bold; +} +div.journalbody p { + margin-bottom: 20px; +} +.formulaire { + border: solid 1px black; +font-size: 12px; +background-color: #eef; +color: #000000; +} +.newcomments { + color: red; + font-weight: bold; +} +div.commentsreplythanks { + margin-left: 100px; + margin-top: 50px; + margin-right: 100px; + background-color: #eee; + border: black solid 1px; + padding: 10px; +} +div.archivediv { + margin-right: 20px; +} +.archivedate { + color:#f30; +} +.archivelink { + font-size: 14px; + font-weight: bold; + text-decoration: underline; +} diff --git a/tests/test-inputs/test2.css b/tests/test-inputs/test2.css new file mode 100644 index 0000000..2442048 --- /dev/null +++ b/tests/test-inputs/test2.css @@ -0,0 +1,9 @@ + +/*simple selector and simple rulset test*/ +S1 {prop1 : value1} + +/*Simple selector list and simple ruleset test*/ +s1,s2 {color: black ; background: white} + +/*descendants and child selector list, simple ruleset test*/ +s1 s2, S3 > s4 {prop1 : value1 ; prop2 : value2} diff --git a/tests/test-inputs/test3.1.css b/tests/test-inputs/test3.1.css new file mode 100644 index 0000000..9c53843 --- /dev/null +++ b/tests/test-inputs/test3.1.css @@ -0,0 +1,36 @@ +S1:lang(c) {prop1 : value1} + +/*simple Attribute set selectors*/ +s1[foo] {prop1 : value1} + +/*simple exact attribute selector, simple ruleset*/ +s1[foo="warning"] {prop1 : value1} + +/** + *"space separated value list" + *attribute selector, simple ruleset + */ +s1[foo~="warning"] {prop1 :value1} + +/** + *"hyphen separated value list" attribute selector, + * simple ruleset + */ + + /*simple class selector, simple ruleset*/ + s1.warning {prop1 : value} + + E#myid {prop1 : value1} + + +/*below are tests that we know are working*/ + +/*simple ident pseudo class selector, simple ruleset test*/ +S1:first-child {prop1 : value1 ; prop2 : value2} + +/*function pseudo class selector, simple ruleset test => merdoie*/ +S1:lang(c) {prop1 : value1} + +/*Adjacent selectors, simple ruleset test*/ +S1 + s2 {prop1: value1} + diff --git a/tests/test-inputs/test3.2.css b/tests/test-inputs/test3.2.css new file mode 100644 index 0000000..2857fc4 --- /dev/null +++ b/tests/test-inputs/test3.2.css @@ -0,0 +1,693 @@ +h1.rubrique_info { + color: #990033; + margin: 0px 0px 0px 0px; + padding: 0em; + border: 0px; + font-size: 12px; +} + +* { + font-family: Verdana, Arial, Helvetica, sans-serif, monospace; +} + +body { + background: #606060; + color: #000000; +} + +a:link { + color: #0000FF; + background: transparent; + text-decoration: none; +} + +a:visited { + color: #990099; + background: transparent; + text-decoration: none; +} + + +a:active { + color: #000000; + background: #ADD8E6; + text-decoration: none; +} + + +h1.rubrique_info { + color: #990033; + margin: 0px 0px 0px 0px; + padding: 0em; + border: 0px; + font-size: 12px; +} + +/* +h1.connexe { + font-size: 12px; + padding: 0em; + margin: 0px 0px 0px 0px; + color: #990033; +} + + +a.rubrique_infolink { + text-decoration: none; +} + + +ul.rubrique_infoul { + display: inline; + list-style-type: square; +} + + +ul.rubrique_infoul * { + width: 100%; +} + +li.rubrique_infoul { + margin-left: 15px; +} +h1 { + color: #990033; +} + +div.main { + background: white; + color: #000000; + margin-left: 5px; + margin-right: 5px; + border: 1px black solid; + text-align: left; + font-size: 12px; +} +div.lsfnbanner { + margin-left: 150px; + margin-right: 170px; + border-top: none; + padding-left: 10px; + padding-right: 10px; + border-bottom: 1px black solid; + border-right: 1px black solid; + border-left: 1px black solid; + text-align: left; + font-size: 11px; + padding-top: 2px; + background-color: #eeeae6; +} +div.footer { + padding-top: 5px; + padding-bottom: 3px; + border-top: 1px black solid; + border-left: 1px black solid; + border-right: 1px black solid; + text-align: left; + font-size: 9px; + background: #dcdff4; + width: 600px; + margin-top: 40px; + margin-left: 20px; +} +div.footer p { + margin-left: 10px; + margin-top: 2px; + margin-bottom: 2px; +} + +a.lsfnlink:link,a.lsfnlink:visited,a.lsfnlink:active { + text-decoration: none; + color: #333333; + font-size: 10px; +} +a.lsfnlink:hover { + text-decoration: underline; + color: black; +} +div.menubartop { + margin-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + font-size: 13px; +} +div.smallmenubar { + background: white; + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + padding-bottom: 0px; + font-weight:bold; + font-size: 10px; + text-align: right; +} + +div.menuevent { + float: left; + width: 350px; + font-size: 11px; + text-align: left; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 10px; + font-weight: bold; + margin: 0px; +} +div.menubar { + background: #cac2a8; + border-top: 1px black solid; + border-bottom: 1px black solid; + padding-left: 10px; + padding-right: 10px; + padding-top: 3px; + padding-bottom: 2px; + font-weight:bold; + font-size: 13px; +} +div.menubar a { + text-decoration: none; +} +div.menudate { + float: left; + width: 130px; + padding-top: 5px; +} +div.menuaccroche { + margin-left: 30px; + float: left; + text-decoration: underline; + font-size: 14px; +} +div.menusearch { + float: right; + text-align: right; + padding-top: 5px; + width: 170px; +} +div.menusearch p { + margin: 0px 0px 0px 0px; +} +.searchinput { + border: solid 1px black; +} +a#menulinkselect { + color: #ed7e00; +} + +div.leftbox { + width: 200px; + float: left; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; + border-right: 1px black solid; + border-bottom: 1px black solid; + background: white; + margin-bottom: 10px; +} +div.leftbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.leftbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.leftbox ul { + list-style-type: square; + margin-bottom: 10px; + margin-left: 0em; + padding-left: 0em; +} +div.leftbox li { + margin-left: 10px; +} + +div.rightbox { + width: 150px; + float: right; + padding-top: 10px; + padding-left: 5px; + padding-right: 15px; + padding-bottom: 5px; + border-left: 1px black solid; + border-bottom: 1px black solid; + text-align: left; +} +div.newjournaldiv { + text-align: justify; + margin-left: 10%; + font-size: 12px; + width: 600px; +} +div.newjournaldiv p { + margin-bottom: 0px; + margin-top: 20px; +} +div.journaldiv { + margin-left: 0px; + margin-right: 0px; + margin-top: 20px; + margin-bottom: 20px; + border: 1px black solid; + padding-top: 5px; + padding-bottom: 5px; + padding-right: 10px; + padding-left: 10px; + background-color: #eef; +} +div.journaldiv p { + margin-top: 10px; + margin-bottom: 0px; +} +div.journaldiv h1 { + color: #990033; + font-size: 14px; + margin: 0px; +} +div.journaldiv h2 { + font-size: 10px; + margin: 0px; +} +div.tipdiv { + margin-left: 220px; + margin-right: 50px; + margin-top: 20px; + padding-top: 5px; + padding-right: 10px; + padding-left: 10px; + text-align: justify; + background-color: #eee; + border: black solid 1px; +} +div.tipdiv h1 { + font-weight: bold; + font-size: 14px; + color: black; + margin-top: 0px; + margin-bottom: 20px; +} +div.tipdiv h2 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 12px; + margin: 0px; +} + +div.newsdiv { + margin-left: 220px; + margin-right: 180px; + margin-top: 10px; + margin-bottom: 20px; + text-align: justify; +} +div.newsdiv h1 { + font-weight: bold; + font-size: 14px; + margin: 0px; +} +div.newsdiv h2 { + font-weight: normal; + font-size: 12px; + margin: 0px; +} +div.newsdiv h3 { + font-weight: normal; + font-size: 12px; + margin-bottom: 20px; +} +div.objdiv { + margin-left: 220px; + margin-right: 20px; + margin-top: 10px; + margin-bottom: 20px; +} + +h1.newstitle { + text-align: left; + font-size: 14px; + margin: 0px 0px 0px 0px; + color: black; +} +div.titlediv { + border-top: solid #cac2a8 2px; + margin-top: 20px; + background-color: #eeeae6; + padding-left: 10px; + font-size: 11px; +} +div.bodydiv { + border: solid #9e9784 1px; + padding-left: 10px; + padding-right: 10px; + padding-top: 10px; + padding-bottom: 5px; + margin-top: 2px; + text-align: justify; +} + +div.comments { + padding: 10px; + border-top: solid 2px #d37537; + border-bottom: solid 2px #d37537; + margin-top: 20px; + margin-bottom: 10px; + background-color: #cacaca; + font-size: 12px; + line-height: 1.3em; +} + +p.commentsbody { + border-left-style: solid; + border-width: 1px; + border-color: rgb(0, 0, 0); + padding-left: 10px; + text-align: justify; + margin-right: 20px; +} + +div.commentsreply { + margin-left: 220px; + text-align: center; + margin-top: 50px; +} + +ul.commentsul { + list-style-type: none; + margin-bottom: 10px; + margin-left: 1.25em; + padding-left: 0em; + border-left: 1px solid black; +} +ul.commentsli { + margin: 10px; +} +div.comments li { + margin-top: 20px; + margin-left: 2px; +} + +div.comments h1 { + font-size: 12px; + color: black; + margin: 0px 20px 3px 0px; + background-color: rgb(226, 226, 226); + padding-left: 1px; + font-weight: none; +} + +div.articlediv { + padding-left: 20px; + padding-right: 20px; + padding-top: 10px; + padding-bottom: 20px; + margin-right: 10px; + margin-left: 220px; + border: solid 1px black; + margin-top: 10px; + text-align: justify; + background-color: #E2E2E2; +} +img { + border: 0px; +} +div.sectionimg { + float: left; + margin-right: 10px; + margin-top: 5px; +} +p.hautpage { + margin-top: 20px; + margin-bottom: 20px; + margin-left: 10px; +} +div.leftcol { + width: 202px; + width: 202px; + float: left; + padding: 0px; +} +div.logodiv { + border-right: 1px black solid; + border-bottom: 1px black solid; + padding: 0px; + line-height: 0px +} +div.loginbox { + margin-left: 4px; + border: solid #a59f8b 1px; + margin-top: 2px; + padding: 5px; + background-color: #fff2e8; + font-size: 10px; +} +div.loginbox p { + margin: 0px; + padding: 0px; +} +div.loginbox ul { + margin-left: 10px; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; + list-style-type: none; +} +div.loginbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.loginbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.loginbox h3 { + margin-top: 0px; + margin-bottom: 5px; + font-size: 12px; +} +div.polldivtitle { + margin-bottom: 1px; + background-color: #cac2a8; + margin-left: 4px; + margin-top: 15px; + padding-left: 5px; + font-size: 10px; + border-top: solid #a59f8b 1px; + border-bottom: solid #a59f8b 1px; + text-transform: uppercase; +} +div.polldiv { + margin-left: 4px; + border: 1px #a59f8b solid; + margin-top: 0px; + padding: 5px; + background: #fff2e8; +} +div.polldiv p { +margin: 5px; padding: 0px; +} +div.polldiv ul { + margin-left: 5px; + margin-top: 0px; + margin-bottom: 10px; + padding: 0px; + list-style-type: none; +} +div.otherboxtitle { + margin-bottom: 2px; + background-color: #e3dabc; + margin-left: 4px; + margin-top: 15px; + padding-left: 5px; + padding-top: 2px; + font-size: 11px; + border-top: solid #777364 1px; + border-bottom: solid #777364 1px; + text-transform: uppercase; + font-weight: bold; +} +div.otherbox { + margin-left: 4px; + border: 1px #a59f8b solid; + margin-top: 0px; + padding: 5px; + text-align: justify; + background: #fff2e8; + font-size: 10px; +} +div.otherbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.otherbox h2 { + font-weight: bold; + font-size: 11px; + margin: 0px; +} +div.otherbox p { + margin-top: 5px; + margin-bottom: 10px; +} +div.rightlogo { + width: 90px; + float: right; + margin-right: 0px; + padding-top: 0px; + padding-left: 0px; + padding-bottom: 0px; +} +div.centraldiv { + margin-left: 220px; + margin-right: 10px; + margin-bottom: 20px; + margin-top: 10px; +} +div.centraldiv h1 { + font-weight: bold; + font-size: 14px; + margin: 0px; +} +div.centraldiv h2 { + font-weight: normal; + font-size: 12px; + margin: 0px; +} +div.centraldiv h3 { + font-weight: normal; + font-size: 12px; + margin-bottom: 20px; +} +div.centralinfo { + position:relative; + height:160px; +} +div.lefttopbox { + position:relative; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; + border: 1px #a59f8b solid; + text-align: justify; + background: #fff2e8; + font-size: 12px; + width: 47%; + float: left; +} +div.lefttopbox p { + margin-top: 5px; margin-bottom: 10px; +} +div.lefttopbox h1 { + font-size: 13px; + font-weight: bold; + margin: 0px; + text-align: right; +} +div.lefttopbox h2 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.lefttopbox h3 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.righttopbox { + position:relative; + border: 1px #a59f8b solid; + background: white; + padding: 5px; + text-align: justify; + font-size: 12px; + width: 47%; + float: right; +} +div.righttopbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.righttopbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.boardindex { + text-align: justify; + font-size: 11px; + padding: 10px; + margin-left: 20px; + margin-right: 20px; +} +a.boardindex:link,a.boardindex:visited,a.boardindex:active { + text-decoration:none; + color: red; +} +div.boardleftmsg { + float: left; + margin-top: 3px; +} +div.boardrightmsg { + margin-left: 130px; + margin-top: 3px; + padding-left: 5px; +} +div.journalbody { + margin-left: 40px; + margin-top: 40px; +} +div.journalbody h1 { + font-size: 15px; + font-weight: bold; +} +div.journalbody p { + margin-bottom: 20px; +} + +.formulaire { + border: solid 1px black; +font-size: 12px; +background-color: #eef; +color: #000000; +} +.newcomments { + color: red; + font-weight: bold; +} +div.commentsreplythanks { + margin-left: 100px; + margin-top: 50px; + margin-right: 100px; + background-color: #eee; + border: black solid 1px; + padding: 10px; +} +div.archivediv { + margin-right: 20px; +} +.archivedate { + color:#f30; +} +.archivelink { + font-size: 14px; + font-weight: bold; + text-decoration: underline; +} +*/
\ No newline at end of file diff --git a/tests/test-inputs/test3.css b/tests/test-inputs/test3.css new file mode 100644 index 0000000..2442048 --- /dev/null +++ b/tests/test-inputs/test3.css @@ -0,0 +1,9 @@ + +/*simple selector and simple rulset test*/ +S1 {prop1 : value1} + +/*Simple selector list and simple ruleset test*/ +s1,s2 {color: black ; background: white} + +/*descendants and child selector list, simple ruleset test*/ +s1 s2, S3 > s4 {prop1 : value1 ; prop2 : value2} diff --git a/tests/test-inputs/test4.1.css b/tests/test-inputs/test4.1.css new file mode 100644 index 0000000..ba128d4 --- /dev/null +++ b/tests/test-inputs/test4.1.css @@ -0,0 +1,679 @@ +* { + font-family: Verdana, Arial, Helvetica, sans-serif, monospace; +} + + +body { + background: #606060; + color: #000000; +} + + +a:link { + color: #0000FF; + background: transparent; + text-decoration: none; +} + + +a:visited { + color: #990099; + background: transparent; + text-decoration: none; +} + + +a:active { + color: #000000; + background: #ADD8E6; + text-decoration: none; +} + +h1.rubrique_info { + color: #990033; + margin: 0px 0px 0px 0px; + padding: 0em; + border: 0px; + font-size: 12px; +} +h1.connexe { + font-size: 12px; + padding: 0em; + margin: 0px 0px 0px 0px; + color: #990033; +} + +a.rubrique_infolink { + text-decoration: none; +} + +ul.rubrique_infoul { + display: inline; + list-style-type: square; +} +ul.rubrique_infoul * { + width: 100%; +} +li.rubrique_infoul { + margin-left: 15px; +} +h1 { + color: #990033; +} + +div.main { + background: white; + color: #000000; + margin-left: 5px; + margin-right: 5px; + border: 1px black solid; + text-align: left; + font-size: 12px; +} +div.lsfnbanner { + margin-left: 150px; + margin-right: 170px; + border-top: none; + padding-left: 10px; + padding-right: 10px; + border-bottom: 1px black solid; + border-right: 1px black solid; + border-left: 1px black solid; + text-align: left; + font-size: 11px; + padding-top: 2px; + background-color: #eeeae6; +} +div.footer { + padding-top: 5px; + padding-bottom: 3px; + border-top: 1px black solid; + border-left: 1px black solid; + border-right: 1px black solid; + text-align: left; + font-size: 9px; + background: #dcdff4; + width: 600px; + margin-top: 40px; + margin-left: 20px; +} +div.footer p { + margin-left: 10px; + margin-top: 2px; + margin-bottom: 2px; +} + +a.lsfnlink:link,a.lsfnlink:visited,a.lsfnlink:active { + text-decoration: none; + color: #333333; + font-size: 10px; +} +a.lsfnlink:hover { + text-decoration: underline; + color: black; +} +div.menubartop { + margin-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + font-size: 13px; +} +div.smallmenubar { + background: white; + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + padding-bottom: 0px; + font-weight:bold; + font-size: 10px; + text-align: right; +} +div.menuevent { + float: left; + width: 350px; + font-size: 11px; + text-align: left; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 10px; + font-weight: bold; + margin: 0px; +} +div.menubar { + background: #cac2a8; + border-top: 1px black solid; + border-bottom: 1px black solid; + padding-left: 10px; + padding-right: 10px; + padding-top: 3px; + padding-bottom: 2px; + font-weight:bold; + font-size: 13px; +} +div.menubar a { + text-decoration: none; +} +div.menudate { + float: left; + width: 130px; + padding-top: 5px; +} +div.menuaccroche { + margin-left: 30px; + float: left; + text-decoration: underline; + font-size: 14px; +} +div.menusearch { + float: right; + text-align: right; + padding-top: 5px; + width: 170px; +} +div.menusearch p { + margin: 0px 0px 0px 0px; +} +.searchinput { + border: solid 1px black; +} +a#menulinkselect { + color: #ed7e00; +} + +div.leftbox { + width: 200px; + float: left; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; + border-right: 1px black solid; + border-bottom: 1px black solid; + background: white; + margin-bottom: 10px; +} +div.leftbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.leftbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.leftbox ul { + list-style-type: square; + margin-bottom: 10px; + margin-left: 0em; + padding-left: 0em; +} +div.leftbox li { + margin-left: 10px; +} + +div.rightbox { + width: 150px; + float: right; + padding-top: 10px; + padding-left: 5px; + padding-right: 15px; + padding-bottom: 5px; + border-left: 1px black solid; + border-bottom: 1px black solid; + text-align: left; +} +div.newjournaldiv { + text-align: justify; + margin-left: 10%; + font-size: 12px; + width: 600px; +} +div.newjournaldiv p { + margin-bottom: 0px; + margin-top: 20px; +} +div.journaldiv { + margin-left: 0px; + margin-right: 0px; + margin-top: 20px; + margin-bottom: 20px; + border: 1px black solid; + padding-top: 5px; + padding-bottom: 5px; + padding-right: 10px; + padding-left: 10px; + background-color: #eef; +} +div.journaldiv p { + margin-top: 10px; + margin-bottom: 0px; +} +div.journaldiv h1 { + color: #990033; + font-size: 14px; + margin: 0px; +} +div.journaldiv h2 { + font-size: 10px; + margin: 0px; +} +div.tipdiv { + margin-left: 220px; + margin-right: 50px; + margin-top: 20px; + padding-top: 5px; + padding-right: 10px; + padding-left: 10px; + text-align: justify; + background-color: #eee; + border: black solid 1px; +} +div.tipdiv h1 { + font-weight: bold; + font-size: 14px; + color: black; + margin-top: 0px; + margin-bottom: 20px; +} +div.tipdiv h2 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 12px; + margin: 0px; +} + +div.newsdiv { + margin-left: 220px; + margin-right: 180px; + margin-top: 10px; + margin-bottom: 20px; + text-align: justify; +} +div.newsdiv h1 { + font-weight: bold; + font-size: 14px; + margin: 0px; +} +div.newsdiv h2 { + font-weight: normal; + font-size: 12px; + margin: 0px; +} +div.newsdiv h3 { + font-weight: normal; + font-size: 12px; + margin-bottom: 20px; +} +div.objdiv { + margin-left: 220px; + margin-right: 20px; + margin-top: 10px; + margin-bottom: 20px; +} + +h1.newstitle { + text-align: left; + font-size: 14px; + margin: 0px 0px 0px 0px; + color: black; +} +div.titlediv { + border-top: solid #cac2a8 2px; + margin-top: 20px; + background-color: #eeeae6; + padding-left: 10px; + font-size: 11px; +} +div.bodydiv { + border: solid #9e9784 1px; + padding-left: 10px; + padding-right: 10px; + padding-top: 10px; + padding-bottom: 5px; + margin-top: 2px; + text-align: justify; +} + +div.comments { + padding: 10px; + border-top: solid 2px #d37537; + border-bottom: solid 2px #d37537; + margin-top: 20px; + margin-bottom: 10px; + background-color: #cacaca; + font-size: 12px; + line-height: 1.3em; +} + + +p.commentsbody { + border-left-style: solid; + border-width: 1px; + border-color: rgb(0, 0, 0); + padding-left: 10px; + text-align: justify; + margin-right: 20px; +} + + +div.commentsreply { + margin-left: 220px; + text-align: center; + margin-top: 50px; +} + +ul.commentsul { + list-style-type: none; + margin-bottom: 10px; + margin-left: 1.25em; + padding-left: 0em; + border-left: 1px solid black; +} +ul.commentsli { + margin: 10px; +} +div.comments li { + margin-top: 20px; + margin-left: 2px; +} + +div.comments h1 { + font-size: 12px; + color: black; + margin: 0px 20px 3px 0px; + background-color: rgb(226, 226, 226); + padding-left: 1px; + font-weight: none; +} + +div.articlediv { + padding-left: 20px; + padding-right: 20px; + padding-top: 10px; + padding-bottom: 20px; + margin-right: 10px; + margin-left: 220px; + border: solid 1px black; + margin-top: 10px; + text-align: justify; + background-color: #E2E2E2; +} +img { + border: 0px; +} +div.sectionimg { + float: left; + margin-right: 10px; + margin-top: 5px; +} +p.hautpage { + margin-top: 20px; + margin-bottom: 20px; + margin-left: 10px; +} +div.leftcol { + width: 202px; + width: 202px; + float: left; + padding: 0px; +} +div.logodiv { + border-right: 1px black solid; + border-bottom: 1px black solid; + padding: 0px; + line-height: 0px +} +div.loginbox { + margin-left: 4px; + border: solid #a59f8b 1px; + margin-top: 2px; + padding: 5px; + background-color: #fff2e8; + font-size: 10px; +} +div.loginbox p { + margin: 0px; + padding: 0px; +} +div.loginbox ul { + margin-left: 10px; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; + list-style-type: none; +} +div.loginbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.loginbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.loginbox h3 { + margin-top: 0px; + margin-bottom: 5px; + font-size: 12px; +} +div.polldivtitle { + margin-bottom: 1px; + background-color: #cac2a8; + margin-left: 4px; + margin-top: 15px; + padding-left: 5px; + font-size: 10px; + border-top: solid #a59f8b 1px; + border-bottom: solid #a59f8b 1px; + text-transform: uppercase; +} +div.polldiv { + margin-left: 4px; + border: 1px #a59f8b solid; + margin-top: 0px; + padding: 5px; + background: #fff2e8; +} +div.polldiv p { +margin: 5px; padding: 0px; +} +div.polldiv ul { + margin-left: 5px; + margin-top: 0px; + margin-bottom: 10px; + padding: 0px; + list-style-type: none; +} +div.otherboxtitle { + margin-bottom: 2px; + background-color: #e3dabc; + margin-left: 4px; + margin-top: 15px; + padding-left: 5px; + padding-top: 2px; + font-size: 11px; + border-top: solid #777364 1px; + border-bottom: solid #777364 1px; + text-transform: uppercase; + font-weight: bold; +} +div.otherbox { + margin-left: 4px; + border: 1px #a59f8b solid; + margin-top: 0px; + padding: 5px; + text-align: justify; + background: #fff2e8; + font-size: 10px; +} +div.otherbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.otherbox h2 { + font-weight: bold; + font-size: 11px; + margin: 0px; +} +div.otherbox p { + margin-top: 5px; + margin-bottom: 10px; +} +div.rightlogo { + width: 90px; + float: right; + margin-right: 0px; + padding-top: 0px; + padding-left: 0px; + padding-bottom: 0px; +} +div.centraldiv { + margin-left: 220px; + margin-right: 10px; + margin-bottom: 20px; + margin-top: 10px; +} +div.centraldiv h1 { + font-weight: bold; + font-size: 14px; + margin: 0px; +} +div.centraldiv h2 { + font-weight: normal; + font-size: 12px; + margin: 0px; +} +div.centraldiv h3 { + font-weight: normal; + font-size: 12px; + margin-bottom: 20px; +} +div.centralinfo { + position:relative; + height:160px; +} +div.lefttopbox { + position:relative; + padding-left: 5px; + padding-right: 5px; + padding-top: 5px; + border: 1px #a59f8b solid; + text-align: justify; + background: #fff2e8; + font-size: 12px; + width: 47%; + float: left; +} +div.lefttopbox p { + margin-top: 5px; margin-bottom: 10px; +} +div.lefttopbox h1 { + font-size: 13px; + font-weight: bold; + margin: 0px; + text-align: right; +} +div.lefttopbox h2 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.lefttopbox h3 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.righttopbox { + position:relative; + border: 1px #a59f8b solid; + background: white; + padding: 5px; + text-align: justify; + font-size: 12px; + width: 47%; + float: right; +} +div.righttopbox h1 { + text-transform: uppercase; + font-weight: bold; + color: #ed7e00; + font-size: 10px; + margin: 0px; +} +div.righttopbox h2 { + font-weight: bold; + font-size: 12px; + margin: 0px; +} +div.boardindex { + text-align: justify; + font-size: 11px; + padding: 10px; + margin-left: 20px; + margin-right: 20px; +} +a.boardindex:link,a.boardindex:visited,a.boardindex:active { + text-decoration:none; + color: red; +} +div.boardleftmsg { + float: left; + margin-top: 3px; +} +div.boardrightmsg { + margin-left: 130px; + margin-top: 3px; + padding-left: 5px; +} +div.journalbody { + margin-left: 40px; + margin-top: 40px; +} +div.journalbody h1 { + font-size: 15px; + font-weight: bold; +} +div.journalbody p { + margin-bottom: 20px; +} +.formulaire { + border: solid 1px black; +font-size: 12px; +background-color: #eef; +color: #000000; +} +.newcomments { + color: red; + font-weight: bold; +} +div.commentsreplythanks { + margin-left: 100px; + margin-top: 50px; + margin-right: 100px; + background-color: #eee; + border: black solid 1px; + padding: 10px; +} +div.archivediv { + margin-right: 20px; +} +.archivedate { + color:#f30; +} +.archivelink { + font-size: 14px; + font-weight: bold; + text-decoration: underline; +} diff --git a/tests/test-inputs/test4.2.css b/tests/test-inputs/test4.2.css new file mode 100644 index 0000000..2dafbef --- /dev/null +++ b/tests/test-inputs/test4.2.css @@ -0,0 +1,24 @@ +@charset "ISO-8859-1" ; + +@import url("http://www.yahoo.com/css") print , screen ; + +@font-face { + font-family: "Robson Celtic"; + src: url("http://site/fonts/rob-celt") +} + + + +@page left:one-two { + margin: 10pt; + border:none +} + +@media print , screen , projection { + H1 { font-family: "Robson Celtic", serif } + + P { + background: black ; + foreground: white ; + } +} diff --git a/tests/test-outputs/test4.1.out b/tests/test-outputs/test4.1.out new file mode 100644 index 0000000..cf3292e --- /dev/null +++ b/tests/test-outputs/test4.1.out @@ -0,0 +1,762 @@ +* { + font-family : Verdana, Arial, Helvetica, sans-serif, monospace +} + +body { + background : #606060; + color : #000000 +} + +a:link { + color : #0000FF; + background : transparent; + text-decoration : none +} + +a:visited { + color : #990099; + background : transparent; + text-decoration : none +} + +a:active { + color : #000000; + background : #ADD8E6; + text-decoration : none +} + +h1.rubrique_info { + color : #990033; + margin : 0px 0px 0px 0px; + padding : 0em; + border : 0px; + font-size : 12px +} + +h1.connexe { + font-size : 12px; + padding : 0em; + margin : 0px 0px 0px 0px; + color : #990033 +} + +a.rubrique_infolink { + text-decoration : none +} + +ul.rubrique_infoul { + display : inline; + list-style-type : square +} + +ul.rubrique_infoul * { + width : 100% +} + +li.rubrique_infoul { + margin-left : 15px +} + +h1 { + color : #990033 +} + +div.main { + background : white; + color : #000000; + margin-left : 5px; + margin-right : 5px; + border : 1px black solid; + text-align : left; + font-size : 12px +} + +div.lsfnbanner { + margin-left : 150px; + margin-right : 170px; + border-top : none; + padding-left : 10px; + padding-right : 10px; + border-bottom : 1px black solid; + border-right : 1px black solid; + border-left : 1px black solid; + text-align : left; + font-size : 11px; + padding-top : 2px; + background-color : #eeeae6 +} + +div.footer { + padding-top : 5px; + padding-bottom : 3px; + border-top : 1px black solid; + border-left : 1px black solid; + border-right : 1px black solid; + text-align : left; + font-size : 9px; + background : #dcdff4; + width : 600px; + margin-top : 40px; + margin-left : 20px +} + +div.footer p { + margin-left : 10px; + margin-top : 2px; + margin-bottom : 2px +} + +a.lsfnlink:link, a.lsfnlink:visited, a.lsfnlink:active { + text-decoration : none; + color : #333333; + font-size : 10px +} + +a.lsfnlink:hover { + text-decoration : underline; + color : black +} + +div.menubartop { + margin-bottom : 10px; + padding-left : 10px; + padding-right : 10px; + padding-top : 0px; + font-size : 13px +} + +div.smallmenubar { + background : white; + padding-left : 10px; + padding-right : 10px; + padding-top : 0px; + padding-bottom : 0px; + font-weight : bold; + font-size : 10px; + text-align : right +} + +div.menuevent { + float : left; + width : 350px; + font-size : 11px; + text-align : left; + padding-top : 0px; + padding-bottom : 0px; + padding-left : 10px; + font-weight : bold; + margin : 0px +} + +div.menubar { + background : #cac2a8; + border-top : 1px black solid; + border-bottom : 1px black solid; + padding-left : 10px; + padding-right : 10px; + padding-top : 3px; + padding-bottom : 2px; + font-weight : bold; + font-size : 13px +} + +div.menubar a { + text-decoration : none +} + +div.menudate { + float : left; + width : 130px; + padding-top : 5px +} + +div.menuaccroche { + margin-left : 30px; + float : left; + text-decoration : underline; + font-size : 14px +} + +div.menusearch { + float : right; + text-align : right; + padding-top : 5px; + width : 170px +} + +div.menusearch p { + margin : 0px 0px 0px 0px +} + +.searchinput { + border : solid 1px black +} + +a#menulinkselect { + color : #ed7e00 +} + +div.leftbox { + width : 200px; + float : left; + padding-left : 5px; + padding-right : 5px; + padding-bottom : 5px; + border-right : 1px black solid; + border-bottom : 1px black solid; + background : white; + margin-bottom : 10px +} + +div.leftbox h1 { + text-transform : uppercase; + font-weight : bold; + color : #ed7e00; + font-size : 10px; + margin : 0px +} + +div.leftbox h2 { + font-weight : bold; + font-size : 12px; + margin : 0px +} + +div.leftbox ul { + list-style-type : square; + margin-bottom : 10px; + margin-left : 0em; + padding-left : 0em +} + +div.leftbox li { + margin-left : 10px +} + +div.rightbox { + width : 150px; + float : right; + padding-top : 10px; + padding-left : 5px; + padding-right : 15px; + padding-bottom : 5px; + border-left : 1px black solid; + border-bottom : 1px black solid; + text-align : left +} + +div.newjournaldiv { + text-align : justify; + margin-left : 10%; + font-size : 12px; + width : 600px +} + +div.newjournaldiv p { + margin-bottom : 0px; + margin-top : 20px +} + +div.journaldiv { + margin-left : 0px; + margin-right : 0px; + margin-top : 20px; + margin-bottom : 20px; + border : 1px black solid; + padding-top : 5px; + padding-bottom : 5px; + padding-right : 10px; + padding-left : 10px; + background-color : #eef +} + +div.journaldiv p { + margin-top : 10px; + margin-bottom : 0px +} + +div.journaldiv h1 { + color : #990033; + font-size : 14px; + margin : 0px +} + +div.journaldiv h2 { + font-size : 10px; + margin : 0px +} + +div.tipdiv { + margin-left : 220px; + margin-right : 50px; + margin-top : 20px; + padding-top : 5px; + padding-right : 10px; + padding-left : 10px; + text-align : justify; + background-color : #eee; + border : black solid 1px +} + +div.tipdiv h1 { + font-weight : bold; + font-size : 14px; + color : black; + margin-top : 0px; + margin-bottom : 20px +} + +div.tipdiv h2 { + text-transform : uppercase; + font-weight : bold; + color : #ed7e00; + font-size : 12px; + margin : 0px +} + +div.newsdiv { + margin-left : 220px; + margin-right : 180px; + margin-top : 10px; + margin-bottom : 20px; + text-align : justify +} + +div.newsdiv h1 { + font-weight : bold; + font-size : 14px; + margin : 0px +} + +div.newsdiv h2 { + font-weight : normal; + font-size : 12px; + margin : 0px +} + +div.newsdiv h3 { + font-weight : normal; + font-size : 12px; + margin-bottom : 20px +} + +div.objdiv { + margin-left : 220px; + margin-right : 20px; + margin-top : 10px; + margin-bottom : 20px +} + +h1.newstitle { + text-align : left; + font-size : 14px; + margin : 0px 0px 0px 0px; + color : black +} + +div.titlediv { + border-top : solid #cac2a8 2px; + margin-top : 20px; + background-color : #eeeae6; + padding-left : 10px; + font-size : 11px +} + +div.bodydiv { + border : solid #9e9784 1px; + padding-left : 10px; + padding-right : 10px; + padding-top : 10px; + padding-bottom : 5px; + margin-top : 2px; + text-align : justify +} + +div.comments { + padding : 10px; + border-top : solid 2px #d37537; + border-bottom : solid 2px #d37537; + margin-top : 20px; + margin-bottom : 10px; + background-color : #cacaca; + font-size : 12px; + line-height : 1.3em +} + +p.commentsbody { + border-left-style : solid; + border-width : 1px; + border-color : rgb(0, 0, 0); + padding-left : 10px; + text-align : justify; + margin-right : 20px +} + +div.commentsreply { + margin-left : 220px; + text-align : center; + margin-top : 50px +} + +ul.commentsul { + list-style-type : none; + margin-bottom : 10px; + margin-left : 1.25em; + padding-left : 0em; + border-left : 1px solid black +} + +ul.commentsli { + margin : 10px +} + +div.comments li { + margin-top : 20px; + margin-left : 2px +} + +div.comments h1 { + font-size : 12px; + color : black; + margin : 0px 20px 3px 0px; + background-color : rgb(226, 226, 226); + padding-left : 1px; + font-weight : none +} + +div.articlediv { + padding-left : 20px; + padding-right : 20px; + padding-top : 10px; + padding-bottom : 20px; + margin-right : 10px; + margin-left : 220px; + border : solid 1px black; + margin-top : 10px; + text-align : justify; + background-color : #E2E2E2 +} + +img { + border : 0px +} + +div.sectionimg { + float : left; + margin-right : 10px; + margin-top : 5px +} + +p.hautpage { + margin-top : 20px; + margin-bottom : 20px; + margin-left : 10px +} + +div.leftcol { + width : 202px; + width : 202px; + float : left; + padding : 0px +} + +div.logodiv { + border-right : 1px black solid; + border-bottom : 1px black solid; + padding : 0px; + line-height : 0px +} + +div.loginbox { + margin-left : 4px; + border : solid #a59f8b 1px; + margin-top : 2px; + padding : 5px; + background-color : #fff2e8; + font-size : 10px +} + +div.loginbox p { + margin : 0px; + padding : 0px +} + +div.loginbox ul { + margin-left : 10px; + margin-top : 0px; + margin-bottom : 0px; + padding : 0px; + list-style-type : none +} + +div.loginbox h1 { + text-transform : uppercase; + font-weight : bold; + color : #ed7e00; + font-size : 10px; + margin : 0px +} + +div.loginbox h2 { + font-weight : bold; + font-size : 12px; + margin : 0px +} + +div.loginbox h3 { + margin-top : 0px; + margin-bottom : 5px; + font-size : 12px +} + +div.polldivtitle { + margin-bottom : 1px; + background-color : #cac2a8; + margin-left : 4px; + margin-top : 15px; + padding-left : 5px; + font-size : 10px; + border-top : solid #a59f8b 1px; + border-bottom : solid #a59f8b 1px; + text-transform : uppercase +} + +div.polldiv { + margin-left : 4px; + border : 1px #a59f8b solid; + margin-top : 0px; + padding : 5px; + background : #fff2e8 +} + +div.polldiv p { + margin : 5px; + padding : 0px +} + +div.polldiv ul { + margin-left : 5px; + margin-top : 0px; + margin-bottom : 10px; + padding : 0px; + list-style-type : none +} + +div.otherboxtitle { + margin-bottom : 2px; + background-color : #e3dabc; + margin-left : 4px; + margin-top : 15px; + padding-left : 5px; + padding-top : 2px; + font-size : 11px; + border-top : solid #777364 1px; + border-bottom : solid #777364 1px; + text-transform : uppercase; + font-weight : bold +} + +div.otherbox { + margin-left : 4px; + border : 1px #a59f8b solid; + margin-top : 0px; + padding : 5px; + text-align : justify; + background : #fff2e8; + font-size : 10px +} + +div.otherbox h1 { + text-transform : uppercase; + font-weight : bold; + color : #ed7e00; + font-size : 10px; + margin : 0px +} + +div.otherbox h2 { + font-weight : bold; + font-size : 11px; + margin : 0px +} + +div.otherbox p { + margin-top : 5px; + margin-bottom : 10px +} + +div.rightlogo { + width : 90px; + float : right; + margin-right : 0px; + padding-top : 0px; + padding-left : 0px; + padding-bottom : 0px +} + +div.centraldiv { + margin-left : 220px; + margin-right : 10px; + margin-bottom : 20px; + margin-top : 10px +} + +div.centraldiv h1 { + font-weight : bold; + font-size : 14px; + margin : 0px +} + +div.centraldiv h2 { + font-weight : normal; + font-size : 12px; + margin : 0px +} + +div.centraldiv h3 { + font-weight : normal; + font-size : 12px; + margin-bottom : 20px +} + +div.centralinfo { + position : relative; + height : 160px +} + +div.lefttopbox { + position : relative; + padding-left : 5px; + padding-right : 5px; + padding-top : 5px; + border : 1px #a59f8b solid; + text-align : justify; + background : #fff2e8; + font-size : 12px; + width : 47%; + float : left +} + +div.lefttopbox p { + margin-top : 5px; + margin-bottom : 10px +} + +div.lefttopbox h1 { + font-size : 13px; + font-weight : bold; + margin : 0px; + text-align : right +} + +div.lefttopbox h2 { + text-transform : uppercase; + font-weight : bold; + color : #ed7e00; + font-size : 10px; + margin : 0px +} + +div.lefttopbox h3 { + font-weight : bold; + font-size : 12px; + margin : 0px +} + +div.righttopbox { + position : relative; + border : 1px #a59f8b solid; + background : white; + padding : 5px; + text-align : justify; + font-size : 12px; + width : 47%; + float : right +} + +div.righttopbox h1 { + text-transform : uppercase; + font-weight : bold; + color : #ed7e00; + font-size : 10px; + margin : 0px +} + +div.righttopbox h2 { + font-weight : bold; + font-size : 12px; + margin : 0px +} + +div.boardindex { + text-align : justify; + font-size : 11px; + padding : 10px; + margin-left : 20px; + margin-right : 20px +} + +a.boardindex:link, a.boardindex:visited, a.boardindex:active { + text-decoration : none; + color : red +} + +div.boardleftmsg { + float : left; + margin-top : 3px +} + +div.boardrightmsg { + margin-left : 130px; + margin-top : 3px; + padding-left : 5px +} + +div.journalbody { + margin-left : 40px; + margin-top : 40px +} + +div.journalbody h1 { + font-size : 15px; + font-weight : bold +} + +div.journalbody p { + margin-bottom : 20px +} + +.formulaire { + border : solid 1px black; + font-size : 12px; + background-color : #eef; + color : #000000 +} + +.newcomments { + color : red; + font-weight : bold +} + +div.commentsreplythanks { + margin-left : 100px; + margin-top : 50px; + margin-right : 100px; + background-color : #eee; + border : black solid 1px; + padding : 10px +} + +div.archivediv { + margin-right : 20px +} + +.archivedate { + color : #f30 +} + +.archivelink { + font-size : 14px; + font-weight : bold; + text-decoration : underline +}OK diff --git a/tests/test0-main.c b/tests/test0-main.c new file mode 100644 index 0000000..ee6cf72 --- /dev/null +++ b/tests/test0-main.c @@ -0,0 +1,215 @@ +/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */ + +/* + *This file is part of the Croco Library + * + *The Croco Library 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 2, + *or (at your option) any later version. + * + *The Croco Library 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 The Croco Library; + *see the file COPYING. If not, write to + *the Free Software Foundation, Inc., + *59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *Copyright 2002-2003 Dodji Seketeli <dodji@seketeli.org> + */ + +/* + *$Id$ + */ + +#include "stdio.h" +#include "cr-parser-input.h" +#include "string.h" + +/** + *@file + *Some test facilities for the #CRInput class. + */ + +/** + *The options data structure. + *The variable of this data structure are set + *during the parsing the command line by the + *parse_command_line() function. + */ +struct Options +{ + gboolean display_help ; + gboolean display_about ; + gchar ** files_list ; +}; + + +/** + *Displays the usage of the test + *facility. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_help (int a_argc, char ** a_argv) +{ + g_print ("\n\n") ; + g_print ("usage: %s <file-to-parse>\n", a_argv[0]) ; + g_print ("\t <file-to-parse>: the file to parse\n") ; + g_print ("\n\n") ; + g_print ("This test just reads the file byte per byte\nand sends each byte to stdout\n") ; + g_print ("\n\n") ; +} + +/** + *Displays the about text. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_about (int a_argc, char ** a_argv) +{ + g_print ("\n\n") ; + g_print ("%s is a libcroco CRInput class test program.\n", a_argv[0]) ; + g_print ("It should run on GNU compliants systems.\n") ; + g_print ("\n\n") ; + g_print ("Initial author: Dodji Seketeli <dodji@seketeli.org>.\n") ; + g_print ("\n\n") ; +} + +/** + *Parses the command line and updates an abstract "options" data structure. + *@param a_argc the argc variable passed to the main function by the OS. + *@param a_argv the argv variable passed to the main function by the OS. + *@param a_options out parameter. The abstraction of the parsed the options. + */ +void +parse_command_line (int a_argc, char **a_argv, + struct Options *a_options) +{ + int i= 0 ; + + g_return_if_fail (a_options) ; + + memset (a_options, 0, sizeof (struct Options)) ; + + for (i = 1 ; i < a_argc ; i++) + { + if (a_argv[i][0] != '-') break ; + + if (!strcmp (a_argv[i], "-h") || !strcmp (a_argv[i], "--help")) + { + a_options->display_help = TRUE ; + } + if (!strcmp (a_argv[i], "--about")) + { + a_options->display_about = TRUE ; + } + } + + if (i >= a_argc) + { + /*No file parameter where given*/ + a_options->files_list = NULL ; + } + else + { + a_options->files_list = &a_argv[i] ; + } +} + + +/** + *The test of the cr_input_read_byte() method. + *Reads the each byte of a_file_uri using the + *cr_input_read_byte() method. Each byte is send to + *stdout. + *@param a_file_uri the file to read. + *@return CR_OK upon successfull completion of the + *function, an error code otherwise. + */ +enum CRStatus +test_cr_input_read_byte (guchar * a_file_uri) +{ + enum CRStatus status = CR_OK ; + CRInput * input = NULL ; + guchar byte = 0 ; + guint c = 0 ; + + g_return_val_if_fail (a_file_uri, CR_BAD_PARAM_ERROR) ; + + input = + cr_input_new_from_uri (a_file_uri, CR_UTF_8) ; + + if (!input) + { + cr_utils_trace_debug ("Input Stream creation failed.") ; + return CR_ERROR ; + } + + for (status = CR_OK; + status == CR_OK ;) + { + status = cr_input_read_byte (input, &byte) ; + + if (status == CR_OK) + { + c = byte ; + printf ("%d", c) ; + fflush (stdout) ; + } + } + + + + if (status == CR_END_OF_INPUT_ERROR) + { + status = CR_OK ; + } + + cr_input_destroy (input) ; + input = NULL ; + + return status ; +} + + +/** + *The entry point of the testing routine. + */ +int +main (int argc, char ** argv) +{ + struct Options options ; + + parse_command_line (argc, argv, &options) ; + + if (options.display_help == TRUE) + { + display_help (argc, argv) ; + return 0 ; + } + + if (options.display_about == TRUE) + { + display_about (argc, argv) ; + return 0 ; + } + + if (options.files_list == NULL) + { + display_help (argc, argv) ; + return 0 ; + } + + test_cr_input_read_byte (options.files_list[0]) ; + + return 0 ; +} diff --git a/tests/test1-main.c b/tests/test1-main.c new file mode 100644 index 0000000..6f8c92b --- /dev/null +++ b/tests/test1-main.c @@ -0,0 +1,211 @@ +/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */ + +/* + *This file is part of the Croco Library + * + *The Croco Library 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 2, + *or (at your option) any later version. + * + *The Croco Library 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 The Croco Library; + *see the file COPYING. If not, write to + *the Free Software Foundation, Inc., + *59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *Copyright 2002-2003 Dodji Seketeli <dodji@seketeli.org> + */ + +/* + *$Id$ + */ + +#include "stdio.h" +#include "cr-parser-input.h" +#include "string.h" + +/** + *@file + *Some test facilities for the #CRInput class. + */ + +/** + *The options data structure. + *The variable of this data structure are set + *during the parsing the command line by the + *parse_command_line() function. + */ +struct Options +{ + gboolean display_help ; + gboolean display_about ; + gchar ** files_list ; +}; + + +/** + *Displays the usage of the test + *facility. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_help (int a_argc, char ** a_argv) +{ + g_print ("\n\n") ; + g_print ("usage: %s <file-to-parse>\n", a_argv[0]) ; + g_print ("\t <file-to-parse>: the file to parse\n") ; + g_print ("\n\n") ; + g_print ("This test just reads the file character per character\nand sends each character to stdout\n") ; + g_print ("\n\n") ; +} + +/** + *Displays the about text. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_about (int a_argc, char ** a_argv) +{ + g_print ("\n\n") ; + g_print ("%s is a libcroco CRInput class test program.\n", a_argv[0]) ; + g_print ("It should run on GNU compliants systems.\n") ; + g_print ("\n\n") ; + g_print ("Initial author: Dodji Seketeli <dodji@seketeli.org>.\n") ; + g_print ("\n\n") ; +} + +/** + *Parses the command line and updates an abstract "options" data structure. + *@param a_argc the argc variable passed to the main function by the OS. + *@param a_argv the argv variable passed to the main function by the OS. + *@param a_options out parameter. The abstraction of the parsed the options. + */ +void +parse_command_line (int a_argc, char **a_argv, + struct Options *a_options) +{ + int i= 0 ; + + g_return_if_fail (a_options) ; + + memset (a_options, 0, sizeof (struct Options)) ; + + for (i = 1 ; i < a_argc ; i++) + { + if (a_argv[i][0] != '-') break ; + + if (!strcmp (a_argv[i], "-h") || !strcmp (a_argv[i], "--help")) + { + a_options->display_help = TRUE ; + } + if (!strcmp (a_argv[i], "--about")) + { + a_options->display_about = TRUE ; + } + } + + if (i >= a_argc) + { + /*No file parameter where given*/ + a_options->files_list = NULL ; + } + else + { + a_options->files_list = &a_argv[i] ; + } +} + + +/** + *The test of the cr_input_read_byte() method. + *Reads the each byte of a_file_uri using the + *cr_input_read_byte() method. Each byte is send to + *stdout. + *@param a_file_uri the file to read. + *@return CR_OK upon successfull completion of the + *function, an error code otherwise. + */ +enum CRStatus +test_cr_input_read_char (guchar * a_file_uri) +{ + enum CRStatus status = CR_OK ; + CRInput * input = NULL ; + guint32 c = 0 ; + + g_return_val_if_fail (a_file_uri, CR_BAD_PARAM_ERROR) ; + + input = + cr_input_new_from_uri (a_file_uri, CR_UTF_8) ; + + if (!input) + { + cr_utils_trace_debug ("Input Stream creation failed.") ; + return CR_ERROR ; + } + + for (status = CR_OK; + status == CR_OK ;) + { + status = cr_input_read_char (input, &c) ; + + if (status == CR_OK) + { + printf ("%c", c) ; + fflush (stdout) ; + } + } + + if (status == CR_END_OF_INPUT_ERROR) + { + status = CR_OK ; + } + + cr_input_destroy (input) ; + input = NULL ; + + return status ; +} + + +/** + *The entry point of the testing routine. + */ +int +main (int argc, char ** argv) +{ + struct Options options ; + + parse_command_line (argc, argv, &options) ; + + if (options.display_help == TRUE) + { + display_help (argc, argv) ; + return 0 ; + } + + if (options.display_about == TRUE) + { + display_about (argc, argv) ; + return 0 ; + } + + if (options.files_list == NULL) + { + display_help (argc, argv) ; + return 0 ; + } + + test_cr_input_read_char (options.files_list[0]) ; + + return 0 ; +} diff --git a/tests/test2-main.c b/tests/test2-main.c new file mode 100644 index 0000000..50a7d0a --- /dev/null +++ b/tests/test2-main.c @@ -0,0 +1,640 @@ +/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */ + +/* + *This file is part of the Croco Library + * + *The Croco Library 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 2, + *or (at your option) any later version. + * + *The Croco Library 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 The Croco Library; + *see the file COPYING. If not, write to + *the Free Software Foundation, Inc., + *59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *Copyright 2002-2003 Dodji Seketeli <dodji@seketeli.org> + */ + +/* + *$Id$ + */ + +#include <stdio.h> +#include <string.h> +#include "cr-test-utils.h" +#include "cr-parser.h" + + +/** + *@file + *Some test facilities for the #CRParser class. + */ + +CRDocHandler * gv_test_handler = {0} ; + +/** + *Displays the usage of the test + *facility. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_help (int a_argc, char ** a_argv) +{ + fprintf (stdout,"\n\n") ; + fprintf (stdout,"usage: %s <file-to-parse>\n", a_argv[0]) ; + fprintf (stdout,"\t <file-to-parse>: the file to parse\n") ; + fprintf (stdout,"\n\n") ; + fprintf (stdout,"Tests the cr_parser_parse () method.\n") ; + fprintf (stdout,"Returns OK if the status is CR_OK, KO otherwise\n") ; + fprintf (stdout,"\n\n") ; +} + +/** + *Displays the about text. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_about (int a_argc, char ** a_argv) +{ + fprintf (stdout,"\n\n") ; + fprintf (stdout,"%s is a libcroco CRParser class test program.\n", a_argv[0]) ; + fprintf (stdout,"It should run on GNU compliants systems.\n") ; + fprintf (stdout,"\n\n") ; + fprintf (stdout,"Initial author: Dodji Seketeli <dodji@seketeli.org>.\n") ; + fprintf (stdout,"\n\n") ; +} + + +/*************************** + *Some SAC document handlers + *for TEST PURPOSES. + ***************************/ + +static void +test_start_document (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_document\n") ; + fprintf (stdout,"***************\n\n") ; +} + +static void +test_end_document (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_document\n") ; + fprintf (stdout,"***************\n\n") ; +} + +static void +test_import_style (CRDocHandler *a_handler, + GList *a_media_list, GString *a_uri, + GString *a_uri_default_ns) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"****************\n") ; + fprintf (stdout,"import_style\n") ; + + if (a_media_list) + { + GList *cur = NULL ; + + fprintf (stdout,"\nmedia list:\n") ; + fprintf (stdout,"-------------\n") ; + + for (cur = a_media_list ; cur ; cur = cur->next) + { + if (cur->data) + { + guchar *str = + g_strndup + (((GString*)cur->data)->str, + ((GString*)cur->data)->len) ; + + if (str) + { + fprintf (stdout,str) ; fprintf (stdout,"\n") ; + g_free (str) ; + str = NULL ; + } + } + } + + fprintf (stdout,"\ndefault namespace:\n") ; + fprintf (stdout,"--------------------\n") ; + + if (a_uri_default_ns && a_uri_default_ns->str) + { + guchar * str = + g_strndup (a_uri_default_ns->str, + a_uri_default_ns->len) ; + if (str) + { + fprintf (stdout,str) ; fprintf (stdout,"\n") ; + g_free (str) ; + str = NULL ; + } + } + } + + fprintf (stdout,"******************\n\n") ; + + +} + + +static void +test_namespace_declaration (CRDocHandler *a_handler, + GString *a_prefix, + GString *a_uri) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"namespace_declaration:\n") ; + + if (a_prefix && a_prefix->str) + { + guchar * prefix = NULL ; + + prefix = g_strndup (a_prefix->str, a_prefix->len) ; + + if (prefix) + { + fprintf (stdout,"prefix: %s\n", prefix) ; + g_free (prefix) ; + prefix = NULL ; + } + } + + if (a_uri && a_uri->str) + { + guchar *uri = NULL ; + + uri = g_strndup (a_uri->str, a_uri->len) ; + + if (uri) + { + fprintf (stdout,"uri: %s\n", uri) ; + g_free (uri) ; + uri = NULL ; + } + } + fprintf (stdout,"\n") ; + + fprintf (stdout,"***************\n\n") ; + + +} + + +static void +test_comment (CRDocHandler *a_handler, + GString *a_comment) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"comment:\n") ; + + if (a_comment && a_comment->str) + { + guchar *comment = NULL ; + + comment = g_strndup (a_comment->str, a_comment->len) ; + + if (comment) + { + fprintf (stdout,"\n/*----------------------\n") ; + fprintf (stdout,"%s\n", comment) ; + fprintf (stdout,"-------------------------*/\n") ; + + g_free (comment) ; + comment = NULL ; + } + } + + fprintf (stdout,"***************\n\n") ; +} + + + +static void +test_start_selector (CRDocHandler *a_handler, + CRSelector *a_selector_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_selector\n") ; + + if (a_selector_list) + { + cr_selector_dump (a_selector_list, stdout) ; + fprintf (stdout, "\n") ; + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_end_selector (CRDocHandler *a_handler, + CRSelector *a_selector_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_selector\n") ; + + if (a_selector_list) + { + cr_selector_dump (a_selector_list, stdout) ; + fprintf (stdout,"\n") ; + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_property (CRDocHandler *a_handler, GString *a_name, CRTerm *a_expr) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"property\n") ; + + if (a_name && a_name->str) + { + guchar *name = g_strndup (a_name->str, a_name->len) ; + + if (name) + { + fprintf (stdout,name) ; + } + + if (a_expr) + { + fprintf (stdout,": ") ; + cr_term_dump (a_expr, stdout) ; + } + + if (name) + { + g_free (name) ; + name = NULL ; + } + + fprintf (stdout,"\n") ; + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_start_font_face (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_font_face\n") ; + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_end_font_face (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_font_face\n") ; + fprintf (stdout,"***************\n\n") ; + +} + +static void +test_start_media (CRDocHandler *a_handler, + GList *a_media_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_media\n") ; + + if (a_media_list) + { + GList *cur = NULL ; + guchar *medium = NULL ; + + for (cur = a_media_list ; cur ; cur = cur->next) + { + if (cur->data == NULL) + continue ; + + medium = g_strndup (((GString*)cur->data)->str, + ((GString*)cur->data)->len) ; + + if (medium == NULL) + continue ; + + fprintf (stdout,"medium: %s\n", medium) ; + + if (medium) + { + g_free (medium) ; + medium = NULL ; + } + } + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_end_media (CRDocHandler *a_handler, + GList *a_media_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_media\n") ; + + if (a_media_list) + { + GList *cur = NULL ; + guchar *medium = NULL ; + + for (cur = a_media_list ; cur ; cur = cur->next) + { + if (cur->data == NULL) + continue ; + + medium = g_strndup (((GString*)cur->data)->str, + ((GString*)cur->data)->len) ; + + if (medium == NULL) + continue ; + + fprintf (stdout,"medium: %s\n", medium) ; + + if (medium) + { + g_free (medium) ; + medium = NULL ; + } + } + } + + fprintf (stdout,"***************\n\n") ; +} + +static void +test_start_page (CRDocHandler *a_handler, + GString *a_name, GString *a_pseudo_page) +{ + guchar *name = NULL, *pseudo_page = NULL ; + + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_page\n") ; + + if (a_name && a_name->str) + { + name = g_strndup (a_name->str, a_name->len) ; + } + + if (a_pseudo_page && a_pseudo_page->str) + { + pseudo_page = g_strndup (a_pseudo_page->str, + a_pseudo_page->len) ; + } + + if (name) + { + fprintf (stdout,"%s", name) ; + } + + if (pseudo_page) + { + fprintf (stdout,": %s\n", pseudo_page) ; + } + + fprintf (stdout,"***************\n\n") ; + + if (name) + { + g_free (name) ; + name = NULL ; + } + + if (pseudo_page) + { + g_free (pseudo_page) ; + pseudo_page = NULL ; + } +} + +static void +test_end_page (CRDocHandler *a_handler, + GString *a_name, GString *a_pseudo_page) +{ + guchar *name = NULL, *pseudo_page = NULL ; + + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_page\n") ; + + if (a_name && a_name->str) + { + name = g_strndup (a_name->str, a_name->len) ; + } + + if (a_pseudo_page && a_pseudo_page->str) + { + pseudo_page = g_strndup (a_pseudo_page->str, + a_pseudo_page->len) ; + } + + if (name) + { + fprintf (stdout,"%s", name) ; + } + + if (pseudo_page) + { + fprintf (stdout,": %s\n", pseudo_page) ; + + } + + fprintf (stdout,"***************\n\n") ; + + if (name) + { + g_free (name) ; + name = NULL ; + } + + if (pseudo_page) + { + g_free (pseudo_page) ; + pseudo_page = NULL ; + } +} + + +static void +test_ignorable_at_rule (CRDocHandler *a_handler, + GString *a_name) +{ + guchar *name = NULL ; + + g_return_if_fail (a_handler) ; + + fprintf (stdout,"*********************\n") ; + fprintf (stdout,"ignorable_at_rule\n") ; + + if (a_name && a_name->str) + { + name = g_strndup (a_name->str, a_name->len) ; + } + + if (name) + { + fprintf (stdout,"%s\n", name) ; + } + + fprintf (stdout,"*********************\n\n") ; +} + + +static void +init_test_sac_handler (CRDocHandler *a_handler) + +{ + a_handler->start_document = test_start_document ; + a_handler->end_document = test_end_document ; + a_handler->import_style = test_import_style ; + a_handler->namespace_declaration = test_namespace_declaration ; + a_handler->comment = test_comment ; + a_handler->start_selector = test_start_selector ; + a_handler->end_selector = test_end_selector ; + a_handler->property = test_property ; + a_handler->start_font_face = test_start_font_face ; + a_handler->end_font_face = test_end_font_face ; + a_handler->start_media = test_start_media ; + a_handler->end_media = test_end_media ; + a_handler->start_page = test_start_page ; + a_handler->end_page = test_end_page ; + a_handler->ignorable_at_rule = test_ignorable_at_rule ; +} + +/*************************** + *END of TEST SAC document + *handlers. + ***************************/ + + +/** + *The test of the cr_input_read_byte() method. + *Reads the each byte of a_file_uri using the + *cr_input_read_byte() method. Each byte is send to + *stdout. + *@param a_file_uri the file to read. + *@return CR_OK upon successfull completion of the + *function, an error code otherwise. + */ +enum CRStatus +test_cr_parser_parse (guchar * a_file_uri) +{ + enum CRStatus status = CR_OK ; + CRParser *parser = NULL ; + + g_return_val_if_fail (a_file_uri, CR_BAD_PARAM_ERROR) ; + + gv_test_handler = cr_doc_handler_new () ; + init_test_sac_handler (gv_test_handler) ; + + parser = cr_parser_new (NULL) ; + + status = cr_parser_set_sac_handler (parser, gv_test_handler) ; + + if (status != CR_OK) + { + cr_parser_destroy (parser) ; + g_return_val_if_fail (status == CR_OK, CR_ERROR) ; + } + + status = cr_parser_parse_from_file (parser, a_file_uri, CR_ASCII) ; + + cr_parser_destroy (parser) ; + + gv_test_handler = NULL ; + + return status ; +} + + +/** + *The entry point of the testing routine. + */ +int +main (int argc, char ** argv) +{ + struct Options options ; + enum CRStatus status = CR_OK ; + + cr_test_utils_parse_cmd_line (argc, argv, &options) ; + + if (options.display_help == TRUE) + { + display_help (argc, argv) ; + return 0 ; + } + + if (options.display_about == TRUE) + { + display_about (argc, argv) ; + return 0 ; + } + + if (options.files_list == NULL) + { + display_help (argc, argv) ; + return 0 ; + } + + status = test_cr_parser_parse (options.files_list[0]) ; + + if (status == CR_OK) + { + fprintf (stdout,"OK\n") ; + } + else + { + fprintf (stdout,"KO\n") ; + } + + return 0 ; +} diff --git a/tests/test3-main.c b/tests/test3-main.c new file mode 100644 index 0000000..19425f3 --- /dev/null +++ b/tests/test3-main.c @@ -0,0 +1,643 @@ +/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset:8 -*- */ + +/* + *This file is part of the Croco Library + * + *The Croco Library 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 2, + *or (at your option) any later version. + * + *The Croco Library 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 The Croco Library; + *see the file COPYING. If not, write to + *the Free Software Foundation, Inc., + *59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *Copyright 2002-2003 Dodji Seketeli <dodji@seketeli.org> + */ + +/* + *$Id$ + */ + +#include <stdio.h> +#include <string.h> +#include "cr-test-utils.h" +#include "cr-parser.h" + + +/** + *@file + *Some test facilities for the #CRParser class. + */ + +CRDocHandler * gv_test_handler = {0} ; + +/** + *Displays the usage of the test + *facility. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_help (int a_argc, char ** a_argv) +{ + fprintf (stdout,"\n\n") ; + fprintf (stdout,"usage: %s <file-to-parse>\n", a_argv[0]) ; + fprintf (stdout,"\t <file-to-parse>: the file to parse\n") ; + fprintf (stdout,"\n\n") ; + fprintf (stdout,"Tests the cr_parser_parse () method.\n") ; + fprintf (stdout,"Tests the parsing following the css core syntax\n") ; + fprintf (stdout,"Returns OK if the status is CR_OK, KO otherwise\n") ; + fprintf (stdout,"\n\n") ; +} + +/** + *Displays the about text. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_about (int a_argc, char ** a_argv) +{ + fprintf (stdout,"\n\n") ; + fprintf (stdout,"%s is a libcroco CRParser class test program.\n", a_argv[0]) ; + fprintf (stdout,"It should run on GNU compliants systems.\n") ; + fprintf (stdout,"\n\n") ; + fprintf (stdout,"Initial author: Dodji Seketeli <dodji@seketeli.org>.\n") ; + fprintf (stdout,"\n\n") ; +} + + +/*************************** + *Some SAC document handlers + *for TEST PURPOSES. + ***************************/ + +static void +test_start_document (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_document\n") ; + fprintf (stdout,"***************\n\n") ; +} + +static void +test_end_document (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_document\n") ; + fprintf (stdout,"***************\n\n") ; +} + +static void +test_import_style (CRDocHandler *a_handler, + GList *a_media_list, GString *a_uri, + GString *a_uri_default_ns) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"****************\n") ; + fprintf (stdout,"import_style\n") ; + + if (a_media_list) + { + GList *cur = NULL ; + + fprintf (stdout,"\nmedia list:\n") ; + fprintf (stdout,"-------------\n") ; + + for (cur = a_media_list ; cur ; cur = cur->next) + { + if (cur->data) + { + guchar *str = + g_strndup + (((GString*)cur->data)->str, + ((GString*)cur->data)->len) ; + + if (str) + { + fprintf (stdout,str) ; fprintf (stdout,"\n") ; + g_free (str) ; + str = NULL ; + } + } + } + + fprintf (stdout,"\ndefault namespace:\n") ; + fprintf (stdout,"--------------------\n") ; + + if (a_uri_default_ns && a_uri_default_ns->str) + { + guchar * str = + g_strndup (a_uri_default_ns->str, + a_uri_default_ns->len) ; + if (str) + { + fprintf (stdout,str) ; fprintf (stdout,"\n") ; + g_free (str) ; + str = NULL ; + } + } + } + + fprintf (stdout,"******************\n\n") ; + + +} + + +static void +test_namespace_declaration (CRDocHandler *a_handler, + GString *a_prefix, + GString *a_uri) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"namespace_declaration:\n") ; + + if (a_prefix && a_prefix->str) + { + guchar * prefix = NULL ; + + prefix = g_strndup (a_prefix->str, a_prefix->len) ; + + if (prefix) + { + fprintf (stdout,"prefix: %s\n", prefix) ; + g_free (prefix) ; + prefix = NULL ; + } + } + + if (a_uri && a_uri->str) + { + guchar *uri = NULL ; + + uri = g_strndup (a_uri->str, a_uri->len) ; + + if (uri) + { + fprintf (stdout,"uri: %s\n", uri) ; + g_free (uri) ; + uri = NULL ; + } + } + fprintf (stdout,"\n") ; + + fprintf (stdout,"***************\n\n") ; + + +} + + +static void +test_comment (CRDocHandler *a_handler, + GString *a_comment) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"comment:\n") ; + + if (a_comment && a_comment->str) + { + guchar *comment = NULL ; + + comment = g_strndup (a_comment->str, a_comment->len) ; + + if (comment) + { + fprintf (stdout,"\n/*----------------------\n") ; + fprintf (stdout,"%s\n", comment) ; + fprintf (stdout,"-------------------------*/\n") ; + + g_free (comment) ; + comment = NULL ; + } + } + + fprintf (stdout,"***************\n\n") ; +} + + + + +static void +test_start_selector (CRDocHandler *a_handler, + CRSelector *a_selector_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_selector\n") ; + + if (a_selector_list) + { + cr_selector_dump (a_selector_list, stdout) ; + fprintf (stdout,"\n") ; + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_end_selector (CRDocHandler *a_handler, + CRSelector *a_selector_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_selector\n") ; + + if (a_selector_list) + { + cr_selector_dump (a_selector_list, stdout) ; + fprintf (stdout,"\n") ; + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_property (CRDocHandler *a_handler, GString *a_name, CRTerm *a_expr) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"property\n") ; + + if (a_name && a_name->str) + { + guchar *name = g_strndup (a_name->str, a_name->len) ; + + if (name) + { + fprintf (stdout,name) ; + } + + if (a_expr) + { + fprintf (stdout,": ") ; + cr_term_dump (a_expr, stdout) ; + } + + if (name) + { + g_free (name) ; + name = NULL ; + } + + fprintf (stdout,"\n") ; + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_start_font_face (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_font_face\n") ; + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_end_font_face (CRDocHandler *a_handler) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_font_face\n") ; + fprintf (stdout,"***************\n\n") ; + +} + +static void +test_start_media (CRDocHandler *a_handler, + GList *a_media_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_media\n") ; + + if (a_media_list) + { + GList *cur = NULL ; + guchar *medium = NULL ; + + for (cur = a_media_list ; cur ; cur = cur->next) + { + if (cur->data == NULL) + continue ; + + medium = g_strndup (((GString*)cur->data)->str, + ((GString*)cur->data)->len) ; + + if (medium == NULL) + continue ; + + fprintf (stdout,"medium: %s\n", medium) ; + + if (medium) + { + g_free (medium) ; + medium = NULL ; + } + } + } + + fprintf (stdout,"***************\n\n") ; +} + + +static void +test_end_media (CRDocHandler *a_handler, + GList *a_media_list) +{ + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_media\n") ; + + if (a_media_list) + { + GList *cur = NULL ; + guchar *medium = NULL ; + + for (cur = a_media_list ; cur ; cur = cur->next) + { + if (cur->data == NULL) + continue ; + + medium = g_strndup (((GString*)cur->data)->str, + ((GString*)cur->data)->len) ; + + if (medium == NULL) + continue ; + + fprintf (stdout,"medium: %s\n", medium) ; + + if (medium) + { + g_free (medium) ; + medium = NULL ; + } + } + } + + fprintf (stdout,"***************\n\n") ; +} + +static void +test_start_page (CRDocHandler *a_handler, + GString *a_name, GString *a_pseudo_page) +{ + guchar *name = NULL, *pseudo_page = NULL ; + + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"start_page\n") ; + + if (a_name && a_name->str) + { + name = g_strndup (a_name->str, a_name->len) ; + } + + if (a_pseudo_page && a_pseudo_page->str) + { + pseudo_page = g_strndup (a_pseudo_page->str, + a_pseudo_page->len) ; + } + + if (name) + { + fprintf (stdout,"%s", name) ; + } + + if (pseudo_page) + { + fprintf (stdout,": %s\n", pseudo_page) ; + } + + fprintf (stdout,"***************\n\n") ; + + if (name) + { + g_free (name) ; + name = NULL ; + } + + if (pseudo_page) + { + g_free (pseudo_page) ; + pseudo_page = NULL ; + } +} + +static void +test_end_page (CRDocHandler *a_handler, + GString *a_name, GString *a_pseudo_page) +{ + guchar *name = NULL, *pseudo_page = NULL ; + + g_return_if_fail (a_handler) ; + + fprintf (stdout,"***************\n") ; + fprintf (stdout,"end_page\n") ; + + if (a_name && a_name->str) + { + name = g_strndup (a_name->str, a_name->len) ; + } + + if (a_pseudo_page && a_pseudo_page->str) + { + pseudo_page = g_strndup (a_pseudo_page->str, + a_pseudo_page->len) ; + } + + if (name) + { + fprintf (stdout,"%s", name) ; + } + + if (pseudo_page) + { + fprintf (stdout,": %s\n", pseudo_page) ; + + } + + fprintf (stdout,"***************\n\n") ; + + if (name) + { + g_free (name) ; + name = NULL ; + } + + if (pseudo_page) + { + g_free (pseudo_page) ; + pseudo_page = NULL ; + } +} + + +static void +test_ignorable_at_rule (CRDocHandler *a_handler, + GString *a_name) +{ + guchar *name = NULL ; + + g_return_if_fail (a_handler) ; + + fprintf (stdout,"*********************\n") ; + fprintf (stdout,"ignorable_at_rule\n") ; + + if (a_name && a_name->str) + { + name = g_strndup (a_name->str, a_name->len) ; + } + + if (name) + { + fprintf (stdout,"%s\n", name) ; + } + + fprintf (stdout,"*********************\n\n") ; +} + + +static void +init_test_sac_handler (CRDocHandler *a_handler) + +{ + a_handler->start_document = test_start_document ; + a_handler->end_document = test_end_document ; + a_handler->import_style = test_import_style ; + a_handler->namespace_declaration = test_namespace_declaration ; + a_handler->comment = test_comment ; + a_handler->start_selector = test_start_selector ; + a_handler->end_selector = test_end_selector ; + a_handler->property = test_property ; + a_handler->start_font_face = test_start_font_face ; + a_handler->end_font_face = test_end_font_face ; + a_handler->start_media = test_start_media ; + a_handler->end_media = test_end_media ; + a_handler->start_page = test_start_page ; + a_handler->end_page = test_end_page ; + a_handler->ignorable_at_rule = test_ignorable_at_rule ; +} + +/*************************** + *END of TEST SAC document + *handlers. + ***************************/ + + +/** + *The test of the cr_input_read_byte() method. + *Reads the each byte of a_file_uri using the + *cr_input_read_byte() method. Each byte is send to + *stdout. + *@param a_file_uri the file to read. + *@return CR_OK upon successfull completion of the + *function, an error code otherwise. + */ +enum CRStatus +test_cr_parser_parse (guchar * a_file_uri) +{ + enum CRStatus status = CR_OK ; + CRParser *parser = NULL ; + + g_return_val_if_fail (a_file_uri, CR_BAD_PARAM_ERROR) ; + + gv_test_handler = cr_doc_handler_new () ; + init_test_sac_handler (gv_test_handler) ; + + parser = cr_parser_new (NULL) ; + + status = cr_parser_set_sac_handler (parser, gv_test_handler) ; + + if (status != CR_OK) + { + cr_parser_destroy (parser) ; + g_return_val_if_fail (status == CR_OK, CR_ERROR) ; + } + + status = cr_parser_set_use_core_grammar (parser, TRUE) ; + status = cr_parser_parse_from_file (parser, a_file_uri, CR_ASCII) ; + + cr_parser_destroy (parser) ; + + gv_test_handler = NULL ; + + return status ; +} + + +/** + *The entry point of the testing routine. + */ +int +main (int argc, char ** argv) +{ + struct Options options ; + enum CRStatus status = CR_OK ; + + cr_test_utils_parse_cmd_line (argc, argv, &options) ; + + if (options.display_help == TRUE) + { + display_help (argc, argv) ; + return 0 ; + } + + if (options.display_about == TRUE) + { + display_about (argc, argv) ; + return 0 ; + } + + if (options.files_list == NULL) + { + display_help (argc, argv) ; + return 0 ; + } + + status = test_cr_parser_parse (options.files_list[0]) ; + + if (status == CR_OK) + { + fprintf (stdout,"OK\n") ; + } + else + { + fprintf (stdout,"KO\n") ; + } + + return 0 ; +} diff --git a/tests/test4-main.c b/tests/test4-main.c new file mode 100644 index 0000000..66df6dc --- /dev/null +++ b/tests/test4-main.c @@ -0,0 +1,154 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + +/* + *This file is part of the Croco Library + * + *The Croco Library 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 2, + *or (at your option) any later version. + * + *The Croco Library 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 The Croco Library; + *see the file COPYING. If not, write to + *the Free Software Foundation, Inc., + *59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + *Copyright 2002-2003 Dodji Seketeli <dodji@seketeli.org> + */ + +/* + *$Id$ + */ + +#include "cr-test-utils.h" +#include "libcroco.h" + + +/** + *@file + *Some test facilities for the #CRParser class. + */ + +CRDocHandler * gv_test_handler = {0} ; + +/** + *Displays the usage of the test + *facility. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_help (int a_argc, char ** a_argv) +{ + g_print ("\n\n") ; + g_print ("usage: %s <file-to-parse>\n", a_argv[0]) ; + g_print ("\t <file-to-parse>: the file to parse\n") ; + g_print ("\n\n") ; + g_print ("Tests the cr_parser_parse () method.\n") ; + g_print ("Tests the parsing following the css core syntax\n") ; + g_print ("Returns OK if the status is CR_OK, KO otherwise\n") ; + g_print ("\n\n") ; +} + +/** + *Displays the about text. + *@param a_argc the argc variable passed to the main function. + *@param a_argv the argv variable passed to the main function. + */ +void +display_about (int a_argc, char ** a_argv) +{ + g_print ("\n\n") ; + g_print ("%s is a libcroco CROMParser class test program.\n", + a_argv[0]) ; + g_print ("%s Parses a file and builds a CSS object model", + a_argv[0]) ; + g_print ("It should run on GNU compliants systems.\n") ; + g_print ("\n\n") ; + g_print ("Initial author: Dodji Seketeli <dodji@seketeli.org>.\n") ; + g_print ("\n\n") ; +} + + +/** + *The test of the cr_input_read_byte() method. + *Reads the each byte of a_file_uri using the + *cr_input_read_byte() method. Each byte is send to + *stdout. + *@param a_file_uri the file to read. + *@return CR_OK upon successfull completion of the + *function, an error code otherwise. + */ +enum CRStatus +test_cr_parser_parse (guchar * a_file_uri) +{ + enum CRStatus status = CR_OK ; + CROMParser *parser = NULL ; + CRStyleSheet *stylesheet = NULL ; + + g_return_val_if_fail (a_file_uri, CR_BAD_PARAM_ERROR) ; + + parser = cr_om_parser_new (NULL) ; + status = cr_om_parser_parse_file (parser, a_file_uri, CR_ASCII, + &stylesheet) ; + if (status == CR_OK && stylesheet) + { + cr_stylesheet_dump (stylesheet, stdout) ; + cr_stylesheet_destroy (stylesheet) ; + } + cr_om_parser_destroy (parser) ; + + return status ; +} + + +/** + *The entry point of the testing routine. + */ +int +main (int argc, char ** argv) +{ + struct Options options ; + enum CRStatus status = CR_OK ; + + cr_test_utils_parse_cmd_line (argc, argv, &options) ; + + if (options.display_help == TRUE) + { + display_help (argc, argv) ; + return 0 ; + } + + if (options.display_about == TRUE) + { + display_about (argc, argv) ; + return 0 ; + } + + if (options.files_list == NULL) + { + display_help (argc, argv) ; + return 0 ; + } + + status = test_cr_parser_parse (options.files_list[0]) ; + + if (status == CR_OK) + { + g_print ("\nOK\n") ; + } + else + { + g_print ("\nKO\n") ; + } + + return 0 ; +} diff --git a/tests/valgrind.log b/tests/valgrind.log new file mode 100644 index 0000000..7e68e8f --- /dev/null +++ b/tests/valgrind.log @@ -0,0 +1,144 @@ +==31389== valgrind-1.0.4, a memory error detector for x86 GNU/Linux. +==31389== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward. +==31389== Startup, with flags: +==31389== --suppressions=/usr/local/lib/valgrind/default.supp +==31389== -v +==31389== --num-callers=100 +==31389== --leak-check=yes +==31389== --show-reachable=yes +==31389== Reading suppressions file: /usr/local/lib/valgrind/default.supp +==31389== Reading syms from /home/dodji/dev/libcroco/tests/.libs/test4 +==31389== Reading syms from /lib/ld-2.2.5.so +==31389== Reading syms from /usr/local/lib/valgrind/valgrind.so +==31389== Reading syms from /usr/lib/libglib-2.0.so.0.0.6 +==31389== object doesn't have any debug info +==31389== Reading syms from /usr/local/lib/libcroco.so.0.0.1 +==31389== Reading syms from /lib/i686/libc-2.2.5.so +==31389== object doesn't have any debug info +==31389== Estimated CPU clock rate is 364 MHz +==31389== +==31389== +==31389== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) +==31389== malloc/free: in use at exit: 38298 bytes in 19 blocks. +==31389== malloc/free: 2510 allocs, 2491 frees, 125800 bytes allocated. +==31389== +==31389== searching for pointers to 19 not-freed blocks. +==31389== checked 4075548 bytes. +==31389== +==31389== definitely lost: 0 bytes in 0 blocks. +==31389== possibly lost: 0 bytes in 0 blocks. +==31389== still reachable: 38298 bytes in 19 blocks. +==31389== +==31389== 20 bytes in 1 blocks are still reachable in loss record 1 of 6 +==31389== at 0x4003BF5B: calloc (vg_clientfuncs.c:239) +==31389== by 0x4025FF5D: g_allocator_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40254B16: (within /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40253F7F: g_list_append (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x402BB93D: cr_parser_parse_import (cr-parser.c:3170) +==31389== by 0x402BD9A2: cr_parser_parse_stylesheet (cr-parser.c:4494) +==31389== by 0x402BE6BF: cr_parser_parse (cr-parser.c:5086) +==31389== by 0x402BE8B4: cr_parser_parse_from_file (cr-parser.c:5144) +==31389== by 0x402C2E74: cr_om_parser_parse_file (cr-om-parser.c:847) +==31389== by 0x804880E: test_cr_parser_parse (test4-main.c:100) +==31389== by 0x80488DA: main (test4-main.c:142) +==31389== by 0x402E1082: __libc_start_main (in /lib/i686/libc-2.2.5.so) +==31389== by 0x80485F1: cr_om_parser_parse_file (in /home/dodji/dev/libcroco/tests/.libs/test4) +==31389== +==31389== 80 bytes in 1 blocks are still reachable in loss record 2 of 6 +==31389== at 0x4003BAB5: malloc (vg_clientfuncs.c:100) +==31389== by 0x402E1BFA: (within /lib/i686/libc-2.2.5.so) +==31389== by 0x402E1865: iconv_open (in /lib/i686/libc-2.2.5.so) +==31389== by 0x402439E3: (within /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40241D2D: g_convert (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x4024221C: g_convert_with_fallback (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40261F26: g_print (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x402BF7EA: cr_statement_dump_charset (cr-statement.c:259) +==31389== by 0x402C1226: cr_statement_dump (cr-statement.c:1196) +==31389== by 0x402C14CF: cr_stylesheet_dump (cr-stylesheet.c:74) +==31389== by 0x804882B: test_cr_parser_parse (test4-main.c:104) +==31389== by 0x80488DA: main (test4-main.c:142) +==31389== by 0x402E1082: __libc_start_main (in /lib/i686/libc-2.2.5.so) +==31389== by 0x80485F1: cr_om_parser_parse_file (in /home/dodji/dev/libcroco/tests/.libs/test4) +==31389== +==31389== 208 bytes in 4 blocks are still reachable in loss record 3 of 6 +==31389== at 0x4003BAB5: malloc (vg_clientfuncs.c:100) +==31389== by 0x4025EAF2: g_mem_chunk_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40271523: g_string_sized_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40271588: g_string_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x402B021D: cr_tknzr_parse_string (cr-tknzr.c:768) +==31389== by 0x402B44E5: cr_tknzr_get_next_token (cr-tknzr.c:2713) +==31389== by 0x402B8247: cr_parser_try_to_skip_spaces_and_comments (cr-parser.c:832) +==31389== by 0x402BB4A7: cr_parser_parse_charset (cr-parser.c:3026) +==31389== by 0x402BD767: cr_parser_parse_stylesheet (cr-parser.c:4408) +==31389== by 0x402BE6BF: cr_parser_parse (cr-parser.c:5086) +==31389== by 0x402BE8B4: cr_parser_parse_from_file (cr-parser.c:5144) +==31389== by 0x402C2E74: cr_om_parser_parse_file (cr-om-parser.c:847) +==31389== by 0x804880E: test_cr_parser_parse (test4-main.c:100) +==31389== by 0x80488DA: main (test4-main.c:142) +==31389== by 0x402E1082: __libc_start_main (in /lib/i686/libc-2.2.5.so) +==31389== by 0x80485F1: cr_om_parser_parse_file (in /home/dodji/dev/libcroco/tests/.libs/test4) +==31389== +==31389== 230 bytes in 8 blocks are still reachable in loss record 4 of 6 +==31389== at 0x4003BAB5: malloc (vg_clientfuncs.c:100) +==31389== by 0x4025F739: g_malloc (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x4027842A: g_tree_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x4025EC1E: g_mem_chunk_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40271523: g_string_sized_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40271588: g_string_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x402B021D: cr_tknzr_parse_string (cr-tknzr.c:768) +==31389== by 0x402B44E5: cr_tknzr_get_next_token (cr-tknzr.c:2713) +==31389== by 0x402B8247: cr_parser_try_to_skip_spaces_and_comments (cr-parser.c:832) +==31389== by 0x402BB4A7: cr_parser_parse_charset (cr-parser.c:3026) +==31389== by 0x402BD767: cr_parser_parse_stylesheet (cr-parser.c:4408) +==31389== by 0x402BE6BF: cr_parser_parse (cr-parser.c:5086) +==31389== by 0x402BE8B4: cr_parser_parse_from_file (cr-parser.c:5144) +==31389== by 0x402C2E74: cr_om_parser_parse_file (cr-om-parser.c:847) +==31389== by 0x804880E: test_cr_parser_parse (test4-main.c:100) +==31389== by 0x80488DA: main (test4-main.c:142) +==31389== by 0x402E1082: __libc_start_main (in /lib/i686/libc-2.2.5.so) +==31389== by 0x80485F1: cr_om_parser_parse_file (in /home/dodji/dev/libcroco/tests/.libs/test4) +==31389== +==31389== 5120 bytes in 4 blocks are still reachable in loss record 5 of 6 +==31389== at 0x4003BAB5: malloc (vg_clientfuncs.c:100) +==31389== by 0x4025F05F: g_mem_chunk_alloc (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40271457: g_string_sized_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40271588: g_string_new (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x402B021D: cr_tknzr_parse_string (cr-tknzr.c:768) +==31389== by 0x402B44E5: cr_tknzr_get_next_token (cr-tknzr.c:2713) +==31389== by 0x402B8247: cr_parser_try_to_skip_spaces_and_comments (cr-parser.c:832) +==31389== by 0x402BB4A7: cr_parser_parse_charset (cr-parser.c:3026) +==31389== by 0x402BD767: cr_parser_parse_stylesheet (cr-parser.c:4408) +==31389== by 0x402BE6BF: cr_parser_parse (cr-parser.c:5086) +==31389== by 0x402BE8B4: cr_parser_parse_from_file (cr-parser.c:5144) +==31389== by 0x402C2E74: cr_om_parser_parse_file (cr-om-parser.c:847) +==31389== by 0x804880E: test_cr_parser_parse (test4-main.c:100) +==31389== by 0x80488DA: main (test4-main.c:142) +==31389== by 0x402E1082: __libc_start_main (in /lib/i686/libc-2.2.5.so) +==31389== by 0x80485F1: cr_om_parser_parse_file (in /home/dodji/dev/libcroco/tests/.libs/test4) +==31389== +==31389== 32640 bytes in 1 blocks are still reachable in loss record 6 of 6 +==31389== at 0x4003BAB5: malloc (vg_clientfuncs.c:100) +==31389== by 0x402E1CFF: (within /lib/i686/libc-2.2.5.so) +==31389== by 0x402E1865: iconv_open (in /lib/i686/libc-2.2.5.so) +==31389== by 0x402439E3: (within /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40241D2D: g_convert (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x4024221C: g_convert_with_fallback (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x40261F26: g_print (in /usr/lib/libglib-2.0.so.0.0.6) +==31389== by 0x402BF7EA: cr_statement_dump_charset (cr-statement.c:259) +==31389== by 0x402C1226: cr_statement_dump (cr-statement.c:1196) +==31389== by 0x402C14CF: cr_stylesheet_dump (cr-stylesheet.c:74) +==31389== by 0x804882B: test_cr_parser_parse (test4-main.c:104) +==31389== by 0x80488DA: main (test4-main.c:142) +==31389== by 0x402E1082: __libc_start_main (in /lib/i686/libc-2.2.5.so) +==31389== by 0x80485F1: cr_om_parser_parse_file (in /home/dodji/dev/libcroco/tests/.libs/test4) +==31389== +==31389== LEAK SUMMARY: +==31389== definitely lost: 0 bytes in 0 blocks. +==31389== possibly lost: 0 bytes in 0 blocks. +==31389== still reachable: 38298 bytes in 19 blocks. +==31389== +--31389-- lru: 50 epochs, 0 clearings. +--31389-- translate: new 5784 (81473 -> 1079851), discard 0 (0 -> 0). +--31389-- dispatch: 2500000 basic blocks, 52/15905 sched events, 10797 tt_fast misses. +--31389-- reg-alloc: 1906 t-req-spill, 196526+11325 orig+spill uis, 29392 total-reg-r. +--31389-- sanity: 53 cheap, 3 expensive checks. diff --git a/tests/vg b/tests/vg new file mode 100755 index 0000000..c7851b2 --- /dev/null +++ b/tests/vg @@ -0,0 +1,15 @@ +#!/bin/sh + +OUTPUT_FILE=valgrind.log +VG=`which valgrind` +VG_OPTIONS="-v --num-callers=100 --leak-check=yes --show-reachable=yes" + +#Some sanity checks +if test "empty$VG" = "empty" ; then + echo "You should install valgrind and set it binary into your" + echo "\$PATH env variable" + echo "go to http://developer.kde.org/~sewardj/ to dowload valgring" + exit +fi + +exec $VG $VG_OPTIONS $@ 2>$OUTPUT_FILE
\ No newline at end of file |