sw/qa/extras/rtfexport/data/tdf158950.rtf |   21 +++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport6.cxx     |   15 +++++++++++++++
 2 files changed, 36 insertions(+)

New commits:
commit f4647575a1e80169ba6f363fff72087d22165780
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Jan 17 10:47:58 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Jan 17 16:11:51 2024 +0100

    tdf#158950: sw_rtfexport6: Add unittest
    
    Change-Id: I870c28cf6ac7e1f4150414cc5f78992eb21289e5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162190
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/rtfexport/data/tdf158950.rtf 
b/sw/qa/extras/rtfexport/data/tdf158950.rtf
new file mode 100644
index 000000000000..514196e70756
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158950.rtf
@@ -0,0 +1,21 @@
+{
tf1nsi\deff3deflang1025
+{onttbl{0romanprq2charset0 Times New Roman;}{1romanprq2charset2 
Symbol;}{2swissprq2charset0 Arial;}{3romanprq2charset0 Liberation 
Serif{\*alt Times New Roman};}{4nilprq0charset0 Courier New{\*alt 
monospace};}{5swissprq2charset0 Liberation Sans{\*alt Arial};}{6modern
prq1charset0 Courier New;}{7nilprq2charset0 Microsoft YaHei;}{8nilprq2
charset0 Lucida Sans;}{9swissprq0charset0 Lucida Sans;}}
+{+{\stylesheet{\s0\snext0
tlchf8fs24lang1081 
\ltrch\lang1033\langfe2052\hichf3\loch\widctlpar\hyphpar0spalpha\ltrpar+{\*+{\s16\sbasedon0\snext17
tlchf8fs28 \ltrch\hichf5\loch\sb240\sa120\keepn5s28\dbchf7 Heading;}
+{\s17\sbasedon0\snext17\loch\sl276\slmult1\sb0\sa140 Body Text;}
+{\s18\sbasedon17\snext18
tlchf9 \ltrch\loch\sl276\slmult1\sb0\sa140 List;}
+{\s19\sbasedon0\snext19
tlchf9fs24i \ltrch\loch\sb120\sa120
olines24\i Caption;}
+{\s20\sbasedon0\snext20
tlchf9 \ltrch\loch
oline Index;}
+{\s21\sbasedon0\snext21 Frame Contents;}
+{\s22\sbasedon21\snext22\hichf6\loch6s32 myContent;}
+}{\*\generator LODev_daily_installed/24.8.0.0.alpha0$Windows_X86_64 
LibreOffice_project/4871de96cb5e31e5ab06cf97e02e09e0e04a4de8}{\info{uthor 
Regina Henschel}{+\hyphauto1iewscale80
ormshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sftnnar\saftnnrlc\sectunlocked1\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134
tnbjtnstart1tnrstconttnnarenddocftnrstcontftnstart1ftnnrlc\htmautsp
+{\*tnsep+This is }{\loch+style}{\loch
+ formatting.}
+\par \pard\plain \s0
tlchf8fs24lang1081 
\ltrch\lang1033\langfe2052\hichf3\loch\widctlpar\hyphpar0spalpha\ltrpar+
+\par }
\ No newline at end of file
diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx 
b/sw/qa/extras/rtfexport/rtfexport6.cxx
index 590ad23452f0..e943de10622b 100644
--- a/sw/qa/extras/rtfexport/rtfexport6.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport6.cxx
@@ -722,6 +722,21 @@ DECLARE_RTFEXPORT_TEST(testTdf118047, "tdf118047.rtf")
     CPPUNIT_ASSERT_MESSAGE("Header is too large", 1000 > nHeight);
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf158950, "tdf158950.rtf")
+{
+    uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 2, 
u"style"_ustr);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: rgba[ff0000ff]
+    // - Actual  : rgba[000000ff]
+    CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, getProperty<Color>(xRun, "CharColor"));
+    CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(xRun, "CharHeight"));
+    CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xRun, 
"CharFontName"));
+    CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(xRun, 
"CharWeight"));
+    CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::NONE, 
getProperty<sal_Int16>(xRun, "CharUnderline"));
+    CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, 
getProperty<awt::FontSlant>(xRun, "CharPosture"));
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf104390, "tdf104390.rtf")
 {
     uno::Reference<text::XTextRange> xPara = getParagraph(1);

Reply via email to