зеркало из https://github.com/mozilla/pjs.git
reenable print regression testing bug 339521 r/sr=dbaron
This commit is contained in:
Родитель
e2c4f1da8d
Коммит
4fac4e2fb1
|
@ -42,7 +42,7 @@
|
||||||
interface nsIDOMWindow;
|
interface nsIDOMWindow;
|
||||||
interface nsILocalFile;
|
interface nsILocalFile;
|
||||||
|
|
||||||
[scriptable, uuid(1B4CD090-0531-11d6-A876-00105A183419)]
|
[scriptable, uuid(B249B2C0-EE11-11DA-8AD9-0800200C9A66)]
|
||||||
interface nsILayoutRegressionTester : nsISupports
|
interface nsILayoutRegressionTester : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -57,6 +57,7 @@ interface nsILayoutRegressionTester : nsISupports
|
||||||
*/
|
*/
|
||||||
const short DUMP_FLAGS_MASK_DEFAULT = 0;
|
const short DUMP_FLAGS_MASK_DEFAULT = 0;
|
||||||
const short DUMP_FLAGS_MASK_DUMP_STYLE = 1;
|
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_COMPLETED = 0; // loaded OK
|
||||||
const long DUMP_RESULT_LOADING = 1; // still loading
|
const long DUMP_RESULT_LOADING = 1; // still loading
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
#include "nsIDOMHTMLDocument.h"
|
#include "nsIDOMHTMLDocument.h"
|
||||||
#include "nsISimpleEnumerator.h"
|
#include "nsISimpleEnumerator.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
#include "nsIContentViewer.h"
|
||||||
|
#include "nsIContentViewerFile.h"
|
||||||
#include "nsIFrameDebug.h"
|
#include "nsIFrameDebug.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsStyleStruct.h"
|
#include "nsStyleStruct.h"
|
||||||
|
@ -121,11 +123,21 @@ nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aD
|
||||||
rv = aDestFile->OpenANSIFileDesc("w", &fp);
|
rv = aDestFile->OpenANSIFileDesc("w", &fp);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
}
|
}
|
||||||
|
if (aFlagsMask & DUMP_FLAGS_MASK_PRINT_MODE) {
|
||||||
fdbg->DumpRegressionData(presShell->GetPresContext(), fp, 0, dumpStyle);
|
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)
|
if (fp != stdout)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
*aResult = DUMP_RESULT_COMPLETED;
|
*aResult = DUMP_RESULT_COMPLETED;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,31 +343,32 @@ const NS_LOCALFILEINPUTSTREAM_CONTRACTID =
|
||||||
"@mozilla.org/network/file-input-stream;1";
|
"@mozilla.org/network/file-input-stream;1";
|
||||||
|
|
||||||
|
|
||||||
function RunRTest(aFilename, aIsBaseline)
|
function RunRTest(aFilename, aIsBaseline, aIsPrinting)
|
||||||
{
|
{
|
||||||
if (gRTestURLList) {
|
if (gRTestURLList) {
|
||||||
// XXX Does alert work?
|
// XXX Does alert work?
|
||||||
alert("Already running regression test.\n");
|
alert("Already running regression test.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
dump("Running " + (aIsBaseline?"baseline":"verify") +
|
||||||
dump("Running " + (aIsBaseline?"baseline":"verify") + " test for " + aFilename + ".\n");
|
(aIsPrinting?" PrintMode":"") + " test for " + aFilename + ".\n");
|
||||||
|
|
||||||
var listFile = Components.classes[NS_LOCAL_FILE_CONTRACTID].
|
var listFile = Components.classes[NS_LOCAL_FILE_CONTRACTID].
|
||||||
createInstance(nsILocalFile);
|
createInstance(nsILocalFile);
|
||||||
listFile.persistentDescriptor = aFilename;
|
listFile.persistentDescriptor = aFilename;
|
||||||
gRTestURLList = new RTestURLList(listFile, aIsBaseline);
|
gRTestURLList = new RTestURLList(listFile, aIsBaseline, aIsPrinting);
|
||||||
gRTestURLList.startURL();
|
gRTestURLList.startURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
function RTestURLList(aLocalFile, aIsBaseline) {
|
function RTestURLList(aLocalFile, aIsBaseline, aIsPrinting) {
|
||||||
this.init(aLocalFile, aIsBaseline);
|
this.init(aLocalFile, aIsBaseline, aIsPrinting);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTestURLList.prototype = {
|
RTestURLList.prototype = {
|
||||||
init : function(aLocalFile, aIsBaseline)
|
init : function(aLocalFile, aIsBaseline, aIsPrinting)
|
||||||
{
|
{
|
||||||
this.mIsBaseline = aIsBaseline;
|
this.mIsBaseline = aIsBaseline;
|
||||||
|
this.mIsPrinting = aIsPrinting;
|
||||||
this.mURLs = new Array();
|
this.mURLs = new Array();
|
||||||
this.readFileList(aLocalFile);
|
this.readFileList(aLocalFile);
|
||||||
this.mRegressionTester =
|
this.mRegressionTester =
|
||||||
|
@ -419,8 +420,16 @@ RTestURLList.prototype = {
|
||||||
|
|
||||||
dump("Writing regression data to " +
|
dump("Writing regression data to " +
|
||||||
data.QueryInterface(nsILocalFile).persistentDescriptor + "\n");
|
data.QueryInterface(nsILocalFile).persistentDescriptor + "\n");
|
||||||
this.mRegressionTester.dumpFrameModel(gBrowser.contentWindow, data,
|
if (this.mIsPrinting) {
|
||||||
nsILayoutRegressionTester.DUMP_FLAGS_MASK_DUMP_STYLE);
|
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) {
|
if (!this.mIsBaseline) {
|
||||||
var base_data = this.mCurrentURL.dir.clone();
|
var base_data = this.mCurrentURL.dir.clone();
|
||||||
|
@ -454,5 +463,6 @@ RTestURLList.prototype = {
|
||||||
mURLs : null,
|
mURLs : null,
|
||||||
mCurrentURL : null, // url (string), dir (nsIFileURL), relurl (string)
|
mCurrentURL : null, // url (string), dir (nsIFileURL), relurl (string)
|
||||||
mIsBaseline : null,
|
mIsBaseline : null,
|
||||||
mRegressionTester : null
|
mRegressionTester : null,
|
||||||
|
mIsPrinting : null
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,13 +97,13 @@
|
||||||
|
|
||||||
<toolbox>
|
<toolbox>
|
||||||
<menubar id="main-menubar" grippyhidden="true">
|
<menubar id="main-menubar" grippyhidden="true">
|
||||||
<menu id="menu_File">
|
<menu id="menu_file" label="File" accesskey="F">
|
||||||
<menupopup id="menu_FilePopup">
|
<menupopup id="menu_FilePopup">
|
||||||
<menuitem id="menu_open" label="&ldb.Open.label;" accesskey="&ldb.Open.accesskey;" key="openFileKb" oncommand="openFile()"/>
|
<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>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
<menu id="menu_Edit">
|
<menu id="menu_edit">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
<menuitem id="menu_cut" />
|
<menuitem id="menu_cut" />
|
||||||
<menuitem id="menu_copy" />
|
<menuitem id="menu_copy" />
|
||||||
|
@ -115,6 +115,7 @@
|
||||||
<menu label="&ldb.RegressionTestMenu.label;"
|
<menu label="&ldb.RegressionTestMenu.label;"
|
||||||
accesskey="&ldb.RegressionTestMenu.accesskey;">
|
accesskey="&ldb.RegressionTestMenu.accesskey;">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
|
<menuitem type="checkbox" id="menu_RTestPrintMode" label="&ldb.RegressionPrintMode.label;" accesskey="&ldb.RegressionPrintMode.accesskey;"/>
|
||||||
<menu label="&ldb.RunBaselineMenu.label;"
|
<menu label="&ldb.RunBaselineMenu.label;"
|
||||||
accesskey="&ldb.RunBaselineMenu.accesskey;"
|
accesskey="&ldb.RunBaselineMenu.accesskey;"
|
||||||
id="menu_RTest_baseline"
|
id="menu_RTest_baseline"
|
||||||
|
@ -126,7 +127,7 @@
|
||||||
<menuitem uri="rdf:*"
|
<menuitem uri="rdf:*"
|
||||||
label="rdf:&NC_RDFNS;name"
|
label="rdf:&NC_RDFNS;name"
|
||||||
name="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>
|
</menupopup>
|
||||||
</template>
|
</template>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -141,7 +142,7 @@
|
||||||
<menuitem uri="rdf:*"
|
<menuitem uri="rdf:*"
|
||||||
label="rdf:&NC_RDFNS;name"
|
label="rdf:&NC_RDFNS;name"
|
||||||
name="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>
|
</menupopup>
|
||||||
</template>
|
</template>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -221,7 +222,7 @@
|
||||||
</toolbox>
|
</toolbox>
|
||||||
|
|
||||||
<browser flex="1" id="browser" type="content-primary"
|
<browser flex="1" id="browser" type="content-primary"
|
||||||
homepage="resource:///res/samples/test0.html" />
|
homepage="about:blank" />
|
||||||
|
|
||||||
<hbox>
|
<hbox>
|
||||||
<description id="status-text" value="" />
|
<description id="status-text" value="" />
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
<!ENTITY ldb.RunBaselineMenu.accesskey "B">
|
<!ENTITY ldb.RunBaselineMenu.accesskey "B">
|
||||||
<!ENTITY ldb.RunVerifyMenu.label "Run Verify">
|
<!ENTITY ldb.RunVerifyMenu.label "Run Verify">
|
||||||
<!ENTITY ldb.RunVerifyMenu.accesskey "V">
|
<!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.label "Add New List...">
|
||||||
<!ENTITY ldb.AddNewList.accesskey "A">
|
<!ENTITY ldb.AddNewList.accesskey "A">
|
||||||
<!ENTITY ldb.RemoveListMenu.label "Remove List">
|
<!ENTITY ldb.RemoveListMenu.label "Remove List">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче