diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-19 17:56:24 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-19 17:14:17 +0000 |
commit | 6819992113947e7a6272bf750fee712c2df41905 (patch) | |
tree | c2d21091487dd39f2e913658ffc87786735acc85 /sd/qa | |
parent | 219d1f3385907f8bb375b626b0a35f8239fa1550 (diff) |
tdf#99396 SvxTableController::SetVertical: implement undo support
All the table and cell objects know how to undo this change, what was
missing is the begin/end undo calls and the broadcast of the cell
format change.
Change-Id: I3dfd203faf5c579da2937fedab5647129a8e903a
Reviewed-on: https://gerrit.libreoffice.org/24247
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/tdf99396.odp | bin | 0 -> 10956 bytes | |||
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sd/qa/unit/data/tdf99396.odp b/sd/qa/unit/data/tdf99396.odp Binary files differnew file mode 100644 index 000000000000..636260020c02 --- /dev/null +++ b/sd/qa/unit/data/tdf99396.odp diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 4747cf3ffe9e..105c071d1a8e 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -24,12 +24,16 @@ #include <FactoryIds.hxx> #include <sdmod.hxx> #include <tools/shl.hxx> +#include <svx/sdr/table/tablecontroller.hxx> +#include <sfx2/request.hxx> +#include <svx/svxids.hrc> #include <ImpressViewShellBase.hxx> #include <SlideSorterViewShell.hxx> #include <SlideSorter.hxx> #include <controller/SlideSorterController.hxx> #include <controller/SlsClipboard.hxx> #include <controller/SlsPageSelector.hxx> +#include <undo/undomanager.hxx> #include <chrono> using namespace ::com::sun::star; @@ -40,10 +44,12 @@ class SdMiscTest : public SdModelTestBase public: void testTdf96206(); void testTdf96708(); + void testTdf99396(); CPPUNIT_TEST_SUITE(SdMiscTest); CPPUNIT_TEST(testTdf96206); CPPUNIT_TEST(testTdf96708); + CPPUNIT_TEST(testTdf99396); CPPUNIT_TEST_SUITE_END(); private: @@ -135,6 +141,29 @@ void SdMiscTest::testTdf96708() xDocSh->DoClose(); } +void SdMiscTest::testTdf99396() +{ + // Load the document and select the table. + sd::DrawDocShellRef xDocSh = Load(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf99396.odp"), ODP); + sd::ViewShell *pViewShell = xDocSh->GetViewShell(); + SdPage* pPage = pViewShell->GetActualPage(); + SdrObject* pObject = pPage->GetObj(0); + SdrView* pView = pViewShell->GetView(); + pView->MarkObj(pObject, pView->GetSdrPageView()); + + // Make sure that the undo stack is empty. + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), xDocSh->GetDoc()->GetUndoManager()->GetUndoActionCount()); + + // Set the vertical alignment of the cells to bottom. + sdr::table::SvxTableController* pTableController = dynamic_cast<sdr::table::SvxTableController*>(pView->getSelectionController().get()); + SfxRequest aRequest(pViewShell->GetViewFrame(), SID_TABLE_VERT_BOTTOM); + pTableController->Execute(aRequest); + // This was 0, it wasn't possible to undo a vertical alignment change. + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), xDocSh->GetDoc()->GetUndoManager()->GetUndoActionCount()); + + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest); CPPUNIT_PLUGIN_IMPLEMENT(); |