sw/Module_sw.mk | 2 +- sw/qa/extras/uiwriter/data/fdo69893.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 28 +++++++++++++++++++++++----- sw/source/ui/wrtsh/select.cxx | 6 ++++++ 4 files changed, 30 insertions(+), 6 deletions(-)
New commits: commit e6f87a6f38e9c5ae9e0e089c4d2897b15ae9aac7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Oct 28 11:53:17 2013 +0100 sw: make the uiwriter testcase a slowcheck The uiwriter test is similar to filter tests, except that the asserts are filter-independent. Those are slowchecks already, move this one there as well. This speeds up 'make sw' a bit, which is slow enough already. Change-Id: I566bf94938c3de6267705a7720bf093bfe4ef7c7 diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 7401742..020049f 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -46,7 +46,6 @@ endif $(eval $(call gb_Module_add_check_targets,sw,\ CppunitTest_sw_uwriter \ - CppunitTest_sw_uiwriter \ )) $(eval $(call gb_Module_add_slowcheck_targets,sw,\ @@ -60,6 +59,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_rtfimport \ CppunitTest_sw_odfexport \ CppunitTest_sw_odfimport \ + CppunitTest_sw_uiwriter \ )) ifneq ($(DISABLE_CVE_TESTS),TRUE) commit d1eb536c7e410d40fd94c76b157bbd4ed7944d4c Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Oct 28 11:15:43 2013 +0100 fdo#69893 fix SwWrtShell::SelAll() to work with empty table at doc start In theory, it was a problem to have the table cursor around when having the selection outside the table; but it didn't cause a problem so far. However, when the table has one or more empty cells, we really need to leave table mode, otherwise only the table gets selected. Change-Id: I766903ed624b9338f0612697b4c03f44de1d2e41 diff --git a/sw/qa/extras/uiwriter/data/fdo69893.odt b/sw/qa/extras/uiwriter/data/fdo69893.odt new file mode 100644 index 0000000..a2f7aa7 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/fdo69893.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index fa0bb14..8fd9947 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -8,6 +8,7 @@ #include <swmodeltestbase.hxx> #include <ndtxt.hxx> +#include <wrtsh.hxx> #include "UndoManager.hxx" @@ -21,10 +22,12 @@ public: //Regression test of fdo#70143 //EDITING: undo search&replace corrupt text when searching backward void testReplaceBackward(); + void testFdo69893(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); CPPUNIT_TEST(testReplaceBackward); + CPPUNIT_TEST(testFdo69893); CPPUNIT_TEST_SUITE_END(); private: @@ -97,6 +100,19 @@ void SwUiWriterTest::testReplaceBackward() CPPUNIT_ASSERT_EQUAL(ORIGINAL_REPLACE_CONTENT, pTxtNode->GetTxt()); } +void SwUiWriterTest::testFdo69893() +{ + SwDoc* pDoc = createDoc("fdo69893.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + pWrtShell->SelAll(); + + SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false); + SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode()); + // Selection did not include the para after table, this was "B1". + CPPUNIT_ASSERT_EQUAL(OUString("Para after table."), rEnd.GetTxt()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx index 8eb0d6a..972e3ef 100644 --- a/sw/source/ui/wrtsh/select.cxx +++ b/sw/source/ui/wrtsh/select.cxx @@ -162,7 +162,13 @@ long SwWrtShell::SelAll() bool bStartsWithTable = StartsWithTable(); if (bStartsWithTable) + { + // Disable table cursor to make sure getShellCrsr() returns m_pCurCrsr, not m_pTblCrsr. + if (IsTableMode()) + TblCrsrToCursor(); + // Do the extended select all on m_pCurCrsr. ExtendedSelectAll(/*bFootnotes =*/ false); + } if( pStartPos ) { commit ed2790435f74d6eaa28fcc758d2db9e1c77b5170 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Oct 28 11:45:47 2013 +0100 SwUiWriterTest: allow loading a custom bugdoc Change-Id: I5578e462c21c023d8c9a269f2ca254e20c1a617e diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f9e37f6..fa0bb14 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -28,12 +28,14 @@ public: CPPUNIT_TEST_SUITE_END(); private: - SwDoc* createEmptyDoc(); + SwDoc* createDoc(const char* pName = 0); }; -SwDoc* SwUiWriterTest::createEmptyDoc() +SwDoc* SwUiWriterTest::createDoc(const char* pName) { - load(DATA_DIRECTORY, "empty.odt"); + if (!pName) + pName = "empty.odt"; + load(DATA_DIRECTORY, pName); SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); return pTxtDoc->GetDocShell()->GetDoc(); @@ -53,7 +55,7 @@ static const OUString EXPECTED_REPLACE_CONTENT("toto toto tutu"); void SwUiWriterTest::testReplaceForward() { - SwDoc* pDoc = createEmptyDoc(); + SwDoc* pDoc = createDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); @@ -75,7 +77,7 @@ void SwUiWriterTest::testReplaceForward() void SwUiWriterTest::testReplaceBackward() { - SwDoc* pDoc = createEmptyDoc(); + SwDoc* pDoc = createDoc(); sw::UndoManager& rUndoManager = pDoc->GetUndoManager(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits