NOT PART OF BUILD, testcase harnish.

This is a big overhaul of buster, moving to rdf controlled trees.
The index is now part of the testcases, which makes it easier to keep them
up-to-date. I also started improving the support for HTML testcases. Another
new feature is the support for saving and loading results.
Plus alot of internal cleanup, though there's still more to come.
This commit is contained in:
axel%pike.org 2002-04-19 14:05:47 +00:00
parent dbd5f2cbea
commit 0d8b2b55e5
19 changed files with 1188 additions and 6681 deletions

View File

@ -24,8 +24,11 @@
// DiffDOM(node1,node2)
// ----------------------
function DiffDOM(node1,node2)
var isHTML = false;
function DiffDOM(node1, node2, aIsHTML)
{
isHTML = aIsHTML;
return DiffNodeAndChildren(node1, node2);
}
@ -68,12 +71,19 @@ function DiffNodeAndChildren(node1, node2)
return ErrorUp("Different number of attributes", node1, node2);
}
if (node1.nodeName!=node2.nodeName)
return ErrorUp("Different node names", node1, node2);
if (isHTML) {
if (node1.nodeName.toLowerCase()!=node2.nodeName.toLowerCase())
return ErrorUp("Different node names", node1, node2);
}
else {
if (node1.nodeName!=node2.nodeName)
return ErrorUp("Different node names", node1, node2);
}
if (node1.nodeValue!=node2.nodeValue)
return ErrorUp("Different node values", node1, node2);
if (node1.namespaceURI!=node2.namespaceURI)
return ErrorUp("Different namespace", node1, node2);
if (!isHTML)
if (node1.namespaceURI!=node2.namespaceURI)
return ErrorUp("Different namespace", node1, node2);
if (node1.hasChildNodes() != node2.hasChildNodes())
return ErrorUp("Different children", node1, node2);
if (node1.childNodes) {
@ -97,14 +107,14 @@ function ErrorUp(errMsg, node1, node2)
if (node1.nodeType == Node.TEXT_NODE)
dump("nodeValue: "+node1.nodeValue+"\n");
else
dump("nodeName: "+node1.nodeName+"\n");
dump("nodeName: "+node1.namespaceURI+":"+node1.nodeName+"\n");
}
if (node2) {
dump("Node 2: "+node2+", ");
if (node2.nodeType == Node.TEXT_NODE)
dump("nodeValue: "+node2.nodeValue+"\n");
else
dump("nodeName: "+node2.nodeName+"\n");
dump("nodeName: "+node2.namespaceURI+":"+node2.nodeName+"\n");
}
return false;
}

View File

@ -5,20 +5,18 @@ in http://www.axel.pike.org/mozilla/xalan.tar.gz. Please see the included
LICENSE.txt or http://xml.apache.org/dist/LICENSE.txt for terms of
distributing those files.
To use the buster, open buster.xul with a XSLT enabled Mozilla. Warning,
it takes quite a while until that page is fully loaded, and due to bug
http://bugzilla.mozilla.org/show_bug.cgi?id=70324, we don't have scrolling.
You can use regular expressions to narrow the set of tests to run.
To use the buster, open buster.xul with a XSLT enabled Mozilla.
Open the rdf index file shipped with the test package into the
"Xalan index", and the available tests will show up as a tree.
Once you have selected the tests you're interested in, press the button
"run checked tests", and all the tests will be run.
You can save the results into an rdf, and load it for comparison and
regression hunting.
DiffDOM tries to find out, which tests failed, and will DumpDOM both the
result and the reference solution. Not all reference solutions load
properly, those need manual love.
All of the code was done sleeping, and is not intended as example of good
code. It's for debugging only!
Good luck and fun
Axel Hecht <axel@pike.org>

View File

@ -0,0 +1,127 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TransforMiiX XSLT Processor.
*
* The Initial Developer of the Original Code is
* Axel Hecht.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org>
* Peter Van der Beken <peterv@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
enablePrivilege('UniversalXPConnect');
const kFTSCID = "@mozilla.org/network/file-transport-service;1";
const nsIFileTransportService = Components.interfaces.nsIFileTransportService;
const kFileTransportService = doCreate(kFTSCID, nsIFileTransportService);
var cmdFileController =
{
supportsCommand: function(aCommand)
{
switch(aCommand) {
case 'cmd_fl_save':
case 'cmd_fl_import':
return true;
default:
}
return false;
},
isCommandEnabled: function(aCommand)
{
return this.supportsCommand(aCommand);
},
doCommand: function(aCommand)
{
enablePrivilege('UniversalXPConnect');
switch(aCommand) {
case 'cmd_fl_save':
var serial = doCreate(kRDFXMLSerializerID,
nsIRDFXMLSerializer);
var sink = new Object;
sink.content = '';
sink.write = function(aContent, aCount)
{
this.content += aContent;
return aCount;
};
serial.init(view.memoryDataSource);
serial.QueryInterface(nsIRDFXMLSource);
serial.Serialize(sink);
if (!sink.content.length) {
return;
}
// replace NC:succ with NC:orig_succ, so the rdf stuff differs
var content = sink.content.replace(/NC:succ/g,"NC:orig_succ");
var fp = doCreateRDFFP('Xalan results',
nsIFilePicker.modeSave);
var res = fp.show();
if (res == nsIFilePicker.returnOK ||
res == nsIFilePicker.returnReplace) {
var fl = fp.file;
var trans = kFileTransportService.createTransport
(fl, 26, // NS_WRONLY + NS_CREATE_FILE + NS_TRUNCATE
'w', true);
var out = trans.openOutputStream(0, -1, 0);
out.write(content, content.length);
out.close();
delete out;
delete trans;
fp.file.permissions = 420;
}
break;
case 'cmd_fl_import':
var fp = doCreateRDFFP('Previous Xalan results',
nsIFilePicker.modeLoad);
var res = fp.show();
if (res == nsIFilePicker.returnOK) {
var fl = fp.file;
if (view.previousResults) {
view.database.RemoveDataSource(view.previousResults);
view.previousResults = null;
}
view.database.RemoveDataSource(view.memoryDataSource);
view.previousResults = kRDFSvc.GetDataSource(fp.fileURL.spec);
view.database.AddDataSource(view.previousResults);
view.database.AddDataSource(view.memoryDataSource);
}
document.getElementById('obs_orig_success')
.setAttribute('hidden','false');
break;
default:
alert('Unknown Command'+aCommand);
}
}
};
registerController(cmdFileController);

