dcone%netscape.com 2a582212cf Not part of the build. Updated layout-plugin code. Added method to output the regression data to a file.
git-svn-id: svn://10.0.0.236/trunk@134810 18797224-902f-48f8-a5cc-f745e15eee43
2002-12-04 22:11:40 +00:00

436 lines
11 KiB
HTML

<HTML>
<HEAD>
<TITLE>Debug Plug-in Test</TITLE>
</HEAD>
<BODY>
<center>
<h2> Table XPConnect Scriptable Debug Plug-in Regression Page</h2>
</center>
<embed type="application/debug-plugin" width=1 height=1 hidden="true"><br>
<script>
var embed = document.embeds[0];
var started = false;
var theWindow;
var fileDirectory;
var baseExt;
var verExt;
var baseDir;
var verDir;
var testType;
var changed = false;
var lb,mb,pb,sb,stb,tb;
var origLeft;
var origTop;
var origWidth;
var origHeight;
var curIndex;
var startIndex;
var endIndex;
var dumpStyle;
var myArray = new Array(33);
statusdirectory = "s:/";
statusfilename = "afilewithdump.txt"
// table
myArray[0] = "file:///S|/mozilla/layout/html/tests/table/dom";
myArray[1] = "s:/regressiontests/";
myArray[2] = "s:/regressiontests/";
myArray[3] = "file:///S|/mozilla/layout/html/tests/table/core";
myArray[4] = "s:/regressiontests/";
myArray[5] = "s:/regressiontests/";
myArray[6] = "file:///S|/mozilla/layout/html/tests/table/other";
myArray[7] = "s:/regressiontests/";
myArray[8] = "s:/regressiontests/";
myArray[9] = "file:///S|/mozilla/layout/html/tests/table/bugs";
myArray[10] = "s:/regressiontests/";
myArray[11] = "s:/regressiontests/";
myArray[12] = "file:///S|/mozilla/layout/html/tests/table/marvin";
myArray[13] = "s:/regressiontests/";
myArray[14] = "s:/regressiontests/";
myArray[15] = "file:///S|/mozilla/layout/html/tests/table/printing";
myArray[16] = "s:/regressiontests/";
myArray[17] = "s:/regressiontests/";
// block
myArray[18] = "file:///S|/mozilla/layout/html/tests/block/base";
myArray[19] = "s:/regressiontests/";
myArray[20] = "s:/regressiontests/";
myArray[21] = "file:///S|/mozilla/layout/html/tests/block/bugs";
myArray[22] = "s:/regressiontests/";
myArray[23] = "s:/regressiontests/";
myArray[24] = "file:///S|/mozilla/layout/html/tests/block/printing";
myArray[25] = "s:/regressiontests/";
myArray[26] = "s:/regressiontests/";
// form controls
myArray[27] = "file:///S|/mozilla/layout/html/tests/formctls/base";
myArray[28] = "s:/regressiontests/";
myArray[29] = "s:/regressiontests/";
myArray[30] = "file:///S|/mozilla/layout/html/tests/formctls/bugs";
myArray[31] = "s:/regressiontests/";
myArray[32] = "s:/regressiontests/";
//=============================================================================
function CompareFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile)
{
var err = embed.CompareLayoutFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile,1);
if(err == 0) {
WriteOutput("File \" "+aVerFile + "\" PASSED","success");
} else {
WriteOutput("File \" "+aVerFile + "\" FAILED ","failure");
}
}
//=============================================================================
function CompareFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile)
{
err = embed.CompareLayoutFiles(aBaseDir,aVerDir,aBaselineFile,aVerFile,1);
if(err == 0) {
WriteOutput("File \" "+aVerFile + "\" PASSED","success");
} else {
WriteOutput("File \" "+aVerFile + "\" FAILED ","failure");
}
}
//=============================================================================
function WriteOutput( aText, aTextColor )
{
var statusarea = document.getElementById('status');
var thecolor = "<font color=black>";
if(aTextColor == "failure") {
thecolor = "<font color=red>";
}
if(aTextColor == "success") {
thecolor = "<font color=green>";
}
statusarea.innerHTML = thecolor + aText +"</font>";
embed.OutputTextToFile(0,statusdirectory,statusfilename,aText);
}
//=============================================================================
function placeWindows(aOutputWindow,aTestWindow)
{
// save old values, get rid of chrome and move and resize the windows
if ( changed == false ) {
lb = aOutputWindow.locationbar.visible;
mb = aOutputWindow.menubar.visible;
pb = aOutputWindow.personalbar.visible;
sb = aOutputWindow.scrollbars.visible;
stb = aOutputWindow.statusbar.visible;
tb = aOutputWindow.toolbar.visible;
aOutputWindow.focus();
origLeft = aOutputWindow.screen.left;
origTop = aOutputWindow.screen.top;
origWidth = aOutputWindow.outerWidth;
origHeight = aOutputWindow.outerHeight;
changed = true;
}
aOutputWindow.locationbar.visible = false;
aOutputWindow.menubar.visible = false;
aOutputWindow.personalbar.visible = false;
aOutputWindow.scrollbars.visible = false;
aOutputWindow.statusbar.visible = false;
aOutputWindow.toolbar.visible = false;
var top = window.screen.availTop;
var left = window.screen.availLeft;
var height = window.screen.availHeight;
var width = window.screen.availWidth;
if (height > 1000) {
height = 800;
} else {
height = height - 200;
}
if (width > 800) {
width = 800;
}
// size the window to the largest possible
aTestWindow.moveTo(left,200);
aTestWindow.resizeTo(width,height);
aOutputWindow.focus();
}
//=============================================================================
function RestoreWindow(aOutputWindow)
{
aOutputWindow.locationbar.visible = lb;
aOutputWindow.menubar.visible = mb;
aOutputWindow.personalbar.visible = pb;
aOutputWindow.scrollbars.visible = sb;
aOutputWindow.statusbar.visible = stb;
aOutputWindow.toolbar.visible = tb;
}
//=============================================================================
function ShowDirectories()
{
for(i=0;i<(myArray.length);i+=3){
WriteOutput( myArray[i], "normal" );
}
}
//=============================================================================
function runTests()
{
if (document.getElementById('ar').checked ) {
// all
startIndex = 0; endIndex = myArray.length;
} else if (document.getElementById('tr').checked ) {
// table
startIndex = 0; endIndex = 15;
} else if (document.getElementById('br').checked ) {
// base
startIndex = 18; endIndex = 24;
} else if (document.getElementById('fcr').checked ) {
// form controls
startIndex = 27; endIndex = 33;
}
// three buttons we use to check the kind of test we run (rb rv rvc)
if (document.getElementById('rb').checked ) {
// baseline
testType = 1;
} else if (document.getElementById('rv').checked ) {
// verify
testType = 2;
}
var now = new Date();
embed.OutputTextToFile(1,statusdirectory,statusfilename,"DATE: "+ now.toLocaleString());
curIndex = 0;
DumpDirectoryies(testType);
}
//=============================================================================
function DumpDirectoryies(aTestType)
{
if ( curIndex == 0) {
WriteOutput( "Starting Tests","normal");
}
if ( curIndex < endIndex ) {
fileDirectory = myArray[curIndex];
baseDir = myArray[curIndex+1];
verDir = myArray[curIndex+2];
baseExt = ".bas";
verExt = ".ver";
var dirURL;
var err;
// create the output directories
if ( testType == 1 ) {
dirURL = "file:///"+ baseDir;
err = embed.CreateDirectory(dirURL,0);
}
if ( (testType == 1) || (testType == 2) ) {
dirURL = "file:///"+ verDir;
err = embed.CreateDirectory(dirURL,0);
}
WriteOutput( "New Directory: "+fileDirectory , "normal" );
DumpFrames(true,0,aTestType);
} else {
// all completed
RestoreWindow(window);
WriteOutput( "Finished","normal");
var newDate = new Date();
embed.OutputTextToFile(0,statusdirectory,statusfilename,"Test Finished at: "+ newDate.toLocaleString());
theWindow.close();
}
}
//=============================================================================
function DumpFrames(firstTime,lastFile,aTestType)
{
var loadingFlag;
if (firstTime == true) {
embed.StartDirectorySearch(fileDirectory);
filename=embed.GetNextFileInDirectory();
if ( filename != null) {
outputWindow = window;
theWindow = window.open(filename,0);
placeWindows(outputWindow,theWindow);
}
if ( document.getElementById('ds').checked ) {
dumpStyle = 1;
} else {
dumpStyle = 0;
}
started = true;
} else {
filename = lastFile;
}
while ( filename != null) {
// take off the file path.. so we just have the file name for the output
var startindex = filename.lastIndexOf("/");
var outputfilename = filename.slice(startindex+1,filename.length);
if (aTestType==1) {
// baseline
outputfilename = outputfilename.replace (".html",baseExt);
loading = embed.DumpLayout(theWindow,baseDir,outputfilename,dumpStyle);
} else if ( aTestType==2 ) {
// verify and compare
outputfilename = outputfilename.replace (".html",verExt);
loading = embed.DumpLayout(theWindow,verDir,outputfilename,dumpStyle);
}
if (loading == 1) {
// page was not loaded
testtype = aTestType;
setTimeout("DumpFrames(false,filename,testtype,dumpStyle)",250);
break;
} else if (loading == 0) {
// successful in loading the page
WriteOutput("Writing File " + "\""+outputfilename+"\"","success");
if ( aTestType==2 ){
baseline = outputfilename.replace (verExt,baseExt);
CompareFiles(baseDir,verDir,baseline,outputfilename);
}
filename=embed.GetNextFileInDirectory();
if ( filename != null) {
theWindow.location = filename;
} else {
curIndex+=3;
DumpDirectoryies(aTestType);
}
} else {
// fatal error.. break
WriteOutput("FATAL ERROR" + "\""+outputfilename+"\"","failure" );
break;
}
}
}
//=============================================================================
</script>
<center>
<form name="TestForm">
<table>
<tr>
<td>
<table bgcolor="#FDFEDA" width=800>
<tr>
<td colspan="4">
<input id="ar" type="radio" name="dirTypes" value="runDirList" checked>
All Regression
</td>
</tr>
<tr>
<td colspan="4">
<input id="tr" type="radio" name="dirTypes" value="runDirList" >
Table Regression
</td>
</tr>
<tr>
<td colspan="4">
<input id="br" type="radio" name="dirTypes" value="runDirList" >
Block Regression
</td>
</tr>
<tr>
<td colspan="4">
<input id="fcr" type="radio" name="dirTypes" value="runDirList" >
Form Controls Regression
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width=800>
<tr>
<td>
Generate Baseline
<input id="rb" type="radio" name="testType" value="runbaseline" checked >
</td>
<td>
Verify and Compare
<input id="rv" type="radio" name="testType" value="runverify" >
</td>
</tr>
<tr>
<td>
Dump Style
<input id="ds" type="checkbox" name="styleDump" value="dumpStyle" checked >
</td>
</tr>
<tr>
<td>
<input type=button value="Execute" onclick='runTests()'>
</td>
</tr>
</table>
</td>
</tr>
<table>
</form>
</center>
<h4 id="status"> OUTPUT IDLE </h4>
</div>
</BODY>
</HTML>