reenable print regression testing bug 339521 r/sr=dbaron

This commit is contained in:
bmlk%gmx.de 2006-09-14 05:11:37 +00:00
Родитель e2c4f1da8d
Коммит 4fac4e2fb1
5 изменённых файлов: 46 добавлений и 20 удалений

Просмотреть файл

@ -42,7 +42,7 @@
interface nsIDOMWindow;
interface nsILocalFile;
[scriptable, uuid(1B4CD090-0531-11d6-A876-00105A183419)]
[scriptable, uuid(B249B2C0-EE11-11DA-8AD9-0800200C9A66)]
interface nsILayoutRegressionTester : nsISupports
{
/**
@ -57,6 +57,7 @@ interface nsILayoutRegressionTester : nsISupports
*/
const short DUMP_FLAGS_MASK_DEFAULT = 0;
const short DUMP_FLAGS_MASK_DUMP_STYLE = 1;
const short DUMP_FLAGS_MASK_PRINT_MODE = 2;
const long DUMP_RESULT_COMPLETED = 0; // loaded OK
const long DUMP_RESULT_LOADING = 1; // still loading

Просмотреть файл

@ -53,6 +53,8 @@
#include "nsIDOMHTMLDocument.h"
#include "nsISimpleEnumerator.h"
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsIContentViewerFile.h"
#include "nsIFrameDebug.h"
#include "nsIFrame.h"
#include "nsStyleStruct.h"
@ -121,11 +123,21 @@ nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aD
rv = aDestFile->OpenANSIFileDesc("w", &fp);
if (NS_FAILED(rv)) return rv;
}
fdbg->DumpRegressionData(presShell->GetPresContext(), fp, 0, dumpStyle);
if (aFlagsMask & DUMP_FLAGS_MASK_PRINT_MODE) {
nsCOMPtr <nsIContentViewer> viewer;
docShell->GetContentViewer(getter_AddRefs(viewer));
if (viewer){
nsCOMPtr<nsIContentViewerFile> viewerFile = do_QueryInterface(viewer);
if (viewerFile) {
viewerFile->Print(PR_TRUE, fp, nsnull);
}
}
}
else {
fdbg->DumpRegressionData(presShell->GetPresContext(), fp, 0, dumpStyle);
}
if (fp != stdout)
fclose(fp);
*aResult = DUMP_RESULT_COMPLETED;
return NS_OK;
}

Просмотреть файл

@ -343,31 +343,32 @@ const NS_LOCALFILEINPUTSTREAM_CONTRACTID =
"@mozilla.org/network/file-input-stream;1";
function RunRTest(aFilename, aIsBaseline)
function RunRTest(aFilename, aIsBaseline, aIsPrinting)
{
if (gRTestURLList) {
// XXX Does alert work?
alert("Already running regression test.\n");
return;
}
dump("Running " + (aIsBaseline?"baseline":"verify") + " test for " + aFilename + ".\n");
dump("Running " + (aIsBaseline?"baseline":"verify") +
(aIsPrinting?" PrintMode":"") + " test for " + aFilename + ".\n");
var listFile = Components.classes[NS_LOCAL_FILE_CONTRACTID].
createInstance(nsILocalFile);
listFile.persistentDescriptor = aFilename;
gRTestURLList = new RTestURLList(listFile, aIsBaseline);
gRTestURLList = new RTestURLList(listFile, aIsBaseline, aIsPrinting);
gRTestURLList.startURL();
}
function RTestURLList(aLocalFile, aIsBaseline) {
this.init(aLocalFile, aIsBaseline);
function RTestURLList(aLocalFile, aIsBaseline, aIsPrinting) {
this.init(aLocalFile, aIsBaseline, aIsPrinting);
}
RTestURLList.prototype = {
init : function(aLocalFile, aIsBaseline)
init : function(aLocalFile, aIsBaseline, aIsPrinting)
{
this.mIsBaseline = aIsBaseline;
this.mIsPrinting = aIsPrinting;
this.mURLs = new Array();
this.readFileList(aLocalFile);
this.mRegressionTester =
@ -419,8 +420,16 @@ RTestURLList.prototype = {
dump("Writing regression data to " +
data.QueryInterface(nsILocalFile).persistentDescriptor + "\n");
this.mRegressionTester.dumpFrameModel(gBrowser.contentWindow, data,
nsILayoutRegressionTester.DUMP_FLAGS_MASK_DUMP_STYLE);
if (this.mIsPrinting) {
this.mRegressionTester.dumpFrameModel(gBrowser.contentWindow, data,
nsILayoutRegressionTester.DUMP_FLAGS_MASK_PRINT_MODE);
}
else {
this.mRegressionTester.dumpFrameModel(gBrowser.contentWindow, data,
nsILayoutRegressionTester.DUMP_FLAGS_MASK_DUMP_STYLE);
}
if (!this.mIsBaseline) {
var base_data = this.mCurrentURL.dir.clone();
@ -454,5 +463,6 @@ RTestURLList.prototype = {
mURLs : null,
mCurrentURL : null, // url (string), dir (nsIFileURL), relurl (string)
mIsBaseline : null,
mRegressionTester : null
mRegressionTester : null,
mIsPrinting : null
}

Просмотреть файл

@ -97,13 +97,13 @@
<toolbox>
<menubar id="main-menubar" grippyhidden="true">
<menu id="menu_File">
<menu id="menu_file" label="File" accesskey="F">
<menupopup id="menu_FilePopup">
<menuitem id="menu_open" label="&ldb.Open.label;" accesskey="&ldb.Open.accesskey;" key="openFileKb" oncommand="openFile()"/>
<menuitem id="menu_close"/>
<menuitem id="menu_close" label="Close" accesskey="C" oncommand="window.close();"/>
</menupopup>
</menu>
<menu id="menu_Edit">
<menu id="menu_edit">
<menupopup>
<menuitem id="menu_cut" />
<menuitem id="menu_copy" />
@ -115,6 +115,7 @@
<menu label="&ldb.RegressionTestMenu.label;"
accesskey="&ldb.RegressionTestMenu.accesskey;">
<menupopup>
<menuitem type="checkbox" id="menu_RTestPrintMode" label="&ldb.RegressionPrintMode.label;" accesskey="&ldb.RegressionPrintMode.accesskey;"/>
<menu label="&ldb.RunBaselineMenu.label;"
accesskey="&ldb.RunBaselineMenu.accesskey;"
id="menu_RTest_baseline"
@ -126,7 +127,7 @@
<menuitem uri="rdf:*"
label="rdf:&NC_RDFNS;name"
name="rdf:&NC_RDFNS;name"
oncommand="RunRTest(this.getAttribute('name'), true);" />
oncommand="RunRTest(this.getAttribute('name'), true, document.getElementById('menu_RTestPrintMode').getAttribute('checked'));" />
</menupopup>
</template>
</menu>
@ -141,7 +142,7 @@
<menuitem uri="rdf:*"
label="rdf:&NC_RDFNS;name"
name="rdf:&NC_RDFNS;name"
oncommand="RunRTest(this.getAttribute('name'), false);" />
oncommand="RunRTest(this.getAttribute('name'), false, document.getElementById('menu_RTestPrintMode').getAttribute('checked'));" />
</menupopup>
</template>
</menu>
@ -221,7 +222,7 @@
</toolbox>
<browser flex="1" id="browser" type="content-primary"
homepage="resource:///res/samples/test0.html" />
homepage="about:blank" />
<hbox>
<description id="status-text" value="" />

Просмотреть файл

@ -61,6 +61,8 @@
<!ENTITY ldb.RunBaselineMenu.accesskey "B">
<!ENTITY ldb.RunVerifyMenu.label "Run Verify">
<!ENTITY ldb.RunVerifyMenu.accesskey "V">
<!ENTITY ldb.RegressionPrintMode.label "Print Mode">
<!ENTITY ldb.RegressionPrintMode.accesskey "P">
<!ENTITY ldb.AddNewList.label "Add New List...">
<!ENTITY ldb.AddNewList.accesskey "A">
<!ENTITY ldb.RemoveListMenu.label "Remove List">