17883, indentation spaces (from Daniel Bratell, bratell@lysator.liu.se),

30380, blockquote should be block (also from Daniel),
6079, URLs surrounded by quotes *and* angle brackets (from Ben Bucksch,
      mozilla@bucksch.org),
translate test into perl (so it will eventually be runnable on mac)
 and fix up some old tests (me).
This commit is contained in:
akkana%netscape.com 2000-03-14 03:01:15 +00:00
Родитель fcd7c8e21d
Коммит a48cd213bb
10 изменённых файлов: 364 добавлений и 118 удалений

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

@ -463,6 +463,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
PRInt32 whitespace;
if(NS_SUCCEEDED(GetValueOfAttribute(aNode, "style", style)) &&
(-1 != (whitespace = style.Find("white-space:"))))
/* DELETEME: What, if the style is defined in an external stylesheet? */
{
if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace))
{
@ -532,40 +533,37 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
if (type == eHTMLTag_ul)
{
// Indent here to support nested list, which aren't included in li :-(
EnsureVerticalSpace(1); // Must end the current line before we change indent.
mIndent += gIndentSizeList;
EnsureVerticalSpace(1);
}
else if (type == eHTMLTag_ol)
{
EnsureVerticalSpace(1); // Must end the current line before we change indent.
if (mOLStackIndex < OLStackSize)
mOLStack[mOLStackIndex++] = 1; // XXX should get it from the node!
mIndent += gIndentSizeList; // see ul
EnsureVerticalSpace(1);
}
else if (type == eHTMLTag_li)
{
nsAutoString temp = Spaces(gIndentSizeList - gOLNumberWidth - 2);
if (mTagStackIndex > 1 && mTagStack[mTagStackIndex-2] == eHTMLTag_ol)
{
nsAutoString number;
if (mOLStackIndex > 0)
// This is what nsBulletFrame does for OLs:
number.Append(mOLStack[mOLStackIndex-1]++, 10);
mInIndentString.Append(mOLStack[mOLStackIndex-1]++, 10);
else
number += "#";
temp += Spaces(gOLNumberWidth - number.Length()) + number + '.';
mInIndentString.Append("#");
mInIndentString.Append('.');
}
else
temp += Spaces(gOLNumberWidth) + "*";
temp += ' ';
mIndent -= gIndentSizeList; // don't indent first line so much
Write(temp); //CHANGE: does not work as intended. waiting for bug #17883
mIndent += gIndentSizeList;
mInIndentString.Append('*');
mInIndentString.Append(' ');
}
else if (type == eHTMLTag_blockquote)
{
EnsureVerticalSpace(0);
// Find out whether it's a type=cite, and insert "> " instead.
// Eventually we should get the value of the pref controlling citations,
// and handle AOL-style citations as well.
@ -585,7 +583,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
nsAutoString url;
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "href", url))
&& !url.IsEmpty())
mURL = url;
mURL = url.StripChars("\"");
}
else if (type == eHTMLTag_img)
{
@ -597,15 +595,15 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
&& !desc.IsEmpty())
{
temp += " (";
temp += desc;
temp += desc.StripChars("\"");
temp += " <";
temp += url;
temp += url.StripChars("\"");
temp += ">) ";
}
else
{
temp += " <";
temp += url;
temp += url.StripChars("\"");
temp += "> ";
}
Write(temp);
@ -613,7 +611,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
}
else if (type == eHTMLTag_sup)
Write("^");
//don't know a plain text representation of sub
// I don't know a plain text representation of sub
else if (type == eHTMLTag_strong || type == eHTMLTag_b)
Write("*");
else if (type == eHTMLTag_em || type == eHTMLTag_i)
@ -703,7 +701,8 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode)
if(mCacheLine) {
AddToLine(nsAutoString(" ").GetUnicode(), 1);
} else {
WriteSimple(" ");
nsAutoString space(" ");
WriteSimple(space);
}
mInWhitespace = PR_TRUE;
}
@ -844,8 +843,14 @@ void nsHTMLToTXTSinkStream::EnsureBufferSize(PRInt32 aNewSize)
}
}
void nsHTMLToTXTSinkStream::EncodeToBuffer(const nsString& aSrc)
void nsHTMLToTXTSinkStream::EncodeToBuffer(nsString& aSrc)
{
// First, replace all nbsp characters with spaces,
// which the unicode encoder won't do for us.
PRUnichar nbsp = 160;
PRUnichar space = ' ';
aSrc.ReplaceChar(nbsp, space);
if (mUnicodeEncoder == nsnull)
{
NS_WARNING("The unicode encoder needs to be initialized");
@ -868,14 +873,6 @@ void nsHTMLToTXTSinkStream::EncodeToBuffer(const nsString& aSrc)
PRInt32 temp = mBufferLength;
if (NS_SUCCEEDED(result))
result = mUnicodeEncoder->Finish(mBuffer,&temp);
// XXX UGH! This is awful and needs to be removed.
#define CH_NBSP 160
for (PRInt32 i = 0; i < mBufferLength; i++)
{
if (mBuffer[i] == char(CH_NBSP))
mBuffer[i] = ' ';
}
}
}
@ -913,7 +910,7 @@ nsHTMLToTXTSinkStream::FlushLine()
* @param
* @return
*/
void nsHTMLToTXTSinkStream::WriteSimple(const nsString& aString)
void nsHTMLToTXTSinkStream::WriteSimple(nsString& aString)
{
// If a encoder is being used then convert first convert the input string
if (mUnicodeEncoder != nsnull)
@ -1079,29 +1076,31 @@ nsHTMLToTXTSinkStream::WriteQuotesAndIndent()
{
// Put the mail quote "> " chars in, if appropriate:
if (mCiteQuoteLevel>0) {
// Check for out of memory?
char* gts = NS_STATIC_CAST(char*, nsAllocator::Alloc(mCiteQuoteLevel+2));
nsAutoString quotes;
for(int i=0; i<mCiteQuoteLevel; i++) {
gts[i]='>';
quotes.Append('>');
}
gts[mCiteQuoteLevel] = ' ';
gts[mCiteQuoteLevel+1] = '\0';
nsAutoString temp(gts);
WriteSimple(temp);
quotes.Append(' ');
WriteSimple(quotes);
mColPos += (mCiteQuoteLevel+1);
nsAllocator::Free(gts);
}
// Indent if necessary
if (mIndent > 0) {
char* spaces = NS_STATIC_CAST(char*, nsAllocator::Alloc(mIndent+1));
for (int i=0; i<mIndent; ++i)
spaces[i] = ' ';
spaces[mIndent] = '\0';
nsAutoString temp(spaces);
WriteSimple(temp);
mColPos += mIndent;
nsAllocator::Free(spaces);
PRInt32 indentwidth = mIndent - mInIndentString.Length();
if (indentwidth > 0) {
nsAutoString spaces;
for (int i=0; i<indentwidth; ++i)
spaces.Append(' ');
WriteSimple(spaces);
mColPos += indentwidth;
}
if(mInIndentString.Length()>0) {
WriteSimple(mInIndentString);
mColPos += mInIndentString.Length();
mInIndentString.Truncate();
}
}
#ifdef DEBUG_akkana_not

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

@ -148,9 +148,9 @@ protected:
void EnsureVerticalSpace(PRInt32 noOfRows);
void FlushLine();
void WriteQuotesAndIndent();
void WriteSimple(const nsString& aString);
void WriteSimple(nsString& aString);
void Write(const nsString& aString);
void EncodeToBuffer(const nsString& aString);
void EncodeToBuffer(nsString& aString);
NS_IMETHOD GetValueOfAttribute(const nsIParserNode& aNode,
char* aMatchKey,
nsString& aValueRet);
@ -162,6 +162,9 @@ protected:
nsString mCurrentLine;
PRInt32 mIndent;
// mInIndentString keeps a header that has to be written in the indent.
// That could be, for instance, the bullet in a bulleted list.
nsString mInIndentString;
PRInt32 mCiteQuoteLevel;
PRInt32 mColPos;
PRInt32 mFlags;

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

@ -0,0 +1,113 @@
#! perl
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Akkana Peck.
#
# This is a collection of test files to guard against regressions
# in the Gecko output system.
#
$errmsg = "";
print "Testing simple html to html ...\n";
$status = system("TestOutput -i text/html -o text/html -f 0 -c OutTestData/simple.html OutTestData/simple.html");
if ($status != 0) {
print "Simple html to html failed.\n";
$errmsg = "$errmsg simple.html";
}
print "Testing simple copy case ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/simplecopy.out OutTestData/simple.html");
if ($status != 0) {
print "Simple copy test failed.\n";
$errmsg = "$errmsg simplecopy.out";
}
print "Testing simple html to plaintext formatting ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 34 -w 70 -c OutTestData/simplefmt.out OutTestData/simple.html");
print "xxxxxxxx Status = " + $status + "\n";
if ($status != 0) {
print("Simple formatting test failed.\n");
$errmsg = "$errmsg simplefmt.out ";
}
print "Testing non-wrapped plaintext in preformatted mode ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 16 -c OutTestData/plainnowrap.out OutTestData/plain.html");
if ($status != 0) {
print "Non-wrapped plaintext test failed.\n";
$errmsg = "$errmsg plainnowrap.out";
}
# print "Testing wrapped and formatted plaintext ...\n";
$status = system("# TestOutput -i text/html -o text/plain -f 32 -c OutTestData/plainwrap.out OutTestData/plain.html");
# if ($status != 0) {
# print "Wrapped plaintext test failed.\n";
# $errmsg = "$errmsg plainwrap.out";
# }
print "Testing mail quoting ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 2 -w 50 -c OutTestData/mailquote.out OutTestData/mailquote.html");
if ($status != 0) {
print "Mail quoting test failed.\n";
$errmsg = "$errmsg mailquote.out";
}
print "Testing conversion of XIF entities ...\n";
$status = system("TestOutput -i text/xif -o text/plain -c OutTestData/entityxif.out OutTestData/entityxif.xif");
if ($status != 0) {
print "XIF entity conversion test failed.\n";
$errmsg = "$errmsg entityxif.out";
}
print "Testing XIF to HTML ...\n";
$status = system("TestOutput -i text/xif -o text/html -c OutTestData/xifstuff.out OutTestData/xifstuff.xif");
if ($status != 0) {
print "XIF to HTML conversion test failed.\n";
$errmsg = "$errmsg xifstuff.out";
}
print "Testing HTML Table to Text ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 2 -c OutTestData/htmltable.out OutTestData/htmltable.html");
if ($status != 0) {
print "HTML Table to Plain text failed.\n";
$errmsg = "$errmsg htmltable.out";
}
print "Testing XIF to plain with doctype (bug 28447) ...\n";
$status = system("TestOutput -i text/xif -o text/plain -f 2 -c OutTestData/xifdtplain.out OutTestData/doctype.xif");
if ($status != 0) {
print "XIF to plain with doctype failed.\n";
$errmsg = "$errmsg xifdtplain.out";
}
print "Testing XIF to html with doctype ...\n";
$status = system("TestOutput -i text/xif -o text/html -f 0 -c OutTestData/xifdthtml.out OutTestData/doctype.xif");
if ($status != 0) {
print "XIF to html with doctype failed.\n";
$errmsg = "$errmsg xifdthtml.out";
}
if ($errmsg ne "") {
print "\nERROR: DOM CONVERSION TEST FAILED: $errmsg\n";
exit 1
} else {
print "DOM CONVERSION TESTS SUCCEEDED\n";
}

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

