diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2024-03-03 17:19:49 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2024-03-04 14:30:21 +0100 |
commit | 199523b553957936dc31b8c3556ef2e47c6bc3a1 (patch) | |
tree | 39da22a4690075ad89ff7de4dbd7a4d6f29609f5 | |
parent | d6f80ddb3f05a3b55239866e6e4d470f6903aaae (diff) |
tdf#160003 use correct sheet in clipboard for test
..whether a page anchored object is contained in the to be copied area.
Change-Id: I816e342770332e6d751b57a38e5ebabe33feb16a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164307
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
-rw-r--r-- | sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods | bin | 0 -> 19164 bytes | |||
-rw-r--r-- | sc/qa/unit/scshapetest.cxx | 24 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods b/sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods Binary files differnew file mode 100644 index 000000000000..565eb1bf6a26 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index b5083544f114..5e4827005388 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -1207,6 +1207,30 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf154821_shape_in_group) CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aRectOrig, aRectReload, 1); } +CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160003_copy_page_anchored) +{ + // Load a document, which has a chart anchored to page on sheet2. Copy&paste to other document + // had lost the chart object. + createScDoc("ods/tdf160003_page_anchored_object.ods"); + + // copy range with chart + goToCell("$Sheet2.$A$1:$L$24"); + dispatchCommand(mxComponent, ".uno:Copy", {}); + + // close document and create new one + createScDoc(); + + // paste clipboard + goToCell("$Sheet1.$A$1"); + dispatchCommand(mxComponent, ".uno:Paste", {}); + + // Make sure the chart object exists. + ScDocument* pDoc = getScDoc(); + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + const SdrPage* pPage = pDrawLayer->GetPage(0); + CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index ed4f4ff4076c..4fac946caf1d 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1996,7 +1996,7 @@ void ScDrawLayer::CopyFromClip(ScDrawLayer* pClipModel, SCTAB nSourceTab, } else // Object is anchored to page. { - aSrcObjStart = pClipDoc->GetRange(nClipTab, pOldObject->GetCurrentBoundRect()).aStart; + aSrcObjStart = pClipDoc->GetRange(nSourceTab, pOldObject->GetCurrentBoundRect()).aStart; } if (!rSourceRange.Contains(aSrcObjStart)) continue; |