diff options
author | svu <svu> | 2004-04-25 19:26:03 +0000 |
---|---|---|
committer | svu <svu> | 2004-04-25 19:26:03 +0000 |
commit | 44e7cb05ce922e794b7b75489d2f4f0691c3dbd7 (patch) | |
tree | cba9cc4339b740cf8f753fb5ab187881752491eb /tests | |
parent | 84751d9b2d500cd8b7bb5733700c67da76c7db3a (diff) |
starting test scripts
Diffstat (limited to 'tests')
-rw-r--r-- | tests/listCIs.xsl | 15 | ||||
-rw-r--r-- | tests/testModels.pl | 80 |
2 files changed, 95 insertions, 0 deletions
diff --git a/tests/listCIs.xsl b/tests/listCIs.xsl new file mode 100644 index 00000000..0d2cd979 --- /dev/null +++ b/tests/listCIs.xsl @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > +<xsl:output method="text"/> + + <xsl:param name="type"/> + + <xsl:template match="configItem"> + <xsl:if test="name(..) = $type"> + <xsl:value-of select="./name"/> + </xsl:if> + </xsl:template> + +</xsl:stylesheet> diff --git a/tests/testModels.pl b/tests/testModels.pl new file mode 100644 index 00000000..a0fd30bd --- /dev/null +++ b/tests/testModels.pl @@ -0,0 +1,80 @@ +#!/bin/env perl + +use strict; + +my $origXkbRules; +my $origXkbModel; +my $origXkbLayouts; +my $origXkbOptions; +my $origXkbVariants; + +sub backupXkbSettings +{ + open (XPROP, "xprop -root |") or die "Could not start xprop"; + PROP: while (<XPROP>) + { + if (/_XKB_RULES_NAMES\(STRING\) = \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\"/) + { + ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ) = + ( $1, $2, $3, $4, $5 ) ; + last PROP; + } + } + close XPROP; +} + +sub setXkbSettings +{ + my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_; + ( system ( "setxkbmap", + "-rules", $xkbRules, + "-model", $xkbModel, + "-layout", $xkbLayouts, + "-variant", $xkbVariants, + "-option", $xkbOptions ) == 0 ) or die "Could not set xkb configuration"; +} + +sub restoreXkbSettings +{ + setXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ); +} + +sub dumpXkbSettings +{ + my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_; + print "rules: [$xkbRules]\n" ; + print "model: [$xkbModel]\n" ; + print "layouts: [$xkbLayouts]\n" ; + print "variants: [$xkbVariants]\n" ; + print "options: [$xkbOptions]\n" ; +} + +sub testLevel1 +{ + my ( $type, $idx ) = @_; + + open ( XSLTPROC, "xsltproc --stringparam type $type listCIs.xsl ../rules/base.xml.in |" ) or + die ( "Could not start xsltproc" ); + while (<XSLTPROC>) + { + chomp(); + if (/(\w+)/) + { + my $paramValue=$1; + print "--- setting $type: [$paramValue]\n"; + my @params = ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ); + @params[$idx] = $paramValue; + dumpXkbSettings ( @params ); + setXkbSettings ( @params ); + } + } + close XSLTPROC; +} + +backupXkbSettings(); + +dumpXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ); + +testLevel1( "model", 1 ); + +restoreXkbSettings(); |