From 3f37e1a74e528213ff21d4fdb46c7c3bd76db22c Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 24 Jan 2015 15:06:00 -0500 Subject: [PATCH] Bug 1119503 - Part 4: Add a test for serialization of block elements without style information; r=bzbarsky --- dom/base/test/TestPlainTextSerializer.cpp | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dom/base/test/TestPlainTextSerializer.cpp b/dom/base/test/TestPlainTextSerializer.cpp index 7be9bce0fda0..b1a7f2413508 100644 --- a/dom/base/test/TestPlainTextSerializer.cpp +++ b/dom/base/test/TestPlainTextSerializer.cpp @@ -137,6 +137,31 @@ TestPreElement() return NS_OK; } +nsresult +TestBlockElement() +{ + nsString test; + test.AppendLiteral( + "" NS_LINEBREAK + "" NS_LINEBREAK + "
" NS_LINEBREAK + " first" NS_LINEBREAK + "
" NS_LINEBREAK + "
" NS_LINEBREAK + " second" NS_LINEBREAK + "
" NS_LINEBREAK + "" NS_LINEBREAK ""); + + ConvertBufToPlainText(test, 0); + if (!test.EqualsLiteral("first" NS_LINEBREAK "second" NS_LINEBREAK)) { + fail("Wrong prettyprinted html to text serialization"); + return NS_ERROR_FAILURE; + } + + passed("prettyprinted HTML to text serialization test"); + return NS_OK; +} + nsresult TestPlainTextSerializer() { @@ -163,6 +188,9 @@ TestPlainTextSerializer() rv = TestPreElement(); NS_ENSURE_SUCCESS(rv, rv); + rv = TestBlockElement(); + NS_ENSURE_SUCCESS(rv, rv); + // Add new tests here... return NS_OK; }