View File

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TransforMiiX XSLT Processor.
*
* The Initial Developer of the Original Code is
* Axel Hecht.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org>
* Peter Van der Beken <peterv@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var xalan_field;
function onLoad()
{
view.tests_run = document.getElementById("tests_run");
view.tests_passed = document.getElementById("tests_passed");
view.tests_failed = document.getElementById("tests_failed");
view.tests_selected = document.getElementById("tests_selected");
view.tree = document.getElementById('out');
view.boxObject = view.tree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);
enablePrivilege('UniversalXPConnect');
// prune the spurious children of the iframe doc
{
var iframe = document.getElementById('hiddenHtml').contentDocument;
var children = iframe.childNodes;
var cn = children.length;
for (var i = cn-1; i >=0 ; i--) {
if (children[i] != iframe.documentElement)
iframe.removeChild(children[i]);
}
}
view.database = view.tree.database;
view.builder = view.tree.builder.QueryInterface(nsIXULTemplateBuilder);
view.builder.QueryInterface(nsIXULTreeBuilder);
runItem.prototype.kDatabase = view.database;
xalan_field = document.getElementById("xalan_rdf");
var persistedUrl = xalan_field.getAttribute('url');
if (persistedUrl) {
view.xalan_url = persistedUrl;
xalan_field.value = persistedUrl;
}
view.setDataSource();
return true;
}
function onUnload()
{
if (xalan_field)
xalan_field.setAttribute('url', xalan_field.value);
}

View File

@ -0,0 +1,117 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TransforMiiX XSLT Processor.
*
* The Initial Developer of the Original Code is
* Axel Hecht.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org>
* Peter Van der Beken <peterv@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// priviledge shortcut
enablePrivilege = netscape.security.PrivilegeManager.enablePrivilege;
// helper function to shortcut component creation
function doCreate(aContract, aInterface)
{
enablePrivilege('UniversalXPConnect');
return Components.classes[aContract].createInstance(aInterface);
}
// for the items, loading a text file
const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
const nsIIOService = Components.interfaces.nsIIOService;
const SIS_CTRID = "@mozilla.org/scriptableinputstream;1"
const nsISIS = Components.interfaces.nsIScriptableInputStream;
// rdf foo, onload handler
enablePrivilege('UniversalXPConnect');
const kRDFSvcContractID = "@mozilla.org/rdf/rdf-service;1";
const kRDFInMemContractID =
"@mozilla.org/rdf/datasource;1?name=in-memory-datasource";
const kRDFContUtilsID = "@mozilla.org/rdf/container-utils;1";
const kRDFXMLSerializerID = "@mozilla.org/rdf/xml-serializer;1";
const kIOSvcContractID = "@mozilla.org/network/io-service;1";
const kStandardURL = Components.classes["@mozilla.org/network/standard-url;1"];
const nsIURL = Components.interfaces.nsIURL;
const nsIStandardURL = Components.interfaces.nsIStandardURL;
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIXULTreeBuilder = Components.interfaces.nsIXULTreeBuilder;
const nsIXULTemplateBuilder = Components.interfaces.nsIXULTemplateBuilder;
const kIOSvc = Components.classes[kIOSvcContractID]
.getService(Components.interfaces.nsIIOService);
const nsIRDFService = Components.interfaces.nsIRDFService;
const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
const nsIRDFResource = Components.interfaces.nsIRDFResource;
const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
const nsIRDFContainerUtils = Components.interfaces.nsIRDFContainerUtils;
const nsIRDFXMLSerializer = Components.interfaces.nsIRDFXMLSerializer;
const nsIRDFXMLSource = Components.interfaces.nsIRDFXMLSource;
const kRDFSvc =
Components.classes[kRDFSvcContractID].getService(nsIRDFService);
const krTypeCat = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#category");
const krTypeName = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#name");
const krTypeSucc = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#succ");
const krTypePath = kRDFSvc.GetResource("http://home.netscape.com/NC-rdf#path");
const kGood = kRDFSvc.GetLiteral("yes");
const kBad = kRDFSvc.GetLiteral("no");
const kMixed = kRDFSvc.GetLiteral("+-");
const kContUtils = doCreate(kRDFContUtilsID, nsIRDFContainerUtils);
function doCreateRDFFP(aTitle, aMode)
{
enablePrivilege('UniversalXPConnect');
var fp = doCreate("@mozilla.org/filepicker;1", nsIFilePicker);
fp.init(window, aTitle, aMode);
fp.appendFilter('*.rdf', '*.rdf');
fp.appendFilters(nsIFilePicker.filterAll);
return fp;
}
function goDoCommand(aCommand)
{
try {
enablePrivilege('UniversalXPConnect');
var controller =
top.document.commandDispatcher.getControllerForCommand(aCommand);
if (controller && controller.isCommandEnabled(aCommand))
controller.doCommand(aCommand);
}
catch(e) {
dump("An error "+e+" occurred executing the "+aCommand+" command\n");
}
}
function registerController(aController)
{
top.controllers.appendController(aController);
}

View File

