diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-25 11:15:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-25 14:38:53 +0000 |
commit | cbc84a6599c08e5c79e544212c69c6946d0cdbf0 (patch) | |
tree | 3e12052a05d30fff0e75075384048b85a32f03ae /sd/qa | |
parent | 6310fa8a70db81334b710b06377e20b4ecb378da (diff) |
tdf#105502 sd increase font size: handle table selection
In part of a table shape is selected, then only operate on the selected
cells, not on all of them.
Change-Id: I3a9ba2b99bcaa2e355b6fcdafdd142d4a809bce6
Reviewed-on: https://gerrit.libreoffice.org/33524
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/tiledrendering/data/tdf105502.odp | bin | 0 -> 11376 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 53 |
2 files changed, 53 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/data/tdf105502.odp b/sd/qa/unit/tiledrendering/data/tdf105502.odp Binary files differnew file mode 100644 index 000000000000..6fe818090c8b --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/tdf105502.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 65079fc84bf9..cbb8703b30be 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -42,6 +42,8 @@ #include <unomodel.hxx> #include <drawdoc.hxx> #include <undo/undomanager.hxx> +#include <sfx2/request.hxx> +#include <svx/svxids.hrc> using namespace css; @@ -84,6 +86,7 @@ public: void testTdf103083(); void testTdf104405(); void testTdf81754(); + void testTdf105502(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -116,6 +119,7 @@ public: CPPUNIT_TEST(testTdf103083); CPPUNIT_TEST(testTdf104405); CPPUNIT_TEST(testTdf81754); + CPPUNIT_TEST(testTdf105502); CPPUNIT_TEST_SUITE_END(); @@ -1505,6 +1509,55 @@ void SdTiledRenderingTest::testTdf81754() xDocShRef->DoClose(); } +void SdTiledRenderingTest::testTdf105502() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("tdf105502.odp"); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + sd::Window* pWindow = pViewShell->GetActiveWindow(); + CPPUNIT_ASSERT(pWindow); + SdPage* pActualPage = pViewShell->GetActualPage(); + SdrObject* pObject = pActualPage->GetObj(0); + auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pObject); + CPPUNIT_ASSERT(pTableObject); + + // Select the first row. + sd::View* pView = pViewShell->GetView(); + pView->MarkObj(pObject, pView->GetSdrPageView()); + pView->SdrBeginTextEdit(pObject); + rtl::Reference<sdr::SelectionController> xSelectionController(pView->getSelectionController()); + CPPUNIT_ASSERT(xSelectionController.is()); + SfxRequest aRequest(pViewShell->GetViewFrame(), SID_TABLE_SELECT_ROW); + xSelectionController->Execute(aRequest); + + // Assert that the A1:B1 selection succeeded. + CPPUNIT_ASSERT(xSelectionController->hasSelectedCells()); + sdr::table::CellPos aFirstCell; + sdr::table::CellPos aLastCell; + xSelectionController->getSelectedCells(aFirstCell, aLastCell); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aFirstCell.mnCol); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aFirstCell.mnRow); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aLastCell.mnCol); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aLastCell.mnRow); + + // Grow font size for the selection. + comphelper::dispatchCommand(".uno:Grow", {}); + Scheduler::ProcessEventsToIdle(); + + // Assert that the selected A1 has now a larger font than the unselected + // A2. + xmlDocPtr pXmlDoc = parseXmlDump(); + sal_Int32 nA1Height = getXPath(pXmlDoc, "//Cell[1]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/attribs[1]/SvxFontHeightItem", "height").toInt32(); + sal_Int32 nA2Height = getXPath(pXmlDoc, "//Cell[3]/SdrText/OutlinerParaObject/EditTextObject/ContentInfo/attribs[1]/SvxFontHeightItem", "height").toInt32(); + // This failed when FuText::ChangeFontSize() never did "continue" in the + // text loop, instead of doing so depending on what IsInSelection() returns. + CPPUNIT_ASSERT(nA1Height > nA2Height); + xmlFreeDoc(pXmlDoc); + + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |