summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorsvu <svu>2004-04-25 23:57:43 +0000
committersvu <svu>2004-04-25 23:57:43 +0000
commit77e5e7bc4f8b04f2a1eb1d1cf92675fe861c824a (patch)
tree4c3bb0c349e301b1e25c20175684b2be28f47aca /tests
parent44e7cb05ce922e794b7b75489d2f4f0691c3dbd7 (diff)
trying to test layouts as well
Diffstat (limited to 'tests')
-rw-r--r--tests/listCI2.xsl16
-rw-r--r--tests/testModels.pl64
2 files changed, 75 insertions, 5 deletions
diff --git a/tests/listCI2.xsl b/tests/listCI2.xsl
new file mode 100644
index 0000000..894096a
--- /dev/null
+++ b/tests/listCI2.xsl
@@ -0,0 +1,16 @@
+<?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:param name="parentId"/>
+
+ <xsl:template match="configItem">
+ <xsl:if test="name(..) = $type and ../../../configItem/name = $parentId">
+ <xsl:value-of select="./name"/>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/tests/testModels.pl b/tests/testModels.pl
index a0fd30b..7a7cdba 100644
--- a/tests/testModels.pl
+++ b/tests/testModels.pl
@@ -10,23 +10,32 @@ my $origXkbVariants;
sub backupXkbSettings
{
+ ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ) = getXkbSettings();
+}
+
+sub getXkbSettings
+{
+ my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions );
+
open (XPROP, "xprop -root |") or die "Could not start xprop";
PROP: while (<XPROP>)
{
if (/_XKB_RULES_NAMES\(STRING\) = \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\", \"(.*)\"/)
{
- ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions ) =
+ ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) =
( $1, $2, $3, $4, $5 ) ;
last PROP;
}
}
close XPROP;
+
+ return ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions );
}
sub setXkbSettings
{
my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_;
- ( system ( "setxkbmap",
+ ( system ( "setxkbmap", "-synch",
"-rules", $xkbRules,
"-model", $xkbModel,
"-layout", $xkbLayouts,
@@ -39,6 +48,11 @@ sub restoreXkbSettings
setXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions );
}
+sub defaultXkbSettings
+{
+ return ( "base", "pc105", "us", "", "" );
+}
+
sub dumpXkbSettings
{
my ( $xkbRules, $xkbModel, $xkbLayouts, $xkbVariants, $xkbOptions ) = @_;
@@ -58,14 +72,53 @@ sub testLevel1
while (<XSLTPROC>)
{
chomp();
- if (/(\w+)/)
+ if (/(\S+)/)
{
my $paramValue=$1;
print "--- setting $type: [$paramValue]\n";
- my @params = ( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions );
+ my @params = defaultXkbSettings();
@params[$idx] = $paramValue;
dumpXkbSettings ( @params );
setXkbSettings ( @params );
+ #print "--- dump:\n";
+ #dumpXkbSettings( getXkbSettings() );
+ }
+ }
+ close XSLTPROC;
+}
+
+sub testLevel2
+{
+ my ( $type, $subtype, $idx, $delim1, $delim2 ) = @_;
+
+ open ( XSLTPROC, "xsltproc --stringparam type $type listCIs.xsl ../rules/base.xml.in |" ) or
+ die ( "Could not start xsltproc" );
+ while (<XSLTPROC>)
+ {
+ chomp();
+ if (/(\S+)/)
+ {
+ my $paramValue=$1;
+ print "--- scanning $type: [$paramValue]\n";
+
+ open ( XSLTPROC2, "xsltproc --stringparam type $subtype --stringparam parentId $paramValue listCI2.xsl ../rules/base.xml.in |" ) or
+ die ( "Could not start xsltproc" );
+ while (<XSLTPROC2>)
+ {
+ chomp();
+ if (/(\S+)/)
+ {
+ my $paramValue2=$1;
+ print " --- $subtype: [$paramValue2]\n";
+ my @params = defaultXkbSettings();
+ @params[$idx] = "$paramValue$delim1$paramValue2$delim2";
+ dumpXkbSettings ( @params );
+ setXkbSettings ( @params );
+ #print "--- dump:\n";
+ #dumpXkbSettings( getXkbSettings() );
+ }
+ }
+ close XSLTPROa2C;
}
}
close XSLTPROC;
@@ -75,6 +128,7 @@ backupXkbSettings();
dumpXkbSettings( $origXkbRules, $origXkbModel, $origXkbLayouts, $origXkbVariants, $origXkbOptions );
-testLevel1( "model", 1 );
+#testLevel1( "model", 1 );
+testLevel2( "layout", "variant", 2, "(", ")" );
restoreXkbSettings();