@ -0,0 +1,314 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TransforMiiX XSLT Processor.
*
* The Initial Developer of the Original Code is
* Axel Hecht.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org>
* Peter Van der Beken <peterv@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var parser = new DOMParser();
var runQueue =
{
mArray : new Array(),
push : function(aRunItem)
{
this.mArray.push(aRunItem);
},
observe : function(aSubject, aTopic, aData)
{
item = this.mArray.shift();
if (item) {
item.run(this);
}
},
run : function()
{
this.observe(null,'','');
}
}
var itemCache =
{
mArray : new Array(),
getItem : function(aResource)
{
enablePrivilege('UniversalXPConnect');
// Directory selected
if (kContUtils.IsSeq(runItem.prototype.kDatabase, aResource)) {
var aSeq = kContUtils.MakeSeq(runItem.prototype.kDatabase, aResource);
dump("sequence: "+aSeq+" with "+aSeq.GetCount()+" elements\n");
var child, children = aSeq.GetElements();
var m = 0, first;
while (children.hasMoreElements()) {
m += 1;
child = children.getNext();
child.QueryInterface(nsIRDFResource);
if (!first)
first = itemCache.getItem(child);
else
itemCache.getItem(child);
}
return first;
}
var retItem = this.mArray[aResource.Value];
if (retItem) {
return retItem;
}
retItem = new runItem(aResource);
this.mArray[aResource.Value] = retItem;
runQueue.push(retItem);
return retItem;
},
rerunItem : function(aResource, aObserver)
{
var anItem = new runItem(aResource);
this.mArray[aResource.Value] = anItem;
anItem.run(aObserver);
},
observe : function(aSubject, aTopic, aData)
{
this.mRun += 1;
if (aTopic == "success") {
if (aData == "yes") {
this.mGood += 1;
}
else {
this.mFalse +=1;
}
}
}
}
function runItem(aResource)
{
enablePrivilege('UniversalXPConnect');
this.mResource = aResource;
// Directory selected
if (kContUtils.IsSeq(this.kDatabase,this.mResource)) {
var aSeq = kContUtils.MakeSeq(this.kDatabase,this.mResource);
dump("THIS SHOULDN'T HAPPEN\n");
var child, children = aSeq.GetElements();
var m = 0;
while (children.hasMoreElements()) {
m += 1;
child = children.getNext();
child.QueryInterface(nsIRDFResource);
itemCache.getItem(child);
}
}
}
enablePrivilege('UniversalXPConnect');
runItem.prototype =
{
// RDF resource associated with this test
mResource : null,
// XML documents for the XSLT transformation
mSourceDoc : null,
mStyleDoc : null,
mResDoc : null,
// XML or plaintext document for the reference
mRefDoc : null,
// bitfield signaling the loaded documents
mLoaded : 0,
kSource : 1,
kStyle : 2,
kReference : 4,
// a observer, potential argument to run()
mObserver : null,
mSuccess : null,
mMethod : 'xml',
// XSLTProcessor, shared by the instances
kProcessor : new XSLTProcessor(),
kXalan : kStandardURL.createInstance(nsIURL),
kDatabase : null,
kObservers : new Array(),
run : function(aObserver)
{
if (aObserver && typeof(aObserver)=='function' ||
(typeof(aObserver)=='object' &&
typeof(aObserver.observe)=='function')) {
this.mObserver=aObserver;
}
var name = this.kDatabase.GetTarget(this.mResource, krTypeName, true);
if (name) {
var cat = this.kDatabase.GetTarget(this.mResource, krTypeCat, true);
var path = this.kDatabase.GetTarget(this.mResource, krTypePath, true);
cat = cat.QueryInterface(nsIRDFLiteral);
name = name.QueryInterface(nsIRDFLiteral);
path = path.QueryInterface(nsIRDFLiteral);
xalan_fl = this.kXalan.resolve(cat.Value+"/"+path.Value);
xalan_ref = this.kXalan.resolve(cat.Value+"-gold/"+path.Value);
dump(name.Value+" links to "+xalan_fl+"\n");
}
// Directory selected
if (kContUtils.IsSeq(this.kDatabase,this.mResource)) {
return;
var aSeq = kContUtils.MakeSeq(this.kDatabase,this.mResource);
dump("sequence: "+aSeq+" with "+aSeq.GetCount()+" elements\n");
var child, children = aSeq.GetElements();
var m = 0;
while (children.hasMoreElements()) {
m += 1;
child = children.getNext();
child.QueryInterface(nsIRDFResource);
//var aFoo = new runItem(child);
}
}
var refContent = this.loadTextFile(xalan_ref+".out");
if (refContent.match(/^<\?xml/)) {
this.mRefDoc = parser.parseFromString(refContent, 'text/xml');
}
else if (refContent.match(/^\s*<html/gi)) {
this.mMethod = 'html';
var iframe = document.getElementById('hiddenHtml').contentDocument;
iframe.documentElement.innerHTML = refContent;
//this.mRefDoc = iframe.documentElement.cloneNode(true);
this.mRefDoc = iframe;
DumpDOM(this.mRefDoc)
}
this.mSourceDoc = document.implementation.createDocument('', '', null);
this.mSourceDoc.addEventListener("load",this.onload(1),false);
this.mSourceDoc.load(xalan_fl+".xml");
this.mStyleDoc = document.implementation.createDocument('', '', null);
this.mStyleDoc.addEventListener("load",this.onload(2),false);
this.mStyleDoc.load(xalan_fl+".xsl");
},
// onload handler helper
onload : function(file)
{
var self = this;
return function(e)
{
return self.fileLoaded(file);
};
},
fileLoaded : function(mask)
{
this.mLoaded += mask;
if (this.mLoaded < 3) {
return;
}
enablePrivilege('UniversalXPConnect');
this.mResDoc = document.implementation.createDocument("", "", null);
this.kProcessor.transformDocument(this.mSourceDoc,
this.mStyleDoc,
this.mResDoc, null);
this.mRefDoc.normalize();
try {
isGood = DiffDOM(this.mResDoc.documentElement,
this.mRefDoc.documentElement,
this.mMethod == 'html');
} catch (e) {
isGood = false;
};
dump("This succeeded. "+isGood+"\n");
if (!isGood) {
DumpDOM(this.mResDoc);
DumpDOM(this.mRefDoc);
}
isGood = isGood.toString();
for (var i=0; i<this.kObservers.length; i++) {
var aObs = this.kObservers[i];
if (typeof(aObs)=='object' && typeof(aObs.observe)=='function') {
aObs.observe(this.mResource, 'success', isGood);
}
else if (typeof(aObs)=='function') {
aObs(this.mResource, 'success', isGood);
}
}
if (this.mObserver) {
if (typeof(this.mObserver)=='object') {
this.mObserver.observe(this.mResource, 'success', isGood);
}
else {
this.mObserver(this.mResource, 'success', isGood);
}
}
},
loadTextFile : function(url)
{
enablePrivilege('UniversalXPConnect');
var serv = Components.classes[IOSERVICE_CTRID].
getService(nsIIOService);
if (!serv) {
throw Components.results.ERR_FAILURE;
}
var chan = serv.newChannel(url, null, null);
var instream = doCreate(SIS_CTRID, nsISIS);
instream.init(chan.open());
return instream.read(instream.available());
}
}
runItem.prototype.kXalan.QueryInterface(nsIStandardURL);
var cmdTestController =
{
supportsCommand: function(aCommand)
{
switch(aCommand) {
case 'cmd_tst_run':
case 'cmd_tst_runall':
return true;
default:
}
return false;
},
isCommandEnabled: function(aCommand)
{
return this.supportsCommand(aCommand);
},
doCommand: function(aCommand)
{
switch(aCommand) {
case 'cmd_tst_run':
dump("cmd_tst_run\n");
break;
case 'cmd_tst_runall':
dump("cmd_tst_runall\n");
var tst_run = document.getElementById('cmd_tst_run');
tst_run.doCommand();
default:
}
}
};
registerController(cmdTestController);

View File

@ -0,0 +1,164 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TransforMiiX XSLT Processor.
*
* The Initial Developer of the Original Code is
* Axel Hecht.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org>
* Peter Van der Beken <peterv@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var view =
{
onRun : function()
{
var sels = this.boxObject.selection,a=new Object(),b=new Object(),k;
var rowResource, name, path;
enablePrivilege('UniversalXPConnect');
for (k=0;k<sels.getRangeCount();k++){
sels.getRangeAt(k,a,b);
for (var l=a.value;l<=b.value;l++) {
rowResource = this.builder.getResourceAtIndex(l);
itemCache.getItem(rowResource);
}
}
runQueue.run();
},
displayTest : function()
{
var current = this.boxObject.selection.currentIndex;
enablePrivilege('UniversalXPConnect');
var rowResource = this.builder.getResourceAtIndex(current);
var item = itemCache.getItem(rowResource);
DumpDOM(item.mSourceDoc);
DumpDOM(item.mStyleDoc);
},
browseForRDF : function()
{
enablePrivilege('UniversalXPConnect');
var fp = doCreateRDFFP('Xalan Description File',
nsIFilePicker.modeOpen);
var res = fp.show();
if (res == nsIFilePicker.returnOK) {
var furl = fp.fileURL;
this.setDataSource(fp.fileURL.spec);
}
},
dump_Good : function()
{
enablePrivilege('UniversalXPConnect');
var enumi = this.database.GetSources(krTypeSucc, kGood, true);
var k = 0;
while (enumi.hasMoreElements()) {
k += 1;
dump(enumi.getNext().QueryInterface(nsIRDFResource).Value+"\n");
}
dump("found "+k+" good tests\n");
},
prune_ds : function()
{
enablePrivilege('UniversalXPConnect');
this.unassert(this.database.GetSources(krTypeSucc, kGood, true),
kGood);
this.unassert(this.database.GetSources(krTypeSucc, kBad, true),
kBad);
this.unassert(this.database.GetSources(krTypeSucc, kMixed, true),
kMixed);
runQueue.mArray = new Array();
itemCache.mArray = new Array();
},
unassert : function(aEnum, aResult)
{
enablePrivilege('UniversalXPConnect');
var k = 0, item;
while (aEnum.hasMoreElements()) {
k += 1;
var item = aEnum.getNext();
try {
item = item.QueryInterface(nsIRDFResource);
this.database.Unassert(item, krTypeSucc, aResult, true);
} catch (e) {
dump("Can't unassert "+item+"\n");
}
}
},
setDataSource : function(aSpec)
{
var baseSpec;
if (aSpec) {
baseSpec = aSpec;
}
else {
baseSpec = document.getElementById("xalan_rdf").value;
}
dump(baseSpec+"\n");
var currentSources = this.database.GetDataSources();
while (currentSources.hasMoreElements()) {
var aSrc = currentSources.getNext().
QueryInterface(nsIRDFDataSource);
this.database.RemoveDataSource(aSrc);
}
var ds = kRDFSvc.GetDataSource(baseSpec);
if (!ds) {
alert("Unable do load DataSource: "+baseSpec);
return;
}
view.database.AddDataSource(ds);
view.memoryDataSource = doCreate(kRDFInMemContractID,
nsIRDFDataSource);
if (!view.memoryDataSource) {
alert("Unable to create write-protect InMemDatasource,"+
" not adding "+ baseSpec);
this.database.RemoveDataSource(ds);
}
view.database.AddDataSource(view.memoryDataSource);
view.builder.rebuild();
document.getElementById("xalan_rdf").value = baseSpec;
runItem.prototype.kXalan.init(runItem.prototype.kXalan.URLTYPE_STANDARD,
0, baseSpec, null, null);
}
}
function rdfObserve(aSubject, aTopic, aData)
{
if (aTopic == "success") {
if (aData == "true") {
view.database.Assert(aSubject, krTypeSucc, kGood, true);
}
else {
view.database.Assert(aSubject, krTypeSucc, kBad, true);
}
}
}
runItem.prototype.kObservers.push(rdfObserve);

View File

@ -13,36 +13,26 @@
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Axel Hecht.
* Portions created by Axel Hecht are Copyright (C) 2001 Axel Hecht.
* Portions created by Axel Hecht are Copyright (C) 2002 Axel Hecht.
* All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org> (Original Author)
*/
text.head {
label.head {
padding: 5px;
font-size: medium;
font-weight: bold;
}
treechildren:-moz-tree-row(success)
treechildren:-moz-tree-cell(success yes)
{
background-color: green;
background-color: green ;
}
treechildren:-moz-tree-row(fail)
treechildren:-moz-tree-cell(success no)
{
background-color: red;
}
treechildren:-moz-tree-row(selected)
{
border: 1px solid blue;
background-color: white ;
}
treechildren:-moz-tree-cell-text(selected)
{
color: black;
background-color: red ;
}

View File

@ -22,34 +22,79 @@
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="txTools.css" type="text/css"?>
<?xml-stylesheet href="buster.css" type="text/css"?>
<window id="XalanBuster"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="loaderstuff()"
onload="onLoad()" onunload="onUnload()"
title="Xalan testcase harnish"
orient="vertical">
<script type="application/x-javascript" src="DiffDOM.js" />
<script type="application/x-javascript" src="txTools.js" />
<script type="application/x-javascript" src="xulTxTools.js" />
<script type="application/x-javascript" src="buster-statics.js" />
<script type="application/x-javascript" src="buster-test.js" />
<script type="application/x-javascript" src="buster-view.js" />
<script type="application/x-javascript" src="buster-handlers.js" />
<script type="application/x-javascript" src="result-view.js" />
<script type="application/x-javascript" src="buster-files.js" />
<script type="application/x-javascript" src="DumpDOM.js" />
<script type="application/x-javascript" src="DiffDOM.js" />
<commands id="busterKing">
<commandset id="buster_file_cmds">
<command id="cmd_fl_save" oncommand="goDoCommand('cmd_fl_save')" />
<command id="cmd_fl_import" oncommand="goDoCommand('cmd_fl_import')"/>
</commandset>
<commandset id="buster_test_cmds">
<command id="cmd_tst_run" oncommand="goDoCommand('cmd_tst_run')" />
<command id="cmd_tst_runall" oncommand="goDoCommand('cmd_tst_runall')" />
</commandset>
</commands>
<broadcasterset>
<broadcaster id="obs_orig_success" hidden="true"/>
<broadcaster id="not_yet" disabled="true"/>
</broadcasterset>
<menubar>
<menu id="busterFile" label="File" accesskey="f">
<menupopup id="file-popup">
<menuitem label="Save results ..." accesskey="s"
observes="cmd_fl_save"/>
<menuitem label="Import results ..." accesskey="i"
observes="cmd_fl_import"/>
</menupopup>
</menu>
<menu id="busterTests" label="Tests" accesskey="t">
<menupopup id="tests-popup">
<menuitem label="run a test" accesskey="r"
observes="cmd_tst_run"/>
<menuitem label="run all tests" accesskey="a"
observes="cmd_tst_runall"/>
</menupopup>
</menu>
</menubar>
<popupset>
<popup id="itemcontext">
<menuitem label="View Test" oncommand="onNewResultView(event)"/>
</popup>
</popupset>
<hbox>
<button label="load tests" oncommand="refresh_xalan()" />
<button label="check all" oncommand="check(true)" />
<button label="uncheck all" oncommand="check(false)" />
<button label="invert checks" oncommand="invert_check()" />
<button label="hide checked" oncommand="hide_checked(true)" />
<button label="hide unchecked" oncommand="hide_checked(false)" />
<button label="run checked tests" oncommand="dump_checked()" />
<button label="check all" oncommand="check(true)" observes="not_yet"/>
<button label="uncheck all" oncommand="check(false)" observes="not_yet"/>
<button label="reset success" oncommand="view.prune_ds()" />
<button label="run checked tests" oncommand="view.onRun()" />
</hbox>
<hbox>
<text value="Xalan base directory: " class="head" />
<textbox id="xalan_base" persist="value"/>
<button label="browse..." oncommand="browse_base_dir()" />
<label value="Xalan index: " class="head"/>
<textbox id="xalan_rdf" persist="url" crop="end" size="40"/>
<button label="browse..." oncommand="view.browseForRDF()" />
</hbox>
<hbox>
<groupbox orient="horizontal"><caption label="search" />
<button label="Search for " oncommand="select()"/>
<textbox style="width: 10em;" id="search-name" persist="value" /><text value=" in " />
<menulist id="search-field" persist="data">
<button label="Search for " oncommand="select()" observes="not_yet"/>
<textbox style="width: 10em;" id="search-name" persist="value" /><label value=" in " />
<menulist id="search-field" persist="data" observes="not_yet">
<menupopup>
<menuitem value="1" label="Name" />
<menuitem value="2" label="Purpose" />
@ -58,27 +103,99 @@
</menulist>
</groupbox>
<groupbox orient="horizontal"><caption label="select" />
<button label="Select from " oncommand="selectRange()"/>
<button label="Select from " oncommand="selectRange()" observes="not_yet"/>
<textbox style="width: 10em;" id="start-field" persist="value" />
<text value=" to " />
<label value=" to " />
<textbox style="width: 10em;" id="end-field" persist="value" />
</groupbox>
<spacer flex="1" /></hbox>
<hbox><groupbox orient="horizontal"><caption label="stats" />
<text value="tests run: "/><text id="tests_run" value="0" />
<text value=" tests passed: "/><text id="tests_passed" value="0"/>
<text value=" tests failed: "/><text id="tests_failed" value="0"/>
<text value=" tests selected: "/><text id="tests_selected" value="0"/>
<label value="tests run: "/><label id="tests_run" value="0" />
<label value=" tests passed: "/><label id="tests_passed" value="0"/>
<label value=" tests failed: "/><label id="tests_failed" value="0"/>
<label value=" tests selected: "/><label id="tests_selected" value="0"/>
</groupbox>
<spacer flex="1" /></hbox>
<tree id="out" flex="1" onselect="sel_change()">
<tree id="out" flex="1" flags="dont-build-content"
datasources="rdf:null" ref="urn:root"
context="itemcontext">
<treecols>
<treecol id="name" label="Name" flex="1"/>
<treecol id="purp" label="Purpose" flex="2"/>
<treecol id="comm" label="Comment" flex="1"/>
<treecol id="NameColumn" flex="1" label="Name" sort="?name"
primary="true" />
<splitter />
<treecol id="PurpsColumn" flex="2" label="Purpose" sort="?purp" />
<splitter />
<treecol id="SuccessColumn" flex="0" label="Success" />
<splitter observes="obs_orig_success" />
<treecol id="OrigSuccessColumn" flex="0" label="Previously"
observes="obs_orig_success" />
</treecols>
<treechildren/>
</tree>
<template>
<rule>
<conditions>
<treeitem uri="?uri" />
<member container="?uri" child="?subheading" />
<triple subject="?subheading"
predicate="http://home.netscape.com/NC-rdf#purp"
object="?purp" />
</conditions>
<bindings>
<binding subject="?subheading"
predicate="http://home.netscape.com/NC-rdf#name"
object="?name" />
<binding subject="?subheading"
predicate="http://home.netscape.com/NC-rdf#succ"
object="?succ" />
<binding subject="?subheading"
predicate="http://home.netscape.com/NC-rdf#orig_succ"
object="?orig_succ" />
</bindings>
<action>
<treechildren>
<treeitem uri="?subheading" >
<treerow>
<treecell ref="NameColumn" label="?name" />
<treecell ref="PurpsColumn" label="?purp" />
<treecell ref="SuccessColumn" label="?succ"
properties="success ?succ"/>
<treecell ref="OrigSuccessColumn" label="?orig_succ"
properties="success ?orig_succ"
/>
</treerow>
</treeitem>
</treechildren>
</action>
</rule>
<rule>
<conditions>
<treeitem uri="?uri" />
<member container="?uri" child="?subheading" />
</conditions>
<bindings>
<binding subject="?subheading"
predicate="http://home.netscape.com/NC-rdf#dir"
object="?dir" />
<binding subject="?subheading"
predicate="http://home.netscape.com/NC-rdf#succ"
object="?succ" />
</bindings>
<action>
<treechildren>
<treeitem uri="?subheading" >
<treerow>
<treecell ref="NameColumn" label="?dir" />
<treecell ref="SuccessColumn" label="?succ" />
</treerow>
</treeitem>
</treechildren>
</action>
</rule>
</template>
</tree>
<iframe style="visibility:hidden; height:0px;" id="hiddenHtml" />
</window>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
use File::Spec;
use File::Glob ':glob';
my(@chunks);
@list = ('conf');
go_in('conf', '', 'conf');
#exit 0;
print '<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#">
<rdf:Seq about="urn:root">
<rdf:li><rdf:Description ID="conf" nc:dir="conf" /></rdf:li>
<rdf:li><rdf:Description ID="contrib" nc:dir="contrib" /></rdf:li>
<rdf:li><rdf:Description ID="perf" nc:dir="perf" /></rdf:li>
</rdf:Seq>
';
print join('',@chunks);
print '</rdf:RDF>
';
exit 0;
sub go_in {
my($current, $about, $cat) = @_;
my (@list, $entry, @subdirs, @files, @purps, $rdf);
chdir $current;
@list = glob('*');
LOOP: foreach $entry (@list) {
next LOOP if $entry=~/^CVS$/;
if (! -d $entry) {
if ($entry=~/^($current.*)\.xsl$/) {
push(@files, $1);
local ($purp);
open STYLE, $entry;
while (<STYLE>) {
if (/<!--\s+Purpose: (.+)\s*-->/) {
$purp .= $1;
}
}
$purp=~s/"/'/g; $purp=~s/&/&amp;/g; $purp=~s/</&lt;/g;
push(@purps, $purp);
}
}
else {
push(@subdirs, $entry);
}
}
#print join(" ", @subdirs)."\n";
my $topic = $about.$current; $topic=~s/\///g;
$rdf = '<rdf:Seq about="#'.$topic."\" >\n";
foreach $entry (@subdirs) {
my $id = $about.$current.$entry; $id=~s/\///g;
$rdf .= "<rdf:li><rdf:Description ID=\"$id\" nc:dir=\"$entry\" /></rdf:li>\n";
}
for (my $i=0; $i < @files; $i++) {
my $uri = $about.$current.'/'.$files[$i];
$uri=~s/[^\/]+\///;
my $id = $uri; $id=~s/\///g;
$rdf .= "<rdf:li><rdf:Description ID=\"$files[$i]\" nc:name=\"$files[$i]\" nc:purp=\"$purps[$i]\" nc:path=\"$uri\" nc:category=\"$cat\"/></rdf:li>\n";
}
$rdf .= "</rdf:Seq>\n";
push(@chunks, $rdf);
#print join(" ", @files)."\n";
foreach $entry (@subdirs) {
go_in($entry, $about.$current.'/', $cat);
}
chdir File::Spec->updir;
}

View File

@ -1,38 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:preserve-space elements="xalan sheet" />
<xsl:output method="xml" indent="yes" />
<xsl:template match="/xalan">
<xalantests>
<xsl:for-each select="sheet">
<xsl:message>Loading <xsl:value-of select='.' /></xsl:message>
<xsl:variable name="stylesheet" select="document(concat(.,'.xsl'))" />
<test>
<xsl:attribute name="file"><xsl:value-of select="." /></xsl:attribute>
<xsl:apply-templates select="$stylesheet//comment()" />
</test>
</xsl:for-each>
</xalantests>
</xsl:template>
<xsl:template match="comment()">
<xsl:choose>
<xsl:when test="starts-with(translate(.,'PUROSE','purose'),' purpose:')">
<purpose>
<xsl:value-of select="normalize-space(substring(.,11))" />
</purpose>
<xsl:variable name="cs"
select="normalize-space(following-sibling::comment())" />
<xsl:if test="string-length($cs)
and not(starts-with($cs,'Author:'))
and not(starts-with($cs,'Creator:'))
and not(starts-with($cs,'ExpectedException:'))">
<comment>
<xsl:value-of
select="$cs" />
</comment>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,12 @@
label.heading {
font-size: medium;
font-weight: bold;
}
button.close {
font-size: small;
}
iframe {
padding-left: 10px;
}

View File

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TransforMiiX XSLT Processor.
*
* The Initial Developer of the Original Code is
* Axel Hecht.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org>
* Peter Van der Beken <peterv@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var currentResultItem = new Object();
function onNewResultView(event)
{
const db = runItem.prototype.kDatabase;
const kXalan = runItem.prototype.kXalan;
var index = view.boxObject.selection.currentIndex;
enablePrivilege('UniversalXPConnect');
var res = view.builder.getResourceAtIndex(index);
var name = db.GetTarget(res, krTypeName, true);
if (!name) {
return false;
}
var cat = db.GetTarget(res, krTypeCat, true);
var path = db.GetTarget(res, krTypePath, true);
cat = cat.QueryInterface(nsIRDFLiteral);
name = name.QueryInterface(nsIRDFLiteral);
path = path.QueryInterface(nsIRDFLiteral);
xalan_fl = kXalan.resolve(cat.Value+"/"+path.Value);
xalan_ref = kXalan.resolve(cat.Value+"-gold/"+path.Value);
currentResultItem.testpath = xalan_fl;
currentResultItem.refpath = xalan_ref;
dump(name.Value+" links to "+xalan_fl+"\n");
var win = window.openDialog('result-view.xul','txBusterResult',
'chrome,width=800,height=800,dialog=no',
currentResultItem);
}
function onResultViewLoad(event)
{
var arg = window.arguments[0];
document.getElementById('src').setAttribute('src', 'view-source:'+
arg.testpath+'.xml');
document.getElementById('style').setAttribute('src', 'view-source:'+
arg.testpath+'.xsl');
document.getElementById('ref').setAttribute('src', arg.refpath+'.out');
return true;
}

View File

@ -0,0 +1,53 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is mozilla.org.
The Initial Developer of the Original Code is Axel Hecht.
Portions created by Axel Hecht are Copyright (C) 2002 Axel Hecht.
All Rights Reserved.
Contributor(s):
Axel Hecht <axel@pike.org> (Original Author)
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="result-view.css" type="text/css"?>
<window id="buster-result-view"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
onload="onResultViewLoad()">
<script type="application/x-javascript" src="DumpDOM.js" />
<script type="application/x-javascript" src="buster-statics.js" />
<script type="application/x-javascript" src="buster-test.js" />
<script type="application/x-javascript" src="result-view.js" />
<script>
</script>
<hbox>
<button class="close" label="close this window"
oncommand="window.close()" />
</hbox>
<vbox flex="1">
<label class="heading" value="XML Source:" />
<iframe flex="1" id="src" />
</vbox>
<vbox flex="1">
<label class="heading" value="XSL Source:" />
<iframe flex="1" id="style" />
</vbox>
<vbox flex="1">
<label class="heading" value="Reference Source:" />
<iframe flex="1" id="ref" />
</vbox>
</window>

View File

@ -1,146 +0,0 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Axel Hecht.
* Portions created by Axel Hecht are Copyright (C) 2001 Axel Hecht.
* All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org> (Original Author)
*/
var name_array,index_array;
function do_transforms(new_name_array,new_number_array,verbose){
if (new_name_array) {
name_array=new_name_array;
index_array=new_number_array;
dump("\n==============================\n");
dump("TransforMiiX regression buster\n");
dump("==============================\n");
}
if (name_array.length){
new txDocSet(name_array.shift(),index_array.shift());
}
}
function txDocSet(name,index,verbose){
this.mName = name;
this.mIndex = index;
this.mBase = document.getElementById('xalan_base').getAttribute('value');
if (verbose) this.mVerbose=verbose;
this.mSource = document.implementation.createDocument("","",null);
this.mStyle = document.implementation.createDocument("","",null);
this.mResult = document.implementation.createDocument("","",null);
this.mSource.addEventListener("load",this.loaded(1),false);
this.mStyle.addEventListener("load",this.loaded(2),false);
this.mSource.load(this.mBase+"conf/"+name+".xml");
this.mStyle.load(this.mBase+"conf/"+name+".xsl");
this.mIsError = name.match(/\/err\//);
if (this.mIsError){
this.stuffLoaded(4);
} else {
this.mReference = document.implementation.createDocument("","",null);
this.mReference.addEventListener("load",this.loaded(4),false);
this.mReference.load(this.mBase+"conf-gold/"+name+".out");
}
}
txDocSet.prototype = {
mBase : null,
mName : null,
mSource : null,
mStyle : null,
mResult : null,
mReference : null,
mVerbose : false,
mIsError : false,
mLoaded : 0,
mIndex : 0,
loaded : function(i) {
var self = this;
return function(e) { return self.stuffLoaded(i); };
},
stuffLoaded : function(mask) {
if (mask==4 && this.mReference) {
var docElement=this.mReference.documentElement;
if (docElement && docElement.nodeName=="parsererror") {
try {
var text=loadFile(docElement.baseURI);
this.mReference.removeChild(docElement);
var wrapper=this.mReference.createElement("transformiix:result");
var textNode=this.mReference.createTextNode(text);
wrapper.appendChild(textNode);
this.mReference.appendChild(wrapper);
}
catch (e) {
}
}
}
this.mLoaded+=mask;
if (this.mLoaded==7){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var txProc = new XSLTProcessor(),isGood=false;
dump("\nTrying "+this.mName+" ");
txProc.transformDocument(this.mSource,this.mStyle,this.mResult,null);
if (this.mIsError) {
dump("for error test\nResult:\n");
DumpDOM(this.mResult);
handle_result(this.mIndex,true);
} else {
this.mReference.normalize();
try{
isGood = DiffDOM(this.mResult.documentElement,this.mReference.documentElement);
} catch (e) {isGood = false;};
if (!isGood){
dump(" and failed\n\n");
this.mVerbose=true;
handle_result(this.mIndex,false);
} else {
dump(" and succeeded\n\n");
handle_result(this.mIndex,true);
}
if (this.mVerbose){
dump("Result:\n");
DumpDOM(this.mResult);
dump("Reference:\n");
DumpDOM(this.mReference);
}
}
do_transforms();
}
}
};
const IOSERVICE_CTRID = "@mozilla.org/network/io-service;1";
const nsIIOService = Components.interfaces.nsIIOService;
const SIS_CTRID = "@mozilla.org/scriptableinputstream;1"
const nsIScriptableInputStream = Components.interfaces.nsIScriptableInputStream;
function loadFile(url)
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var serv = Components.classes[IOSERVICE_CTRID].getService(nsIIOService);
if (!serv)
throw Components.results.ERR_FAILURE;
var chan = serv.newChannel(url, null, null);
var instream =
Components.classes[SIS_CTRID].createInstance(nsIScriptableInputStream);
instream.init(chan.open());
return instream.read(instream.available());
}

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xalantests>
<test file="attribset/attribset01">
<purpose>Set attribute of a LRE from single attribute set.</purpose>
</test>
<test file="attribset/attribset02">
<purpose>Set attributes of a LRE from multiple attribute sets.</purpose>
</test>
<test file="attribset/attribset03">
<purpose>Use xsl:element with multiple attribute sets.</purpose>
</test>
<test file="attribset/attribset04">
<purpose>Use xsl:copy with multiple attribute sets, no conflicts.</purpose>
</test>
<test file="attribset/attribset05">
<purpose>Set attributes of a LRE using attribute sets that inherit.</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate01">
<purpose>Test of single attribute value template (AVT).</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate02">
<purpose>Test two AVTs with literal element between them (based on example in the spec).</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate03">
<purpose>Test of left curly brace escape.</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate04">
<purpose>Test of right curly brace escape.</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate05">
<purpose>Use of Curly brace to set value of HTML attribute.</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate07">
<purpose>Use of Curly brace to set value of HTML attributes. Predicate and quotes inside. Use of Curly brace to set value of HTML attributes. Predicate and quotes inside.</purpose>
</test>
<test file="attribvaltemplate/attribvaltemplate08">
<purpose>Compare the results of attribute value generated by AVT vs. xsl:value-of, with the output specified to be HTML.</purpose>
</test>
<test file="axes/axes41">
<purpose>Test for 'self::' Axis Identifier with index (not that it's practical).</purpose>
</test>
<test file="axes/axes42">
<purpose>Test for 'self::' Axis Identifier with specified element name that is not found.</purpose>
</test>
<test file="axes/axes43">
<purpose>Test for abbreviated '.' syntax.</purpose>
</test>
</xalantests>

View File

@ -1,303 +0,0 @@
/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Axel Hecht.
* Portions created by Axel Hecht are Copyright (C) 2001 Axel Hecht.
* All Rights Reserved.
*
* Contributor(s):
* Axel Hecht <axel@pike.org> (Original Author)
*/
var pop_last=0, pop_chunk=25;
var isinited=false;
var xalan_base, xalan_xml, xalan_elems, xalan_length, content_row, target;
var matchRE, matchNameTag, matchFieldTag, startFieldTag, endFieldTag;
var tests_run, tests_passed, tests_failed, tests_selected;
var view = ({
// nsITreeView
rowCount : 0,
getRowProperties : function(i, prop) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (this.success[i]==1) prop.AppendElement(this.smile);
if (this.success[i]==-1) prop.AppendElement(this.sad);
},
getColumnProperties : function(index, prop) {},
getCellProperties : function(index, prop) {},
isContainer : function(index) {return false;},
isSeparator : function(index) {return false;},
tree : null,
setTree : function(out) { this.tree = out; },
getCellText : function(i, col) {
switch(col){
case "name":
return this.names[i];
case "purp":
return this.purps[i];
case "comm":
return this.comms[i];
default:
return "XXX in "+ col+" and "+i;
}
},
// nsIClassInfo
flags : Components.interfaces.nsIClassInfo.DOM_OBJECT,
classDescription : "TreeView",
getInterfaces: function() {},
getHelperForLanguage: function(aLang) {},
QueryInterface: function(iid) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (!iid.equals(Components.interfaces.nsISupports) &&
!iid.equals(Components.interfaces.nsITreeView) &&
!iid.equals(Components.interfaces.nsIClassInfo))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
},
// privates
names : null,
purps : null,
comms : null,
success : null,
smile : null,
sad : null,
select : function(index) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (!this.selection.isSelected(index))
this.selection.toggleSelect(index);
},
unselect : function(index) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (this.selection.isSelected(index))
this.selection.toggleSelect(index);
},
swallow : function(initial) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var startt = new Date();
this.rowCount = initial.length;
this.success = new Array(this.rowCount);
this.names = new Array(this.rowCount);
this.purps = new Array(this.rowCount);
this.comms = new Array(this.rowCount);
var cur = initial.item(0);
var k = 0;
while (cur.nextSibling) {
if (cur.nodeType==Node.ELEMENT_NODE) {
this.names[k] = cur.getAttribute("file");
if (cur.childNodes.length>1)
this.purps[k] = cur.childNodes.item(1).firstChild.nodeValue;
if (cur.childNodes.length>3)
this.comms[k] = cur.childNodes.item(3).firstChild.nodeValue;
k = k+1;
}
cur = cur.nextSibling;
}
this.tree.rowCountChanged(0,this.rowCount);
//dump((new Date()-startt)/1000+" secs in swallow for "+k+" items\n");
},
remove : function(first,last){
last = Math.min(this.rowCount,last);
first = Math.max(0,first);
this.names.splice(first,last-first+1);
this.purps.splice(first,last-first+1);
this.comms.splice(first,last-first+1);
this.success.splice(first,last-first+1);
this.rowCount=this.names.length;
this.tree.rowCountChanged(first,this.rowCount);
},
getNames : function(first,last){
last = Math.min(this.rowCount,last);
first = Math.max(0,first);
var list = new Array(last-first+1);
for (var k=first;k<=last;k++)
list[k-first] = this.names[k];
return list;
}
});
function setView(tree, v) {
tree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject).view = v;
}
function loaderstuff(eve) {
var ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var atomservice = Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
view.smile = atomservice.getAtom("success");
view.sad = atomservice.getAtom("fail");
matchNameTag = document.getElementById("search-name");
matchFieldTag = document.getElementById("search-field");
startFieldTag = document.getElementById("start-field");
endFieldTag = document.getElementById("end-field");
tests_run = document.getElementById("tests_run");
tests_passed = document.getElementById("tests_passed");
tests_failed = document.getElementById("tests_failed");
tests_selected = document.getElementById("tests_selected");
xalan_base = document.getElementById("xalan_base");
setView(document.getElementById('out'), view)
xalan_xml = document.implementation.createDocument("","",null);
xalan_xml.addEventListener("load", xalanIndexLoaded, false);
xalan_xml.load("complete-xalanindex.xml");
//xalan_xml.load("xalanindex.xml");
return true;
}
function xalanIndexLoaded(e) {
populate_xalan();
return true;
}
function refresh_xalan() {
populate_xalan();
return true;
}
function populate_xalan() {
view.swallow(xalan_xml.getElementsByTagName("test"));
}
function dump_checked(){
var sels = view.selection,a=new Object(),b=new Object(),k;
reset_stats();
var todo = new Array();
var nums = new Array();
for (k=0;k<sels.getRangeCount();k++){
sels.getRangeAt(k,a,b);
todo = todo.concat(view.getNames(a.value,b.value));
for (var l=a.value;l<=b.value;l++) nums.push(l);
}
do_transforms(todo,nums);
}
function handle_result(index,success){
tests_run.getAttributeNode("value").nodeValue++;
if (success) {
view.success[index] = 1;
tests_passed.getAttributeNode("value").nodeValue++;
} else {
view.success[index] = -1;
tests_failed.getAttributeNode("value").nodeValue++;
}
view.unselect(index);
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
view.tree.invalidateRow(index);
}
function hide_checked(yes){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var sels = view.selection,a=new Object(),b=new Object(),k;
if (yes) {
for (k=sels.getRangeCount()-1;k>=0;k--){
sels.getRangeAt(k,a,b);
view.remove(a.value,b.value);
view.selection.clearRange(a.value,b.value);
}
} else {
var last=view.rowCount;
for (k=view.selection.getRangeCount()-1;k>=0;k--){
view.selection.getRangeAt(k,a,b);
view.remove(b.value+1,last);
view.selection.clearRange(a.value,b.value);
last = a.value-1;
}
view.remove(0,last);
}
}
function select(){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var searchField = matchFieldTag.getAttribute("value");
var matchRE = new RegExp(matchNameTag.value);
for (var k=0;k<view.rowCount;k++){
switch (searchField) {
case "1":
if (view.names[k] && view.names[k].match(matchRE))
view.select(k);
break;
case "2":
if (view.purps[k] && view.purps[k].match(matchRE))
view.select(k);
break;
case "3":
if (view.comms[k] && view.comms[k].match(matchRE))
view.select(k);
break;
default: dump(searchField+"|"+typeof(searchField)+"\n");
}
}
}
function selectRange(){
var start = startFieldTag.value-1;
var end = endFieldTag.value-1;
if (start > end) {
// hihihi
var tempStart = start;
start = end;
end = startTemp;
}
start = Math.max(0, start);
end = Math.min(end, view.rowCount-1);
view.selection.rangedSelect(start,end,true);
}
function check(yes){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (yes)
view.selection.selectAll();
else
view.selection.clearSelection();
}
function invert_check(){
alert("not yet implemented");
}
function browse_base_dir(){
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(
nsIFilePicker);
fp.init(window,'Xalan Tests Base Dir',nsIFilePicker.modeGetFolder);
fp.appendFilters(nsIFilePicker.filterAll);
var res = fp.show();
if (res == nsIFilePicker.returnOK) {
var furl = fp.fileURL, fconf=fp.fileURL, fgold=fp.fileURL;
fconf.path = furl.path+'conf';
fgold.path = furl.path+'conf-gold';
if (!fconf.file.exists() || !fconf.file.isDirectory()){
alert("Xalan Tests not found!");
return;
}
if (!fgold.file.exists() || !fgold.file.isDirectory()){
alert("Xalan Tests Reference solutions not found!");
return;
}
xalan_base.setAttribute('value',fp.fileURL.path);
}
}
function reset_stats(){
tests_run.setAttribute("value", "0");
tests_passed.setAttribute("value", "0");
tests_failed.setAttribute("value", "0");
}
function sel_change() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
tests_selected.setAttribute("value", view.selection.count);
}