[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sw/CppunitTest_sw_uiwriter.mk sw/qa sw/source
sw/CppunitTest_sw_uiwriter.mk | 30 sw/qa/extras/inc/swmodeltestbase.hxx | 40 + sw/qa/extras/uiwriter/data/cp1000115.fodt | 208 ++ sw/qa/extras/uiwriter/uiwriter.cxx| 13 + sw/source/core/text/frmform.cxx |8 + 5 files changed, 270 insertions(+), 29 deletions(-) New commits: commit 6c4ca575866cfda38b3769b8c302b0c94a16c952 Author: Miklos Vajna vmik...@collabora.co.uk Date: Fri Feb 13 13:47:30 2015 +0100 cp#1000115 SwTxtFrm: don't join follow just because it has no content The problem was that the bugdoc had a table, and inside the table there was a long paragraph that flows to the next page, but only the paragraph mark of it does so. We first split the frame to have space for the paragraph mark, but later decided that all the content would fit the first frame, and this way the last hard line break and the paragraph mark was painted on each other. This is normally not a problem without tables, because SwTxtFrm::FormatAdjust() just calls SplitFrm(), sets its nNew flag to non-zero make sure that later SwTxtFrm::_AdjustFollow() doesn't try to join it, and we're ready. However, when the paragraph is inside a table, then the paragraph was formatted multiple times, and next time when we already had a follow nNew was not set, so even if there was a correct split first, the new frame was joined later. Fix the problem by explicitly setting nNew for the in a table and paragraph ends with a hard line break case, that way we don't blindly join the frame, only in case there is enough space for the follow in the master. (cherry picked from commit 7e33cce05b2df3f1761bcc66606c4d3b2b2671e9) Conflicts: sw/CppunitTest_sw_uiwriter.mk sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: Iede654740dcb0d8aa768d742ee330208291a383a diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index 7d9bee8..3e57271 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -52,35 +52,7 @@ $(eval $(call gb_CppunitTest_use_api,sw_uiwriter,\ $(eval $(call gb_CppunitTest_use_ure,sw_uiwriter)) -$(eval $(call gb_CppunitTest_use_components,sw_uiwriter,\ -basic/util/sb \ -comphelper/util/comphelp \ -configmgr/source/configmgr \ -embeddedobj/util/embobj \ -filter/source/config/cache/filterconfig1 \ -framework/util/fwk \ -i18npool/util/i18npool \ -linguistic/source/lng \ -package/util/package2 \ -package/source/xstor/xstor \ -sw/util/sw \ -sw/util/swd \ -sax/source/expatwrap/expwrap \ -sfx2/util/sfx \ -svl/source/fsstor/fsstorage \ -svtools/util/svt \ -toolkit/util/tk \ -ucb/source/core/ucb1 \ -ucb/source/ucp/file/ucpfile1 \ -unotools/util/utl \ -unoxml/source/service/unoxml \ -uui/util/uui \ -$(if $(filter-out MACOSX WNT,$(OS)), \ -vcl/vcl.unx \ -) \ -$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \ -xmloff/util/xo \ -)) +$(eval $(call gb_CppunitTest_use_rdb,sw_uiwriter,services)) $(eval $(call gb_CppunitTest_use_configuration,sw_uiwriter)) diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index f59d14e..03aa054 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -34,6 +34,9 @@ #include libxml/xmlwriter.h #include libxml/xpath.h +#include libxml/tree.h +#include libxml/xpathInternals.h +#include libxml/parserInternals.h using namespace com::sun::star; @@ -267,6 +270,15 @@ protected: return xAutoStyleFamily; } +/// Similar to parseExport(), but this gives the xmlDocPtr of the layout dump. +xmlDocPtr parseLayoutDump() +{ +if (!mpXmlBuffer) +dumpLayout(); + +return xmlParseMemory((const char*)xmlBufferContent(mpXmlBuffer), xmlBufferLength(mpXmlBuffer));; +} + /** * Extract a value from the layout dump using an XPath expression and an attribute name. * @@ -295,6 +307,34 @@ protected: return aRet; } +void registerNamespaces(xmlXPathContextPtr pXmlXpathCtx) +{ +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(w), BAD_CAST(http://schemas.openxmlformats.org/wordprocessingml/2006/main;)); +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(v), BAD_CAST(urn:schemas-microsoft-com:vml)); +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(mc), BAD_CAST(http://schemas.openxmlformats.org/markup-compatibility/2006;)); +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(wps), BAD_CAST(http://schemas.microsoft.com/office/word/2010/wordprocessingShape;)); +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(wpg), BAD_CAST(http://schemas.microsoft.com/office/word/2010/wordprocessingGroup;)); +xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST(wp),
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sw/CppunitTest_sw_uiwriter.mk sw/qa sw/source
sw/CppunitTest_sw_uiwriter.mk|1 sw/qa/extras/uiwriter/data/cp171.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 45 +++ sw/source/core/inc/UndoSection.hxx |1 sw/source/core/undo/unsect.cxx |7 5 files changed, 54 insertions(+) New commits: commit 7c49d84d8725b3decf77334888276bcbbed5ad0f Author: LuboÅ¡ LuÅák l.lu...@collabora.com Date: Tue Jun 24 16:55:02 2014 +0200 fix broken redlines after undoing column count change (cp#171) Changing a document with redlines to two columns and then using undo set some redlines to point to the end of the document (done by the call to RemoveIdxFromSection() in SwUndoInsSection::UndoImpl()). Change-Id: I88b563b88beebcd1c3cb21fe61bb56cdb12cdc41 diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index 721cbf6..62c7c4e 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \ cppu \ cppuhelper \ sal \ +svl \ svt \ sw \ test \ diff --git a/sw/qa/extras/uiwriter/data/cp171.odt b/sw/qa/extras/uiwriter/data/cp171.odt new file mode 100644 index 000..109e399 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/cp171.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index e30db24..98bde55 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -9,6 +9,10 @@ #include swmodeltestbase.hxx #include ndtxt.hxx #include wrtsh.hxx +#include docary.hxx +#include redline.hxx +#include section.hxx +#include fmtclds.hxx #include UndoManager.hxx @@ -25,6 +29,7 @@ public: void testFdo69893(); void testFdo75110(); void testFdo75898(); +void testCp171(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -32,6 +37,7 @@ public: CPPUNIT_TEST(testFdo69893); CPPUNIT_TEST(testFdo75110); CPPUNIT_TEST(testFdo75898); +CPPUNIT_TEST(testCp171); CPPUNIT_TEST_SUITE_END(); private: @@ -145,6 +151,45 @@ void SwUiWriterTest::testFdo69893() CPPUNIT_ASSERT_EQUAL(OUString(Para after table.), rEnd.GetTxt()); } +void SwUiWriterTest::testCp171() +{ +SwDoc* pDoc = createDoc(cp171.odt); +SwWrtShell* pWrtShell = pDoc-GetDocShell()-GetWrtShell(); + +const SwRedlineTbl rTbl = pDoc-GetRedlineTbl(); +CPPUNIT_ASSERT_EQUAL( size_t( 2 ), rTbl.size()); +sal_uLong redlineStart0NodeIndex = rTbl[ 0 ]-Start()-nNode.GetIndex(); +sal_Int32 redlineStart0Index = rTbl[ 0 ]-Start()-nContent.GetIndex(); +sal_uLong redlineEnd0NodeIndex = rTbl[ 0 ]-End()-nNode.GetIndex(); +sal_Int32 redlineEnd0Index = rTbl[ 0 ]-End()-nContent.GetIndex(); +sal_uLong redlineStart1NodeIndex = rTbl[ 1 ]-Start()-nNode.GetIndex(); +sal_Int32 redlineStart1Index = rTbl[ 1 ]-Start()-nContent.GetIndex(); +sal_uLong redlineEnd1NodeIndex = rTbl[ 1 ]-End()-nNode.GetIndex(); +sal_Int32 redlineEnd1Index = rTbl[ 1 ]-End()-nContent.GetIndex(); + +// Change the document layout to be 2 columns, and then undo. +pWrtShell-SelAll(); +SwSectionData section(CONTENT_SECTION, pWrtShell-GetUniqueSectionName()); +SfxItemSet set( pDoc-GetDocShell()-GetPool(), RES_COL, RES_COL, 0 ); +SwFmtCol col; +col.Init( 2, 0, 1 ); +set.Put( col ); +pWrtShell-InsertSection( section, set ); +sw::UndoManager rUndoManager = pDoc-GetUndoManager(); +rUndoManager.Undo(); + +// Check that redlines are the same like at the beginning. +CPPUNIT_ASSERT_EQUAL( size_t( 2 ), rTbl.size()); +CPPUNIT_ASSERT_EQUAL( redlineStart0NodeIndex, rTbl[ 0 ]-Start()-nNode.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineStart0Index, rTbl[ 0 ]-Start()-nContent.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineEnd0NodeIndex, rTbl[ 0 ]-End()-nNode.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineEnd0Index, rTbl[ 0 ]-End()-nContent.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineStart1NodeIndex, rTbl[ 1 ]-Start()-nNode.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineStart1Index, rTbl[ 1 ]-Start()-nContent.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineEnd1NodeIndex, rTbl[ 1 ]-End()-nNode.GetIndex()); +CPPUNIT_ASSERT_EQUAL( redlineEnd1Index, rTbl[ 1 ]-End()-nContent.GetIndex()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/inc/UndoSection.hxx b/sw/source/core/inc/UndoSection.hxx index 00de819..88e9ac3 100644 --- a/sw/source/core/inc/UndoSection.hxx +++ b/sw/source/core/inc/UndoSection.hxx @@ -39,6 +39,7 @@ private: const ::std::auto_ptrSfxItemSet m_pAttrSet; ::std::auto_ptrSwHistory m_pHistory; ::std::auto_ptrSwRedlineData m_pRedlData; +::std::auto_ptrSwRedlineSaveDatas m_pRedlineSaveData; sal_uLong m_nSectionNodePos; bool
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - sw/CppunitTest_sw_uiwriter.mk
sw/CppunitTest_sw_uiwriter.mk |1 + 1 file changed, 1 insertion(+) New commits: commit db8dacf24f80f39375c9ff192c64c595243ae240 Author: LuboÅ¡ LuÅák l.lu...@collabora.com Date: Tue Jun 24 17:15:58 2014 +0200 try to fix linker error on Windows caused by last commit Change-Id: Iaad40befcde683e8b85eefa5b58bcd350fea9f71 (cherry picked from commit f511a2915ed856f048fd7dd91fd9f7537b1e0479) diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index 62c7c4e..7d9bee8 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \ cppu \ cppuhelper \ sal \ +sfx \ svl \ svt \ sw \ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits