summaryrefslogtreecommitdiff
path: root/svx/qa
diff options
context:
space:
mode:
Diffstat (limited to 'svx/qa')
-rw-r--r--svx/qa/unit/customshapes.cxx38
-rw-r--r--svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odpbin0 -> 13908 bytes
2 files changed, 38 insertions, 0 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index c2d30cef2c0b..5c4ea6914288 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -127,6 +127,44 @@ void lcl_AssertRectEqualWithTolerance(std::string_view sInfo, const tools::Recta
std::abs(rExpected.GetHeight() - rActual.GetHeight()) <= nTolerance);
}
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145111_anchor_in_Fontwork)
+{
+ // The tested positions depend on dpi.
+ if (!IsDefaultDPI())
+ return;
+
+ // tdf#145004 In case ScaleX is true in property TextPath, SDRTEXTVERTADJUST is
+ // evaluated and should shift the Fontwork text. That did not work for
+ // 'Top-Left' and 'Bottom-Left'.
+
+ // Load document
+ OUString aURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf145111_TL_BL_Fontwork.odp";
+ mxComponent = loadFromDesktop(aURL, "com.sun.star.comp.presentation.PresentationDocument");
+
+ {
+ // First shape has anchor set to Top-Left, which shifts Fontwork text down.
+ uno::Reference<drawing::XShape> xShape(getShape(0));
+ SdrObjCustomShape& rSdrCustomShape(
+ static_cast<SdrObjCustomShape&>(*SdrObject::getSdrObjectFromXShape(xShape)));
+
+ // Without the fix in place top was 2295, but should be 2916 for 96dpi.
+ // Was 2184, should be 2886 for 120dpi.
+ tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(2916), aBoundRect.Top(), 5);
+ }
+ {
+ // Second shape has anchor set to Bottom-Left, which shifts Fontwork text up.
+ uno::Reference<drawing::XShape> xShape(getShape(1));
+ SdrObjCustomShape& rSdrCustomShape(
+ static_cast<SdrObjCustomShape&>(*SdrObject::getSdrObjectFromXShape(xShape)));
+
+ // Without the fix in place top was 10294, but should be 9519 for 96dpi.
+ // Was 10184, should be 9481 for 120dpi.
+ tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(tools::Long(9519), aBoundRect.Top(), 5);
+ }
+}
+
CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145004_gap_by_ScaleX)
{
if (!IsDefaultDPI())
diff --git a/svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp b/svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp
new file mode 100644
index 000000000000..257023cfad0a
--- /dev/null
+++ b/svx/qa/unit/data/tdf145111_TL_BL_Fontwork.odp
Binary files differ