summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-05-09 11:27:03 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-05-09 12:39:51 +0200
commit0479f870e05d5d231d2d57aaeedff11544bd370c (patch)
tree95aad111d3e2578b2cc4db89c2cb34b3edf3a660 /sw
parent654150ffd05f43813332eedb969ab07fffa51b21 (diff)
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
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/htmlimport/data/tdf154581.html8
-rw-r--r--sw/qa/extras/htmlimport/htmlimport.cxx15
2 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/htmlimport/data/tdf154581.html b/sw/qa/extras/htmlimport/data/tdf154581.html
new file mode 100644
index 000000000000..b82947bc0eed
--- /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 e0859b872f91..e7880c3427e9 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");