sw/qa/extras/tiledrendering/tiledrendering.cxx | 38 +++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-)
New commits: commit 39ab67b40af7d4f0af1e4fbac06b398042dbeb1b Author: Jan Holesovsky <ke...@collabora.com> Date: Tue May 30 09:44:19 2017 +0200 lambda -> function in anonymous namespace. Change-Id: Id2243d445bed35a1561c03d84cfb7162b6b90cdf Reviewed-on: https://gerrit.libreoffice.org/38181 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index f915955df2b8..a1694ab269dc 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1722,6 +1722,25 @@ void SwTiledRenderingTest::testRedoRepairResult() comphelper::LibreOfficeKit::setActive(false); } +namespace { + +void checkUndoRepairStates(SwXTextDocument* pXTextDocument, SwView* pView1, SwView* pView2) +{ + SfxItemSet aItemSet1(pXTextDocument->GetDocShell()->GetDoc()->GetAttrPool(), SID_UNDO, SID_UNDO); + SfxItemSet aItemSet2(pXTextDocument->GetDocShell()->GetDoc()->GetAttrPool(), SID_UNDO, SID_UNDO); + // first view, undo enabled + pView1->GetState(aItemSet1); + CPPUNIT_ASSERT(SfxItemState::SET == aItemSet1.GetItemState(SID_UNDO)); + CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO))); + // second view, undo conflict + pView2->GetState(aItemSet2); + CPPUNIT_ASSERT(SfxItemState::SET == aItemSet2.GetItemState(SID_UNDO)); + CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(UNDO_CONFLICT), dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))->GetValue()); +}; + +} + void SwTiledRenderingTest::testDisableUndoRepair() { comphelper::LibreOfficeKit::setActive(); @@ -1745,27 +1764,12 @@ void SwTiledRenderingTest::testDisableUndoRepair() CPPUNIT_ASSERT(SfxItemState::DISABLED == aItemSet2.GetItemState(SID_UNDO)); } - auto fnCheckStates = [pXTextDocument, pView1, pView2]() - { - SfxItemSet aItemSet1(pXTextDocument->GetDocShell()->GetDoc()->GetAttrPool(), SID_UNDO, SID_UNDO); - SfxItemSet aItemSet2(pXTextDocument->GetDocShell()->GetDoc()->GetAttrPool(), SID_UNDO, SID_UNDO); - // first view, undo enabled - pView1->GetState(aItemSet1); - CPPUNIT_ASSERT(SfxItemState::SET == aItemSet1.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO))); - // second view, undo conflict - pView2->GetState(aItemSet2); - CPPUNIT_ASSERT(SfxItemState::SET == aItemSet2.GetItemState(SID_UNDO)); - CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(UNDO_CONFLICT), dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))->GetValue()); - }; - // Insert a character in the first view. SfxLokHelper::setView(nView1); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'k', 0); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'k', 0); Scheduler::ProcessEventsToIdle(); - fnCheckStates(); + checkUndoRepairStates(pXTextDocument, pView1, pView2); // Insert a character in the second view. SfxLokHelper::setView(nView2); @@ -1791,7 +1795,7 @@ void SwTiledRenderingTest::testDisableUndoRepair() pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'l', 0); pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'l', 0); Scheduler::ProcessEventsToIdle(); - fnCheckStates(); + checkUndoRepairStates(pXTextDocument, pView1, pView2); mxComponent->dispose(); mxComponent.clear(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits