diff options
author | Justin Luth <jluth@mail.com> | 2023-02-09 11:05:48 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-02-09 23:14:46 +0000 |
commit | ff3440535e786c73237176670372c565ca3421b4 (patch) | |
tree | 1e64c8305d9029b8685aa8ef612f7e9d6ddbfc57 | |
parent | 10ed0b5c09eefc53c8e8a6f606faf29dac5f4d80 (diff) |
tdf#153042 doc/x/rtf: pre-emptive unit tests for numbering tabstop
These existing unit tests need to have a tabstop in the front.
Although different versions of MS Word can handle similar situations
differently (regardless of compatibility settings - i.e. buggy)
in these cases they are all rendered the same way by Word 2003/2010/2019.
make CppunitTest_sw_rtfimport CPPUNIT_TEST_NAME=testTdf78506
make CppunitTest_sw_rtfimport CPPUNIT_TEST_NAME=testTdf116265
In this one, LO's chapter numbering defaults to none-numbering
followed by a tabstop. The tabstop should not be there/never become visible.
make CppunitTest_sw_ww8export3 CPPUNIT_TEST_NAME=testPresetDash
For this added test, older versions of Word 2010/2003 don't show a tabstop.
According to MS Word 2019 however, this should have a tabstop in the front.
make CppunitTest_sw_ooxmlexport18 CPPUNIT_TEST_NAME=testTdf153042_largeTab
... but this nearly identical file does not display with any tabstop,
and looks the same in all versions of Word.
make CppunitTest_sw_ooxmlexport18 CPPUNIT_TEST_NAME=testTdf153042_noTab
Change-Id: I59d904ef7dd37b694b02f57d6743ee5b232b42a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146731
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf153042_largeTab.docx | bin | 0 -> 14504 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf153042_noTab.docx | bin | 0 -> 14550 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 32 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 5 |
5 files changed, 45 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153042_largeTab.docx b/sw/qa/extras/ooxmlexport/data/tdf153042_largeTab.docx Binary files differnew file mode 100644 index 000000000000..87730d6d1215 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf153042_largeTab.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf153042_noTab.docx b/sw/qa/extras/ooxmlexport/data/tdf153042_noTab.docx Binary files differnew file mode 100644 index 000000000000..38b5208eab44 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf153042_noTab.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 2441a7febfd8..8de09d6d3c7c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -80,6 +80,38 @@ DECLARE_OOXMLEXPORT_TEST(testTdf147646, "tdf147646_mergedCellNumbering.docx") CPPUNIT_ASSERT_EQUAL(OUString("2."),parseDump("/root/page/body/tab/row[4]/cell/txt/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']","expand")); } +DECLARE_OOXMLEXPORT_TEST(testTdf153042_largeTab, "tdf153042_largeTab.docx") +{ + // This is not the greatest test because it is slightly weird, and has a different layout + // in MS Word 2010/2003 than it does in Word 2019. This tests for the 2019 layout. + // Additionally (in Word 2019), going to paragraph properties and hitting OK changes the layout. + // It changes back by going to outline numbering properties and hitting OK. + + // export does not keep the tabstop when exporting non-numbering. (Probably a good thing...) + if (isExported()) + return; + + const auto& pLayout = parseLayoutDump(); + // Ensure a large tabstop is used in the pseudo-numbering (numbering::NONE followed by tabstop) + assertXPath(pLayout, "//SwFixPortion", "width", "1701"); +} + +DECLARE_OOXMLEXPORT_TEST(testTdf153042_noTab, "tdf153042_noTab.docx") +{ + // This is not the greatest test because it is slightly weird. + // It is the same as the "largeTab" file, except the paragraph properties were viewed + // and OK'ed, and now it looks like how Word 2010 and 2003 were laying it out. + // Amazingly, LO is handling both documents correctly at the moment, so let's unit test that... + + // export does not keep the tabstop when exporting non-numbering. (Probably a good thing...) + if (isExported()) + return; + + const auto& pLayout = parseLayoutDump(); + // Ensure a miniscule tab is used in the pseudo-numbering (numbering::NONE followed by tabstop) + assertXPath(pLayout, "//SwFixPortion", "width", "10"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf149551_mongolianVert) { // Given a docx document with a shape with vert="mongolianVert". diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index eb2596e44c44..37acceaa7d6c 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -743,6 +743,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116265) // matching \fi in list definition (and with invalid level numbers). CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); + + const auto& pLayout = parseLayoutDump(); + // Ensure that there is a tabstop in the pseudo-numbering (numbering::NONE followed by tabstop) + assertXPath(pLayout, "//SwFixPortion", 1); } CPPUNIT_TEST_FIXTURE(Test, testFdo66565) @@ -1422,6 +1426,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf78506) // This was '0', invalid \levelnumbers wasn't ignored. CPPUNIT_ASSERT(rProp.Value.get<OUString>().isEmpty()); } + + const auto& pLayout = parseLayoutDump(); + // Ensure that there is a tabstop in the pseudo-numbering (numbering::NONE followed by tabstop) + assertXPath(pLayout, "//SwFixPortion", 1); } CPPUNIT_TEST_FIXTURE(Test, testTdf117403) diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index ae83818c16e2..0b116c232d60 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -852,6 +852,11 @@ DECLARE_WW8EXPORT_TEST(testPresetDash, "tdf127166_prstDash_Word97.doc") && aPresetLineDash.Distance == aShapeLineDash.Distance; CPPUNIT_ASSERT_MESSAGE("LineDash differ", bIsEqual); } + + const auto& pLayout = parseLayoutDump(); + // Ensure that there is no tabstop in the first paragraph (despite chapter numbering's setting) + // This is a pre-emptive test to ensure something visibly correct is not broken. + assertXPath(pLayout, "//body/txt[1]//SwFixPortion", 0); } CPPUNIT_TEST_FIXTURE(Test, testRtlGutter) |