summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextdocument
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-09-04 13:05:46 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-09-04 13:09:12 (GMT)
commit3eb65f48c97dc5e1a8980afa35bea8e4b16f08ba (patch)
treefe1e43eb08314fd5cd548d9d48e17f16950c5bbf /tests/auto/qtextdocument
parente15ab744f15127422ef62a0b70e6cf129f52f48f (diff)
downloadQt-3eb65f48c97dc5e1a8980afa35bea8e4b16f08ba.zip
Qt-3eb65f48c97dc5e1a8980afa35bea8e4b16f08ba.tar.gz
Qt-3eb65f48c97dc5e1a8980afa35bea8e4b16f08ba.tar.bz2
Remove implicit margin on bulleted lists when exporting to HTML
When we export a bulleted list to HTML, we add a meta-block around the list items to set the bullet style of the list (<ul> or <ol>.) This block will implicitly have a margin, even if the list itself does not in the internal document. The result is that exporting a list to HTML and then reloading it will give a different apperance, because the 0 margin of the original was not saved. The fix is to always set the meta-block's margin to 0, since it is only there to set the bullet style and should not affect the layout at all. Task-number: 201228 Reviewed-by: Simon Hausmann
Diffstat (limited to 'tests/auto/qtextdocument')
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 1835373..34b6f14 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -1128,7 +1128,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("lists") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>");
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li DEFAULTBLOCKSTYLE>Blah</li></ul>");
}
{
@@ -1151,7 +1151,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("charfmt-for-list-item") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("<ul style=\"-qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>");
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blubb</li>\n<li style=\" color:#0000ff;\" DEFAULTBLOCKSTYLE><span style=\" color:#ff0000;\">Blah</span></li></ul>");
}
{
@@ -1181,7 +1181,7 @@ void tst_QTextDocument::toHtml_data()
QTest::newRow("list-indent") << QTextDocumentFragment(&doc)
<<
QString("EMPTYBLOCK") +
- QString("<ul style=\"-qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>");
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 4;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>");
}
{
@@ -1445,6 +1445,21 @@ void tst_QTextDocument::toHtml_data()
"\n<p OPENDEFAULTBLOCKSTYLE page-break-before:always; page-break-after:always;\">Bar</p>"
"\n<table border=\"1\" style=\" page-break-after:always;\" cellspacing=\"2\">\n<tr>\n<td></td></tr></table>");
}
+
+ {
+ CREATE_DOC_AND_CURSOR();
+
+ QTextListFormat listFmt;
+ listFmt.setStyle(QTextListFormat::ListDisc);
+
+ cursor.insertList(listFmt);
+ cursor.insertText("Blah");
+
+ QTest::newRow("list-ul-margin") << QTextDocumentFragment(&doc)
+ << QString("EMPTYBLOCK") +
+ QString("<ul style=\"margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;\"><li DEFAULTBLOCKSTYLE>Blah</li></ul>");
+
+ }
}
void tst_QTextDocument::toHtml()