@ -52,5 +52,12 @@ Here is a <em>list</em>:
<p>Here is a paragraph after the list.</p>
Here is a blockquote:
<blockquote>
The quick brown fox
jumped over
the lazy dog
</blockquote>
</body>
</html>

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

@ -1,8 +1,8 @@
Simple html page
Here is a link to the mozilla.org <"http://www.mozilla.org"> page.
Here is some _underlined and *bold*ened_ified text plus some <angle
bracket entities>.
Here is a link to the mozilla.org <http://www.mozilla.org> page. Here
is some _underlined and *bold*ened_ified text plus some <angle bracket
entities>.
Here is a line ending with a space followed by a line break. Plaintext
output should contain only one space (and no line breaks) between
@ -10,14 +10,15 @@ output should contain only one space (and no line breaks) between
Here is a /list/:
* An item
* A nested ordered list:
*
* An item
* A nested ordered list:
*
1. item one
2. item two
1. item one
2. item two
* last item
* last item
Here is a paragraph after the list.
Here is a blockquote:
The quick brown fox jumped over the lazy dog

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

@ -463,6 +463,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
PRInt32 whitespace;
if(NS_SUCCEEDED(GetValueOfAttribute(aNode, "style", style)) &&
(-1 != (whitespace = style.Find("white-space:"))))
/* DELETEME: What, if the style is defined in an external stylesheet? */
{
if (-1 != style.Find("-moz-pre-wrap", PR_TRUE, whitespace))
{
@ -532,40 +533,37 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
if (type == eHTMLTag_ul)
{
// Indent here to support nested list, which aren't included in li :-(
EnsureVerticalSpace(1); // Must end the current line before we change indent.
mIndent += gIndentSizeList;
EnsureVerticalSpace(1);
}
else if (type == eHTMLTag_ol)
{
EnsureVerticalSpace(1); // Must end the current line before we change indent.
if (mOLStackIndex < OLStackSize)
mOLStack[mOLStackIndex++] = 1; // XXX should get it from the node!
mIndent += gIndentSizeList; // see ul
EnsureVerticalSpace(1);
}
else if (type == eHTMLTag_li)
{
nsAutoString temp = Spaces(gIndentSizeList - gOLNumberWidth - 2);
if (mTagStackIndex > 1 && mTagStack[mTagStackIndex-2] == eHTMLTag_ol)
{
nsAutoString number;
if (mOLStackIndex > 0)
// This is what nsBulletFrame does for OLs:
number.Append(mOLStack[mOLStackIndex-1]++, 10);
mInIndentString.Append(mOLStack[mOLStackIndex-1]++, 10);
else
number += "#";
temp += Spaces(gOLNumberWidth - number.Length()) + number + '.';
mInIndentString.Append("#");
mInIndentString.Append('.');
}
else
temp += Spaces(gOLNumberWidth) + "*";
temp += ' ';
mIndent -= gIndentSizeList; // don't indent first line so much
Write(temp); //CHANGE: does not work as intended. waiting for bug #17883
mIndent += gIndentSizeList;
mInIndentString.Append('*');
mInIndentString.Append(' ');
}
else if (type == eHTMLTag_blockquote)
{
EnsureVerticalSpace(0);
// Find out whether it's a type=cite, and insert "> " instead.
// Eventually we should get the value of the pref controlling citations,
// and handle AOL-style citations as well.
@ -585,7 +583,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
nsAutoString url;
if (NS_SUCCEEDED(GetValueOfAttribute(aNode, "href", url))
&& !url.IsEmpty())
mURL = url;
mURL = url.StripChars("\"");
}
else if (type == eHTMLTag_img)
{
@ -597,15 +595,15 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
&& !desc.IsEmpty())
{
temp += " (";
temp += desc;
temp += desc.StripChars("\"");
temp += " <";
temp += url;
temp += url.StripChars("\"");
temp += ">) ";
}
else
{
temp += " <";
temp += url;
temp += url.StripChars("\"");
temp += "> ";
}
Write(temp);
@ -613,7 +611,7 @@ nsHTMLToTXTSinkStream::OpenContainer(const nsIParserNode& aNode)
}
else if (type == eHTMLTag_sup)
Write("^");
//don't know a plain text representation of sub
// I don't know a plain text representation of sub
else if (type == eHTMLTag_strong || type == eHTMLTag_b)
Write("*");
else if (type == eHTMLTag_em || type == eHTMLTag_i)
@ -703,7 +701,8 @@ nsHTMLToTXTSinkStream::CloseContainer(const nsIParserNode& aNode)
if(mCacheLine) {
AddToLine(nsAutoString(" ").GetUnicode(), 1);
} else {
WriteSimple(" ");
nsAutoString space(" ");
WriteSimple(space);
}
mInWhitespace = PR_TRUE;
}
@ -844,8 +843,14 @@ void nsHTMLToTXTSinkStream::EnsureBufferSize(PRInt32 aNewSize)
}
}
void nsHTMLToTXTSinkStream::EncodeToBuffer(const nsString& aSrc)
void nsHTMLToTXTSinkStream::EncodeToBuffer(nsString& aSrc)
{
// First, replace all nbsp characters with spaces,
// which the unicode encoder won't do for us.
PRUnichar nbsp = 160;
PRUnichar space = ' ';
aSrc.ReplaceChar(nbsp, space);
if (mUnicodeEncoder == nsnull)
{
NS_WARNING("The unicode encoder needs to be initialized");
@ -868,14 +873,6 @@ void nsHTMLToTXTSinkStream::EncodeToBuffer(const nsString& aSrc)
PRInt32 temp = mBufferLength;
if (NS_SUCCEEDED(result))
result = mUnicodeEncoder->Finish(mBuffer,&temp);
// XXX UGH! This is awful and needs to be removed.
#define CH_NBSP 160
for (PRInt32 i = 0; i < mBufferLength; i++)
{
if (mBuffer[i] == char(CH_NBSP))
mBuffer[i] = ' ';
}
}
}
@ -913,7 +910,7 @@ nsHTMLToTXTSinkStream::FlushLine()
* @param
* @return
*/
void nsHTMLToTXTSinkStream::WriteSimple(const nsString& aString)
void nsHTMLToTXTSinkStream::WriteSimple(nsString& aString)
{
// If a encoder is being used then convert first convert the input string
if (mUnicodeEncoder != nsnull)
@ -1079,29 +1076,31 @@ nsHTMLToTXTSinkStream::WriteQuotesAndIndent()
{
// Put the mail quote "> " chars in, if appropriate:
if (mCiteQuoteLevel>0) {
// Check for out of memory?
char* gts = NS_STATIC_CAST(char*, nsAllocator::Alloc(mCiteQuoteLevel+2));
nsAutoString quotes;
for(int i=0; i<mCiteQuoteLevel; i++) {
gts[i]='>';
quotes.Append('>');
}
gts[mCiteQuoteLevel] = ' ';
gts[mCiteQuoteLevel+1] = '\0';
nsAutoString temp(gts);
WriteSimple(temp);
quotes.Append(' ');
WriteSimple(quotes);
mColPos += (mCiteQuoteLevel+1);
nsAllocator::Free(gts);
}
// Indent if necessary
if (mIndent > 0) {
char* spaces = NS_STATIC_CAST(char*, nsAllocator::Alloc(mIndent+1));
for (int i=0; i<mIndent; ++i)
spaces[i] = ' ';
spaces[mIndent] = '\0';
nsAutoString temp(spaces);
WriteSimple(temp);
mColPos += mIndent;
nsAllocator::Free(spaces);
PRInt32 indentwidth = mIndent - mInIndentString.Length();
if (indentwidth > 0) {
nsAutoString spaces;
for (int i=0; i<indentwidth; ++i)
spaces.Append(' ');
WriteSimple(spaces);
mColPos += indentwidth;
}
if(mInIndentString.Length()>0) {
WriteSimple(mInIndentString);
mColPos += mInIndentString.Length();
mInIndentString.Truncate();
}
}
#ifdef DEBUG_akkana_not

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

@ -148,9 +148,9 @@ protected:
void EnsureVerticalSpace(PRInt32 noOfRows);
void FlushLine();
void WriteQuotesAndIndent();
void WriteSimple(const nsString& aString);
void WriteSimple(nsString& aString);
void Write(const nsString& aString);
void EncodeToBuffer(const nsString& aString);
void EncodeToBuffer(nsString& aString);
NS_IMETHOD GetValueOfAttribute(const nsIParserNode& aNode,
char* aMatchKey,
nsString& aValueRet);
@ -162,6 +162,9 @@ protected:
nsString mCurrentLine;
PRInt32 mIndent;
// mInIndentString keeps a header that has to be written in the indent.
// That could be, for instance, the bullet in a bulleted list.
nsString mInIndentString;
PRInt32 mCiteQuoteLevel;
PRInt32 mColPos;
PRInt32 mFlags;

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

@ -0,0 +1,113 @@
#! perl
# The contents of this file are subject to the Netscape 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/NPL/
#
# 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 Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Akkana Peck.
#
# This is a collection of test files to guard against regressions
# in the Gecko output system.
#
$errmsg = "";
print "Testing simple html to html ...\n";
$status = system("TestOutput -i text/html -o text/html -f 0 -c OutTestData/simple.html OutTestData/simple.html");
if ($status != 0) {
print "Simple html to html failed.\n";
$errmsg = "$errmsg simple.html";
}
print "Testing simple copy case ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/simplecopy.out OutTestData/simple.html");
if ($status != 0) {
print "Simple copy test failed.\n";
$errmsg = "$errmsg simplecopy.out";
}
print "Testing simple html to plaintext formatting ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 34 -w 70 -c OutTestData/simplefmt.out OutTestData/simple.html");
print "xxxxxxxx Status = " + $status + "\n";
if ($status != 0) {
print("Simple formatting test failed.\n");
$errmsg = "$errmsg simplefmt.out ";
}
print "Testing non-wrapped plaintext in preformatted mode ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 16 -c OutTestData/plainnowrap.out OutTestData/plain.html");
if ($status != 0) {
print "Non-wrapped plaintext test failed.\n";
$errmsg = "$errmsg plainnowrap.out";
}
# print "Testing wrapped and formatted plaintext ...\n";
$status = system("# TestOutput -i text/html -o text/plain -f 32 -c OutTestData/plainwrap.out OutTestData/plain.html");
# if ($status != 0) {
# print "Wrapped plaintext test failed.\n";
# $errmsg = "$errmsg plainwrap.out";
# }
print "Testing mail quoting ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 2 -w 50 -c OutTestData/mailquote.out OutTestData/mailquote.html");
if ($status != 0) {
print "Mail quoting test failed.\n";
$errmsg = "$errmsg mailquote.out";
}
print "Testing conversion of XIF entities ...\n";
$status = system("TestOutput -i text/xif -o text/plain -c OutTestData/entityxif.out OutTestData/entityxif.xif");
if ($status != 0) {
print "XIF entity conversion test failed.\n";
$errmsg = "$errmsg entityxif.out";
}
print "Testing XIF to HTML ...\n";
$status = system("TestOutput -i text/xif -o text/html -c OutTestData/xifstuff.out OutTestData/xifstuff.xif");
if ($status != 0) {
print "XIF to HTML conversion test failed.\n";
$errmsg = "$errmsg xifstuff.out";
}
print "Testing HTML Table to Text ...\n";
$status = system("TestOutput -i text/html -o text/plain -f 2 -c OutTestData/htmltable.out OutTestData/htmltable.html");
if ($status != 0) {
print "HTML Table to Plain text failed.\n";
$errmsg = "$errmsg htmltable.out";
}
print "Testing XIF to plain with doctype (bug 28447) ...\n";
$status = system("TestOutput -i text/xif -o text/plain -f 2 -c OutTestData/xifdtplain.out OutTestData/doctype.xif");
if ($status != 0) {
print "XIF to plain with doctype failed.\n";
$errmsg = "$errmsg xifdtplain.out";
}
print "Testing XIF to html with doctype ...\n";
$status = system("TestOutput -i text/xif -o text/html -f 0 -c OutTestData/xifdthtml.out OutTestData/doctype.xif");
if ($status != 0) {
print "XIF to html with doctype failed.\n";
$errmsg = "$errmsg xifdthtml.out";
}
if ($errmsg ne "") {
print "\nERROR: DOM CONVERSION TEST FAILED: $errmsg\n";
exit 1
} else {
print "DOM CONVERSION TESTS SUCCEEDED\n";
}

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

@ -52,5 +52,12 @@ Here is a <em>list</em>:
<p>Here is a paragraph after the list.</p>
Here is a blockquote:
<blockquote>
The quick brown fox
jumped over
the lazy dog
</blockquote>
</body>
</html>

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

@ -1,8 +1,8 @@
Simple html page
Here is a link to the mozilla.org <"http://www.mozilla.org"> page.
Here is some _underlined and *bold*ened_ified text plus some <angle
bracket entities>.
Here is a link to the mozilla.org <http://www.mozilla.org> page. Here
is some _underlined and *bold*ened_ified text plus some <angle bracket
entities>.
Here is a line ending with a space followed by a line break. Plaintext
output should contain only one space (and no line breaks) between
@ -10,14 +10,15 @@ output should contain only one space (and no line breaks) between
Here is a /list/:
* An item
* A nested ordered list:
*
* An item
* A nested ordered list:
*
1. item one
2. item two
1. item one
2. item two
* last item
* last item
Here is a paragraph after the list.
Here is a blockquote:
The quick brown fox jumped over the lazy dog