diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-05 08:47:18 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-05 07:47:33 +0000 |
commit | 138b2890927c5c856419ac1592f168ca6a072893 (patch) | |
tree | 362fd162f500ceeac1110b16140cbf09eb5e9ac2 /sw/qa | |
parent | 940b21a87cffffca0985c33e9ebb78ddf3aa0c3b (diff) |
Related: tdf#84695 sw: fix TextBox begin text edit by pressing normal char
When a draw shape is selected, but its text is provided by a TextBox,
then F2 and Enter could start editing already, but pressing a normal
character didn't work (unlike for TextFrames or regular draw shapes).
Fix this by calling into lcl_goIntoTextBox() at one more place.
Change-Id: Ia594279918a6c3087cac8b0c859ce7432e4a685d
Reviewed-on: https://gerrit.libreoffice.org/24671
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index beed66ebbf86..57d53fc8f4d0 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -198,6 +198,7 @@ public: void testTdf98987(); void testTdf99004(); void testTdf84695(); + void testTdf84695NormalChar(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -298,6 +299,7 @@ public: CPPUNIT_TEST(testTdf98987); CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); + CPPUNIT_TEST(testTdf84695NormalChar); CPPUNIT_TEST_SUITE_END(); private: @@ -3680,6 +3682,28 @@ void SwUiWriterTest::testTdf84695() CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString()); } +void SwUiWriterTest::testTdf84695NormalChar() +{ + SwDoc* pDoc = createDoc("tdf84695.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(1); + SwContact* pTextBox = static_cast<SwContact*>(pObject->GetUserCall()); + // First, make sure that pTextBox is a fly frame (textbox of a shape). + CPPUNIT_ASSERT_EQUAL(RES_FLYFRMFMT, static_cast<RES_FMT>(pTextBox->GetFormat()->Which())); + + // Then select it. + pWrtShell->SelectObj(Point(), 0, pObject); + + // Now pressing 'a' should add a character. + SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'a', 0); + + uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY); + // This was empty, pressing a normal character did not start the fly frame edit mode. + CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); |