summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-11-02 22:48:35 +0100
committerTomaž Vajngerl <quikee@gmail.com>2022-11-04 15:18:39 +0100
commit14175b130ff97c5576ff872dcf3163954c6f80f8 (patch)
treeb4fee300a6917fa2d2273701013c360fa1af0b5d /sd/qa
parent21c6547302580c3fd77b85fda68bb0239b8c560a (diff)
add a test for "fit to frame" text rendering
Change-Id: If304f12e1f1fbe3afea4885975302b77b428567f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142187 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/odg/FitToFrameText.odgbin0 -> 11847 bytes
-rw-r--r--sd/qa/unit/layout-tests.cxx22
2 files changed, 22 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odg/FitToFrameText.odg b/sd/qa/unit/data/odg/FitToFrameText.odg
new file mode 100644
index 000000000000..e65b0a3a2102
--- /dev/null
+++ b/sd/qa/unit/data/odg/FitToFrameText.odg
Binary files differ
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index 2a7c0e0a200b..d2bf22622885 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -292,6 +292,28 @@ CPPUNIT_TEST_FIXTURE(SdLayoutTest, testBnc480256)
assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/push[8]/linecolor[1]", "color", "#ff0000");
}
+CPPUNIT_TEST_FIXTURE(SdLayoutTest, testFitToFrameTextFitting)
+{
+ // This test checks that the text fitting is working correctly when
+ // the textbox is set to "fit to frame" by stretching the text to or
+ // near the textbox boundary. The problem is especially complicated
+ // when the font size is set to a higher number (like 999)
+ //
+ // The text fitting behaviour when "fit by frame" is enabled is to
+ // always fit the text into the text box (without forcing the text
+ // into new line) by shrinking or expanding the text horizontally
+ // and vertically.
+
+ xmlDocUniquePtr pXmlDoc = load("odg/FitToFrameText.odg");
+
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "x", "0");
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]", "y", "406");
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "first", "114");
+#ifndef _WIN32 // Windows seems to differ in text layouting, so ignore for now
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray[1]/dxarray", "last", "7010");
+#endif
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */