tdf#154581 tdf#157411 tdf#158549: sw_htmlimport: Add unittest
Change-Id: I0bf120b4761447a0acc9286e7181f7cf7c40c65b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167380
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
diff --git a/sw/qa/extras/htmlimport/data/tdf154581.html b/sw/qa/extras/htmlimport/data/tdf154581.html
new file mode 100644
index 0000000..b82947b
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/tdf154581.html
@@ -0,0 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html>
<body>
<p><span style="font-weight:bold;">Bold</span></p>
<p><span style="text-decoration:underline;">underline</span></p>
<p><span style="font-style:italic;">italic</span></p>
</body>
</html>
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx
index e0859b8..e7880c3 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -9,6 +9,9 @@
#include <swmodeltestbase.hxx>
#include <com/sun/star/awt/FontSlant.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
@@ -594,6 +597,18 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testRGBAColor)
CPPUNIT_ASSERT_EQUAL(nBackColor, getProperty<Color>(xRun, "CharBackColor"));
}
CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf154581)
{
createSwWebDoc("tdf154581.html");
// Without the fix in place, this test would have failed with
// - Expected: 150
// - Actual : 100
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(awt::FontUnderline::SINGLE), getProperty<sal_Int16>(getRun(getParagraph(2), 1), "CharUnderline"));
CPPUNIT_ASSERT_EQUAL(awt::FontSlant_ITALIC, getProperty<awt::FontSlant>(getRun(getParagraph(3), 1), "CharPosture"));
}
CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf153341)
{
createSwWebDoc("tdf153341.html");