diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2022-02-17 22:13:54 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2022-02-17 23:56:37 +0100 |
commit | 4c0b033ece143b6f398157e812ff1c6b22e2855d (patch) | |
tree | 7fbe9893be41bfa51a42c90e289c54a7b4072d25 /svx/qa | |
parent | 3fb587e89421a862a1e65f47cad17839e2b832e4 (diff) |
tdf#147409 tdf#146866 use SetPropertyValue for toggle
The toggles (Textpath,SameLetterHeights) and (Extrusion,Extrusion)
change a value by directly writing the value into the property. That
is lines (*pAny) <<= bOn;, for example. But that does not trigger
InvalidateHash() of the SdrCustomShapeGeometryItem. So the item has
still aHashState 'Valid'. On the other hand because of the change the
hash itself has changed. Therefore the == comparison between the
original item and its clone returns 'false' in customshapeitem.cxx#238.
And as a result, the assert in itempool.cxx#679 fails.
My solution replaces the direct writing with setting the value via
SetPropertyValue(), which includes the needed InvalidateHash(). The
method InvalidateHash() is private and so cannot be directly used in
fontwork.cxx and extrusionbar.cxx.
Change-Id: Ib6021defb61478de9cbefa8f26466a2fe21352a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130117
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/customshapes.cxx | 36 | ||||
-rw-r--r-- | svx/qa/unit/data/tdf147409_GeomItemHash.odg | bin | 0 -> 14274 bytes |
2 files changed, 36 insertions, 0 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index 081a6b7789e0..bcce0ad7b458 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -132,6 +132,42 @@ void lcl_AssertRectEqualWithTolerance(std::string_view sInfo, const tools::Recta std::abs(rExpected.GetHeight() - rActual.GetHeight()) <= nTolerance); } +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf147409_GeomItemHash) +{ + OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf147409_GeomItemHash.odg"; + mxComponent = loadFromDesktop(aURL, "com.sun.star.comp.drawing.DrawingDocument"); + uno::Reference<drawing::XShape> xShape(getShape(0)); + SdrObjCustomShape* pSdrCustomShape( + static_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape))); + + // Mark Object + SfxViewShell* pViewShell = SfxViewShell::Current(); + SdrView* pSdrView = pViewShell->GetDrawView(); + pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView()); + + // Apply FontworkSameLetterHeights toggle + // Without patch a debug build fails assert in SfxItemPool::PutImpl and so crashes. + dispatchCommand(mxComponent, ".uno:FontworkSameLetterHeights", {}); +} + +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf146866_GeomItemHash) +{ + OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf147409_GeomItemHash.odg"; + mxComponent = loadFromDesktop(aURL, "com.sun.star.comp.drawing.DrawingDocument"); + uno::Reference<drawing::XShape> xShape(getShape(0)); + SdrObjCustomShape* pSdrCustomShape( + static_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape))); + + // Mark Object + SfxViewShell* pViewShell = SfxViewShell::Current(); + SdrView* pSdrView = pViewShell->GetDrawView(); + pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView()); + + // Apply extrusion toggle + // Without patch a debug build fails assert in SfxItemPool::PutImpl and so crashes. + dispatchCommand(mxComponent, ".uno:ExtrusionToggle", {}); +} + CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI) { // The document contains first light soft, no ambient color, no second light and shininess 6. diff --git a/svx/qa/unit/data/tdf147409_GeomItemHash.odg b/svx/qa/unit/data/tdf147409_GeomItemHash.odg Binary files differnew file mode 100644 index 000000000000..770b7a6c0b42 --- /dev/null +++ b/svx/qa/unit/data/tdf147409_GeomItemHash.odg |