Bug 1119503 - Part 4: Add a test for serialization of block elements without style information; r=bzbarsky
☠☠ backed out by b2b10231606b ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 24 Jan 2015 15:06:00 -0500
changeset 239430 5ccef8ecf3195770b9bcbb1b318a3e97335a5991
parent 239429 8c2129ff88976e02da6b3ce53fc6a09ceb93d0e1
child 239431 05ee3ae066437407e38590c8e3586b321167fdfe
push id497
push usermleibovic@mozilla.com
push dateWed, 28 Jan 2015 16:43:37 +0000
reviewersbzbarsky
bugs1119503
milestone38.0a1
Bug 1119503 - Part 4: Add a test for serialization of block elements without style information; r=bzbarsky
dom/base/test/TestPlainTextSerializer.cpp
--- a/dom/base/test/TestPlainTextSerializer.cpp
+++ b/dom/base/test/TestPlainTextSerializer.cpp
@@ -133,16 +133,41 @@ TestPreElement()
     return NS_ERROR_FAILURE;
   }
 
   passed("prettyprinted HTML to text serialization test");
   return NS_OK;
 }
 
 nsresult
+TestBlockElement()
+{
+  nsString test;
+  test.AppendLiteral(
+    "<html>" NS_LINEBREAK
+    "<body>" NS_LINEBREAK
+    "<div>" NS_LINEBREAK
+    "  first" NS_LINEBREAK
+    "</div>" NS_LINEBREAK
+    "<div>" NS_LINEBREAK
+    "  second" NS_LINEBREAK
+    "</div>" NS_LINEBREAK
+    "</body>" NS_LINEBREAK "</html>");
+
+  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()
 {
   nsString test;
   test.AppendLiteral("<html><base>base</base><head><span>span</span></head>"
                      "<body>body</body></html>");
   ConvertBufToPlainText(test, 0);
   if (!test.EqualsLiteral("basespanbody")) {
     fail("Wrong html to text serialization");
@@ -158,16 +183,19 @@ TestPlainTextSerializer()
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = TestPrettyPrintedHtml();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = TestPreElement();
   NS_ENSURE_SUCCESS(rv, rv);
 
+  rv = TestBlockElement();
+  NS_ENSURE_SUCCESS(rv, rv);
+
   // Add new tests here...
   return NS_OK;
 }
 
 int main(int argc, char** argv)
 {
   ScopedXPCOM xpcom("PlainTextSerializer");
   if (xpcom.failed())