From 5d2c189aee5057d1533165c368227c9c4c49d330 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 7 Dec 2016 18:02:07 +0100 Subject: sw: fix keyboard-based iteration on draw shapes wrt. textboxes Pressing resulted in no action, as we jumped to the textbox of the shape, which was correct to jump to the shape, so we never arrived to the next draw shape. Change-Id: I8c6458994ce985fc420999042a1d8e69b6e6712b Reviewed-on: https://gerrit.libreoffice.org/31733 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/uiwriter/data/tdf84695-tab.odt | Bin 0 -> 9833 bytes sw/qa/extras/uiwriter/uiwriter.cxx | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 sw/qa/extras/uiwriter/data/tdf84695-tab.odt (limited to 'sw/qa') diff --git a/sw/qa/extras/uiwriter/data/tdf84695-tab.odt b/sw/qa/extras/uiwriter/data/tdf84695-tab.odt new file mode 100644 index 000000000000..aa438bdf9b34 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf84695-tab.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 44dd39e410a9..13e2fa4c10a3 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -207,6 +207,7 @@ public: void testTdf99004(); void testTdf84695(); void testTdf84695NormalChar(); + void testTdf84695Tab(); void testTableStyleUndo(); void testRedlineParam(); void testRedlineViewAuthor(); @@ -320,6 +321,7 @@ public: CPPUNIT_TEST(testTdf99004); CPPUNIT_TEST(testTdf84695); CPPUNIT_TEST(testTdf84695NormalChar); + CPPUNIT_TEST(testTdf84695Tab); CPPUNIT_TEST(testTableStyleUndo); CPPUNIT_TEST(testRedlineParam); CPPUNIT_TEST(testRedlineViewAuthor); @@ -3818,6 +3820,31 @@ void SwUiWriterTest::testTdf84695NormalChar() CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString()); } +void SwUiWriterTest::testTdf84695Tab() +{ + SwDoc* pDoc = createDoc("tdf84695-tab.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(0); + SwContact* pShape = static_cast(pObject->GetUserCall()); + // First, make sure that pShape is a draw shape. + CPPUNIT_ASSERT_EQUAL(RES_DRAWFRMFMT, static_cast(pShape->GetFormat()->Which())); + + // Then select it. + pWrtShell->SelectObj(Point(), 0, pObject); + + // Now pressing 'tab' should jump to the other shape. + SwXTextDocument* pXTextDocument = dynamic_cast(mxComponent.get()); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_TAB); + + // And finally make sure the selection has changed. + const SdrMarkList& rMarkList = pWrtShell->GetDrawView()->GetMarkedObjectList(); + SwContact* pOtherShape = static_cast(rMarkList.GetMark(0)->GetMarkedSdrObj()->GetUserCall()); + // This failed, 'tab' didn't do anything -> the selected shape was the same. + CPPUNIT_ASSERT(pOtherShape != pShape); +} + void SwUiWriterTest::testTableStyleUndo() { SwDoc* pDoc = createDoc(); -- cgit