summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-09-24 23:07:16 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-09-25 08:40:12 +0200
commit49614a9ea971ff7f370f863ce8a2735aab973cee (patch)
treecb4dcde41909007d9f9c31d0b0d9e1cef2e0a43b /sw/qa
parent7a8acab1ee7a9396b514e901b1e4fbd51bacb586 (diff)
tdf#119599 RTF import: fix missing deduplication of font size
Deciding when to and when not to deduplicate repeated direct formatting of paragraph / character properties is stricky, this bug is about a case when deduplication should happen and did not, since commit 1970a686273c5d4fc1eeb4430283e37085d9f647 (tdf#113408 RTF import style dedup: separate paragraph and character handling, 2017-10-31). Especially that deduplication works in both directions: it should remove properties which are duplicated and also should insert explicit default values for not repeated properties. Fix the problem by making the getDefaultSPRM() aware of the context (which style type it deals with), and then by making sure that only default properties relevant for the given style type are inserted. Change-Id: I35b6599cc47fa51b8754fd921c61a3b31a283547 Reviewed-on: https://gerrit.libreoffice.org/60946 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/rtfimport/data/tdf119599.rtf9
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx8
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf119599.rtf b/sw/qa/extras/rtfimport/data/tdf119599.rtf
new file mode 100644
index 000000000000..5a5d4654a43b
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf119599.rtf
@@ -0,0 +1,9 @@
+{\rtf1\ansi
+{\stylesheet
+{\s0 Normal;}
+{\s146\fs32 para style;}
+}
+\paperh15840\paperw12240\margl1800\margr1800\margt1440\margb1440
+\pard\plain \s146\fs32
+hello.
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index fedfb7fbd4ce..d26a0f886e8c 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1148,6 +1148,14 @@ DECLARE_RTFIMPORT_TEST(testTdf90260Par, "hello.rtf")
CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
}
+DECLARE_RTFIMPORT_TEST(testTdf119599, "tdf119599.rtf")
+{
+ uno::Reference<beans::XPropertyState> xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY);
+ // This was beans::PropertyState_DIRECT_VALUE, changing the font size in
+ // the style had no effect on the rendering result.
+ CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, xRun->getPropertyState("CharHeight"));
+}
+
DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);