summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2022-03-21 17:12:12 +0300
committerAndras Timar <andras.timar@collabora.com>2022-03-25 12:59:34 +0100
commit4d2d9cf9c3165e2460466cc75e5a8453346610c8 (patch)
treef2ace9574829ed1676b63384728c1180a3d64df9 /sw
parent36ca3df126b7497969b782a4188c8f71181b6d2d (diff)
tdf#104390: rtf import: init default font for entire state stack
If first document element is buried deep in destinations and thus deep in state stack (m_aStates) initialization of default font is very local and will be lost after closing these destinations. So let's initialize entire states stack with default font if none is provided istead of initialization just a top element. Change-Id: I966c282f43b84baece909a4c3cd359cbcd317e63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131906 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 24b5490cb0fd8de19415509fbf452874669106ad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131864 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/tdf104390.rtf6
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx15
2 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf104390.rtf b/sw/qa/extras/rtfexport/data/tdf104390.rtf
new file mode 100644
index 000000000000..842e73e19a85
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf104390.rtf
@@ -0,0 +1,6 @@
+{\rtf1\deff0
+{\fonttbl
+{\f0 Courier New;}}
+\fs72
+{{{{Hello }}}{World!}}
+} \ No newline at end of file
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 36bf6c839b65..297635fce37e 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -1339,6 +1339,21 @@ DECLARE_RTFEXPORT_TEST(testTdf118047, "tdf118047.rtf")
CPPUNIT_ASSERT_MESSAGE("Header is too large", 1000 > nHeight);
}
+DECLARE_RTFEXPORT_TEST(testTdf104390, "tdf104390.rtf")
+{
+ uno::Reference<text::XTextRange> xPara = getParagraph(1);
+ uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xPara, uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+
+ // Check font in first run
+ uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(36.f, getProperty<float>(xRun, "CharHeight"));
+ CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xRun, "CharFontName"));
+
+ // Ensure there is only one run
+ CPPUNIT_ASSERT_MESSAGE("Extra elements in paragraph", !xRunEnum->hasMoreElements());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */