tdf#121049 - Preserve super/subscript when pasting HTML with class definition

Change-Id: Icb5c1e1536a57caf4f31f5dca49ee70174b798db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207588
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
This commit is contained in:
Andreas Heinisch
2026-07-07 13:27:56 +02:00
parent 9a56d3e117
commit 51bf1c2d45
4 changed files with 30 additions and 0 deletions
@@ -0,0 +1 @@
<p><sub class="sub">sub</sub></p>
@@ -0,0 +1 @@
<p><sup class="sup">sup</sup></p>
+26
View File
@@ -9,6 +9,8 @@
#include <swmodeltestbase.hxx>
#include <editeng/escapementitem.hxx>
#include <com/sun/star/awt/FontSlant.hpp>
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
@@ -342,6 +344,30 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf80194_subscript)
CPPUNIT_ASSERT( 70 < getProperty<sal_Int8>(xRun, u"CharEscapementHeight"_ustr));
}
CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf121049Superscript)
{
createSwWebDoc("tdf121049-superscript-class.html");
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 33 (DFLT_ESC_SUPER)
// - Actual : 0 (SvxEscapement::Off)
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Superscript for <sup> missing", sal_Int32(DFLT_ESC_SUPER),
getProperty<sal_Int32>(getRun(getParagraph(1), 1), u"CharEscapement"_ustr));
}
CPPUNIT_TEST_FIXTURE(HtmlImportTest, testTdf121049Subscript)
{
createSwWebDoc("tdf121049-subscript-class.html");
// Without the accompanying fix in place, this test would have failed with:
// - Expected: -8 (DFLT_ESC_SUB)
// - Actual : 0 (SvxEscapement::Off)
CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Subscript for <sub> missing", sal_Int32(DFLT_ESC_SUB),
getProperty<sal_Int32>(getRun(getParagraph(1), 1), u"CharEscapement"_ustr));
}
CPPUNIT_TEST_FIXTURE(HtmlImportTest, testReqIfTable)
{
setImportFilterName(TestFilter::HTML_WRITER);
+2
View File
@@ -77,6 +77,8 @@ const sal_uInt16 aItemIds[] =
RES_BREAK,
RES_PAGEDESC,
RES_KEEP,
// tdf#121049 - preserve superscript/subscript when pasting HTML with class definition
RES_CHRATR_ESCAPEMENT,
};
void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc,