From 76f46987c3c422b79d4e7532b4f04eca4be34462 Mon Sep 17 00:00:00 2001 From: "axel%pike.org" Date: Fri, 23 Mar 2001 10:43:55 +0000 Subject: [PATCH] not part of the build; XSLT buster rework, the grid one was horked by the xul change, this one moved to outliner, yeah --- .../transformiix/resources/buster/buster.xul | 27 +- .../transformiix/resources/buster/txTools.css | 31 +-- .../transformiix/resources/buster/txTools.js | 57 +++-- .../resources/buster/xulTxTools.js | 240 +++++++++++------- 4 files changed, 203 insertions(+), 152 deletions(-) diff --git a/extensions/transformiix/resources/buster/buster.xul b/extensions/transformiix/resources/buster/buster.xul index 14838772bed2..e6d5a4407dd6 100644 --- a/extensions/transformiix/resources/buster/buster.xul +++ b/extensions/transformiix/resources/buster/buster.xul @@ -66,24 +66,11 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/extensions/transformiix/resources/buster/txTools.css b/extensions/transformiix/resources/buster/txTools.css index da928f275922..c80cea16c60b 100644 --- a/extensions/transformiix/resources/buster/txTools.css +++ b/extensions/transformiix/resources/buster/txTools.css @@ -26,30 +26,23 @@ text.head { font-weight: bold; } -column { - margin-left: 2px; - margin-right: 2px; -} - -#tests{ - overflow: auto; -} - -.succeeded { - background-color: green; -} - -.failed { - background-color: red; -} - :-moz-outliner-row(success) { - background-color: green; + background-color: green ! important; } :-moz-outliner-row(fail) { - background-color: red; + background-color: red ! important; } +:-moz-outliner-row(selected) +{ + border: 1px solid blue ! important; + background-color: white ; +} + +:-moz-outliner-cell-text(selected) +{ + color: black ! important; +} diff --git a/extensions/transformiix/resources/buster/txTools.js b/extensions/transformiix/resources/buster/txTools.js index 58459df1d2aa..2786ae9ed2a8 100644 --- a/extensions/transformiix/resources/buster/txTools.js +++ b/extensions/transformiix/resources/buster/txTools.js @@ -20,23 +20,25 @@ * Axel Hecht (Original Author) */ -var name_array,__docSet; +var name_array,index_array,__docSet; -function do_transforms(new_name_array,verbose){ +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){ current=name_array.shift(); - __docSet=new txDocSet(current); + __docSet=new txDocSet(current,index_array.shift()); } } -function txDocSet(name,verbose){ +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); @@ -48,7 +50,12 @@ function txDocSet(name,verbose){ this.mReference.addEventListener("load",this.refLoaded,false); this.mSource.load(this.mBase+"conf/"+name+".xml"); this.mStyle.load(this.mBase+"conf/"+name+".xsl"); - this.mReference.load(this.mBase+"conf-gold/"+name+".out"); + this.mIsError = name.match(/\/err\//); + if (this.mIsError){ + this.mLoaded = 2; + } else { + this.mReference.load(this.mBase+"conf-gold/"+name+".out"); + } } txDocSet.prototype = { @@ -59,7 +66,9 @@ txDocSet.prototype = { mResult : null, mReference : null, mVerbose : false, + mIsError : false, mLoaded : 0, + mIndex : 0, styleLoaded : function(e){ __docSet.stuffLoaded(1); @@ -74,25 +83,31 @@ txDocSet.prototype = { __docSet.mLoaded+=mask; if (this.mLoaded==7){ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var txProc = new XSLTProcessor(),isGood; + var txProc = new XSLTProcessor(),isGood=false; dump("\nTrying "+this.mName+" "); txProc.transformDocument(this.mSource,this.mStyle,this.mResult,null); - 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.mName,false); - } else { - dump(" and succeeded\n\n"); - handle_result(this.mName,true); - } - if (this.mVerbose){ - dump("Result:\n"); + if (this.mIsError) { + dump("for error test\nResult:\n"); DumpDOM(this.mResult); - dump("Reference:\n"); - DumpDOM(this.mReference); + handle_result(this.mIndex,true); + } else { + 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(); } diff --git a/extensions/transformiix/resources/buster/xulTxTools.js b/extensions/transformiix/resources/buster/xulTxTools.js index df34c3e46d3f..5b9256169376 100644 --- a/extensions/transformiix/resources/buster/xulTxTools.js +++ b/extensions/transformiix/resources/buster/xulTxTools.js @@ -1,10 +1,10 @@ -/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- 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 @@ -25,24 +25,103 @@ var isinited=false; var xalan_base, xalan_xml, xalan_elems, xalan_length, content_row, target; var matchRE, matchNameTag, matchFieldTag; var tests_run, tests_passed, tests_failed; +var view = ({ +// nsIOutlinerView + 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;}, + outliner : null, + setOutliner : function(out) { this.outliner = 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; + } + }, +// 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) { + this.rowCount = initial.length; + this.content = initial; + this.success = new Array(this.rowCount); + this.names = new Array(this.rowCount); + this.purps = new Array(this.rowCount); + this.comms = new Array(this.rowCount); + for (k=0;k1) + this.purps[k] = cur.childNodes.item(1).firstChild.nodeValue; + if (cur.childNodes.length>3) + this.comms[k] = cur.childNodes.item(3).firstChild.nodeValue; + } + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + this.outliner.rowCountChanged(0,this.rowCount); + }, + 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.outliner.rowCountChanged(first,this.rowCount); + }, + getNames : function(first,last){ + last = Math.min(this.rowCount,last); + first = Math.max(0,first); + list = new Array(last-first+1); + for (k=first;k<=last;k++) + list[k-first] = this.names[k]; + return list; + } +}); + +function setView(outliner, v) { + outliner.boxObject.QueryInterface(Components.interfaces.nsIOutlinerBoxObject).view = v; +} function loaderstuff(eve) { var ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - content_row = document.createElementNS(ns,"row"); - content_row.setAttribute("flex","1"); - content_row.appendChild(document.createElementNS(ns,"checkbox")); - content_row.appendChild(document.createElementNS(ns,"text")); - content_row.appendChild(document.createElementNS(ns,"text")); - content_row.appendChild(document.createElementNS(ns,"text")); - content_row.setAttribute("class", "notrun"); netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - target = document.getElementById("xalan_grid"); + 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"); tests_run = document.getElementById("tests_run"); tests_passed = document.getElementById("tests_passed"); tests_failed = document.getElementById("tests_failed"); 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"); @@ -51,122 +130,99 @@ function loaderstuff(eve) { } function xalanIndexLoaded(e) { - xalan_elems = xalan_xml.documentElement; - xalan_length = Math.floor(xalan_elems.childNodes.length/2); + populate_xalan(); return true; } function refresh_xalan() { - while(target.childNodes.length>1) target.removeChild(target.lastChild); - pop_last = 0; populate_xalan(); return true; } function populate_xalan() { - var upper=pop_last+pop_chunk; - var current,test,i,j, lName, re=/\/err\//; - var searchField = matchFieldTag.getAttribute("value"); - var matchValue = matchNameTag.value; - if (matchValue.length==0) matchValue='.'; - var matchRE = new RegExp(matchValue); - for (i=pop_last;i=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(){ - var searchField = matchFieldTag.getAttribute("value"); + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + var searchField = matchFieldTag.getAttribute("data"); var matchRE = new RegExp(matchNameTag.value); - var nds = target.childNodes; - for (i=1;i