summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfimport/odfimport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-09-30 11:45:35 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-30 12:28:58 +0200
commit959711f1276106b0aaee69ab660f1b0d3ece5bbc (patch)
treea4b67c2f578e30c95057fc5d80e708507f495342 /sw/qa/extras/odfimport/odfimport.cxx
parent23f5c0466f4a614405430a90453c047a63d637d7 (diff)
fdo#69862 SwCrsrShell::ExtendedSelectAll: don't always select footnotes
ExtendedSelectAll() was originally invented to e.g. select the whole document, change the language of the selection and then inmediately (before the layout is updated) undo the selection. When using it for "select all and doc starts with a table" purposes, then footnotes shouldn't be selected, just like those are not selected either, when the doc starts with a normal paragraph. Their anchor is still selected, and that's enough to have correct delete and copy&paste. Change-Id: I4fc49db628054a4b8a46effc2d0328eaabcaa9f8
Diffstat (limited to 'sw/qa/extras/odfimport/odfimport.cxx')
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 34d4f82ab55c..f541d22cb969 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -36,6 +36,7 @@ public:
void testFdo68839();
void testFdo37606();
void testFdo37606Copy();
+ void testFdo69862();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -62,6 +63,7 @@ void Test::run()
{"fdo68839.odt", &Test::testFdo68839},
{"fdo37606.odt", &Test::testFdo37606},
{"fdo37606.odt", &Test::testFdo37606Copy},
+ {"fdo69862.odt", &Test::testFdo69862},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -426,6 +428,23 @@ void Test::testFdo37606Copy()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
}
+void Test::testFdo69862()
+{
+ // The test doc is special in that it starts with a table and it also has a footnote.
+ SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ SwWrtShell* pWrtShell = pTxtDoc->GetDocShell()->GetWrtShell();
+ SwShellCrsr* pShellCrsr = pWrtShell->getShellCrsr(false);
+
+ pWrtShell->SelAll();
+ SwTxtNode& rStart = dynamic_cast<SwTxtNode&>(pShellCrsr->Start()->nNode.GetNode());
+ // This was "Footnote.", as Ctrl-A also selected footnotes, but it should not.
+ CPPUNIT_ASSERT_EQUAL(OUString("A1"), rStart.GetTxt());
+
+ SwTxtNode& rEnd = dynamic_cast<SwTxtNode&>(pShellCrsr->End()->nNode.GetNode());
+ CPPUNIT_ASSERT_EQUAL(OUString("H" "\x01" "ello."), rEnd.GetTxt());
+
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();