fb2 support
This commit is contained in:
18 files changed
+2352
-54
No files matched your search
@@ -434,6 +434,37 @@ private slots:
|
||||
QVERIFY(!l2.decorations.isEmpty());
|
||||
QVERIFY(l2.decorations[0].borderLeft > 0);
|
||||
}
|
||||
|
||||
void paragraphDefaultsAndCssOverrides()
|
||||
{
|
||||
// 1. Unstyled <p> must produce zero ContainerStart/End boxes and have 2.0em indent
|
||||
const QString plainHtml = QStringLiteral("<div><p>Paragraph one</p><p>Paragraph two</p></div>");
|
||||
auto plainChunks = HtmlBlockParser::parseChunks(plainHtml, QStringLiteral("plain.xhtml"));
|
||||
QCOMPARE(plainChunks.size(), 1);
|
||||
const auto &plainBlocks = plainChunks.first().blocks;
|
||||
|
||||
// Exactly 2 blocks (both paragraphs), zero containers
|
||||
QCOMPARE(plainBlocks.size(), 2);
|
||||
QCOMPARE(plainBlocks[0].kind, BlockItem::Kind::Paragraph);
|
||||
QCOMPARE(plainBlocks[1].kind, BlockItem::Kind::Paragraph);
|
||||
QCOMPARE(plainBlocks[0].textIndent, 32.0); // 16 * 2.0
|
||||
QCOMPARE(plainBlocks[1].textIndent, 32.0);
|
||||
|
||||
// 2. Styled <p> with explicit margin must preserve box margins via ContainerStart/End
|
||||
const QString styledHtml = QStringLiteral("<div><p style=\"margin-top: 10px; margin-bottom: 12px; text-indent: 0;\">Styled paragraph</p></div>");
|
||||
auto styledChunks = HtmlBlockParser::parseChunks(styledHtml, QStringLiteral("styled.xhtml"));
|
||||
QCOMPARE(styledChunks.size(), 1);
|
||||
const auto &styledBlocks = styledChunks.first().blocks;
|
||||
|
||||
// ContainerStart, Paragraph, ContainerEnd
|
||||
QCOMPARE(styledBlocks.size(), 3);
|
||||
QCOMPARE(styledBlocks[0].kind, BlockItem::Kind::ContainerStart);
|
||||
QCOMPARE(styledBlocks[0].box.marginTop, 10.0);
|
||||
QCOMPARE(styledBlocks[0].box.marginBottom, 12.0);
|
||||
QCOMPARE(styledBlocks[1].kind, BlockItem::Kind::Paragraph);
|
||||
QCOMPARE(styledBlocks[1].textIndent, 0.0);
|
||||
QCOMPARE(styledBlocks[2].kind, BlockItem::Kind::ContainerEnd);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(ChunkLayoutEngineTest)
|
||||
|
||||
Reference in new issue
Block a user