/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// Get the document model
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
// Get the document model
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
/// Test that copying a column with an image anchored to it also copies the image void ScAnchorTest::testCopyColumnWithImages()
{
loadFromFile(u"3AnchorTypes.ods");
// Get the document model
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
// 2. Paste to target range
ScRange aDstRange;
aDstRange.Parse(u"D1:D11"_ustr, *pDoc, pDoc->GetAddressConvention());
pViewShell->GetViewData().GetMarkData().SetMarkArea(aDstRange);
pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, &aClipDoc);
// 3. Make sure the images have been copied too
std::map<SCROW, std::vector<SdrObject*>> aRowObjects
= pDrawLayer->GetObjectsAnchoredToRange(0, 3, 0, 11);
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be an image anchored to D3", 1, static_cast<int>(aRowObjects[2].size()));
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be an image anchored to D11", 1, static_cast<int>(aRowObjects[10].size()));
}
// 3. Make sure the image has been copied too
std::map<SCROW, std::vector<SdrObject*>> aRowObjects
= pDrawLayer->GetObjectsAnchoredToRange(0, 6, 2, 2);
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be an image anchored to G3", 1, static_cast<int>(aRowObjects[2].size()));
}
}
void ScAnchorTest::testCutWithImages()
{
loadFromFile(u"3AnchorTypes.ods"); // open the document with graphic included
// Get the document model
SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent);
CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
// Images should have been removed from the cells
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to A3", 0, static_cast<int>(aRowObjects[2].size()));
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to A11", 0, static_cast<int>(aRowObjects[10].size()));
}
// Image should have been removed from the cell
std::map<SCROW, std::vector<SdrObject*>> aRowObjects
= pDrawLayer->GetObjectsAnchoredToRange(0, 0, 2, 2);
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to A3", 0, static_cast<int>(aRowObjects[2].size()));
}
}
// Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop, where ScGridWindow::Paint() invalidated itself.
Scheduler::ProcessEventsToIdle();
}
// Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop, where ScGridWindow::Paint() invalidated itself.
Scheduler::ProcessEventsToIdle();
}
// Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop, where ScGridWindow::Paint() invalidated itself.
Scheduler::ProcessEventsToIdle();
}
// Without the accompanying fix in place, this test would have never returned due to an infinite // invalidation loop
Scheduler::ProcessEventsToIdle();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.