summaryrefslogtreecommitdiff
path: root/sd/qa/unit
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-07-10 12:35:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-07-11 08:49:31 +0200
commite09f22aa2626267e01b9e759c152f3a0d70ddc68 (patch)
tree0761a9acb878c12e30d3747f56dcaab2ffdc2af3 /sd/qa/unit
parent4450137924eb8626a57283e1ab4f4ad62dd2d595 (diff)
editengine-columns: tdf#143258 Fix handling rotated text
This reverts modifications to existing unit tests made in commit d0a1616ccad0dd5f5a02c1b0204f537b57d0b4b5. My idea that those changes were required because of more correct calculations was wrong, and in fact they were caused by off-by-1 error in height calculations. Change-Id: Ib94878a911238c977c35a8f8e3e5694cedc79a89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118705 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r--sd/qa/unit/data/odg/tb-rl-textbox.odgbin0 -> 10002 bytes
-rw-r--r--sd/qa/unit/data/xml/n593612_0.xml4
-rw-r--r--sd/qa/unit/data/xml/n758621_1.xml4
-rw-r--r--sd/qa/unit/layout-tests.cxx67
-rw-r--r--sd/qa/unit/tiledrendering/LOKitSearchTest.cxx4
5 files changed, 71 insertions, 8 deletions
diff --git a/sd/qa/unit/data/odg/tb-rl-textbox.odg b/sd/qa/unit/data/odg/tb-rl-textbox.odg
new file mode 100644
index 000000000000..95dda6208de9
--- /dev/null
+++ b/sd/qa/unit/data/odg/tb-rl-textbox.odg
Binary files differ
diff --git a/sd/qa/unit/data/xml/n593612_0.xml b/sd/qa/unit/data/xml/n593612_0.xml
index 51fb75eba050..7c93f494e3ca 100644
--- a/sd/qa/unit/data/xml/n593612_0.xml
+++ b/sd/qa/unit/data/xml/n593612_0.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
- <XShape positionX="11429" positionY="1324" sizeX="2259" sizeY="15210" type="com.sun.star.drawing.CustomShape" name="Rectangle 52" text="&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;" fontHeight="24.000000" fontColor="ffffffff" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="254" textRightDistance="254" textUpperDistance="127" textLowerDistance="127" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="3c8c93" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="11429" positionY="1324" sizeX="2259" sizeY="15209" type="com.sun.star.drawing.CustomShape" name="Rectangle 52" text="&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;" fontHeight="24.000000" fontColor="ffffffff" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="254" textRightDistance="254" textUpperDistance="127" textLowerDistance="127" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="SOLID" fillColor="3c8c93" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="3465a4" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
@@ -10,7 +10,7 @@
<LineEnd/>
<Transformation>
<Line1 column1="2260.000000" column2="0.000000" column3="11429.000000"/>
- <Line2 column1="0.000000" column2="15211.000000" column3="1324.000000"/>
+ <Line2 column1="0.000000" column2="15210.000000" column3="1324.000000"/>
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
</Transformation>
<CustomShapeGeometry>
diff --git a/sd/qa/unit/data/xml/n758621_1.xml b/sd/qa/unit/data/xml/n758621_1.xml
index 92de100a09f1..556c18673065 100644
--- a/sd/qa/unit/data/xml/n758621_1.xml
+++ b/sd/qa/unit/data/xml/n758621_1.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
- <XShape positionX="1485" positionY="609" sizeX="18411" sizeY="1955" type="com.sun.star.presentation.TitleTextShape" fontHeight="40.000000" fontColor="ff0000" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="1645" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
+ <XShape positionX="1485" positionY="610" sizeX="18411" sizeY="1954" type="com.sun.star.presentation.TitleTextShape" fontHeight="40.000000" fontColor="ff0000" textAutoGrowHeight="true" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="LEFT" textVerticalAdjust="CENTER" textLeftDistance="250" textRightDistance="250" textUpperDistance="130" textLowerDistance="130" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="1645" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" fillStyle="NONE" fillColor="ffffff" fillTransparence="0" fillTransparenceGradientName="">
<FillTransparenceGradient style="LINEAR" startColor="000000" endColor="000000" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillGradient style="LINEAR" startColor="000000" endColor="ffffff" angle="0" border="0" xOffset="50" yOffset="50" startIntensity="100" endIntensity="100" stepCount="0"/>
<FillHatch style="SINGLE" color="3465a4" distance="20" angle="0"/>
@@ -10,7 +10,7 @@
<LineEnd/>
<Transformation>
<Line1 column1="18412.000000" column2="0.000000" column3="1485.000000"/>
- <Line2 column1="0.000000" column2="1956.000000" column3="609.000000"/>
+ <Line2 column1="0.000000" column2="1955.000000" column3="610.000000"/>
<Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
</Transformation>
</XShape>
diff --git a/sd/qa/unit/layout-tests.cxx b/sd/qa/unit/layout-tests.cxx
index 8a2853693505..e4dfe0e3d47c 100644
--- a/sd/qa/unit/layout-tests.cxx
+++ b/sd/qa/unit/layout-tests.cxx
@@ -15,6 +15,7 @@ public:
void testTdf136949();
void testTdf128212();
void testColumnsLayout();
+ void tdf143258_testTbRlLayout();
CPPUNIT_TEST_SUITE(SdLayoutTest);
@@ -22,6 +23,7 @@ public:
CPPUNIT_TEST(testTdf136949);
CPPUNIT_TEST(testTdf128212);
CPPUNIT_TEST(testColumnsLayout);
+ CPPUNIT_TEST(tdf143258_testTbRlLayout);
CPPUNIT_TEST_SUITE_END();
};
@@ -79,10 +81,10 @@ void SdLayoutTest::testTdf128212()
CPPUNIT_ASSERT(pXmlDoc);
// Without the fix in place, this test would have failed with
- // - Expected: 7798
+ // - Expected: 7797
// - Actual : 12068
assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray", "x", "4525");
- assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray", "y", "7798");
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray", "y", "7797");
xDocShRef->DoClose();
}
@@ -188,6 +190,67 @@ void SdLayoutTest::testColumnsLayout()
xDocShRef->DoClose();
}
+void SdLayoutTest::tdf143258_testTbRlLayout()
+{
+ // This tests a 1-column and a 2-column text boxes' layout
+
+ const OUString sText[] = {
+ "tb-rl text within a small text box", // Box 1
+ "tb-rl text within a small 2-column text box", // Box 2
+ };
+
+ // sentence#, index, length, x, y
+ const std::tuple<int, int, int, int, int> strings[] = {
+ // Box 1
+ { 0, 0, 11, 5346, 3250 },
+ { 0, 11, 9, 4635, 3250 },
+ { 0, 20, 6, 3924, 3250 },
+ { 0, 26, 8, 3213, 3250 },
+ // Box 2 column 1
+ { 1, 0, 6, 5346, 7250 },
+ { 1, 6, 5, 4635, 7250 },
+ { 1, 11, 9, 3924, 7250 },
+ { 1, 20, 6, 3213, 7250 },
+ // Box 2 column 2
+ { 1, 26, 2, 5346, 9600 },
+ { 1, 28, 7, 4635, 9600 },
+ { 1, 35, 5, 3924, 9600 },
+ { 1, 40, 3, 3213, 9600 },
+ };
+
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odg/tb-rl-textbox.odg"), ODG);
+
+ std::shared_ptr<GDIMetaFile> xMetaFile = xDocShRef->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+
+ xmlDocUniquePtr pXmlDoc = XmlTestTools::dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/font", SAL_N_ELEMENTS(strings));
+ assertXPath(pXmlDoc, "/metafile/push[1]/push[1]/textarray", SAL_N_ELEMENTS(strings));
+ for (size_t i = 0; i < SAL_N_ELEMENTS(strings); ++i)
+ {
+ const auto & [ sentence, index, length, x, y ] = strings[i];
+ OString sXPath = "/metafile/push[1]/push[1]/font[" + OString::number(i + 1) + "]";
+ assertXPath(pXmlDoc, sXPath, "orientation", "-900");
+ assertXPath(pXmlDoc, sXPath, "vertical", "true");
+ sXPath = "/metafile/push[1]/push[1]/textarray[" + OString::number(i + 1) + "]";
+ assertXPathContent(pXmlDoc, sXPath + "/text", sText[sentence]);
+ assertXPath(pXmlDoc, sXPath, "index", OUString::number(index));
+ assertXPath(pXmlDoc, sXPath, "length", OUString::number(length));
+
+ // Without the fix in place, this would have failed with
+ // - Expected: 5346
+ // - Actual : 503924
+ // - In <>, attribute 'x' of '/metafile/push[1]/push[1]/textarray[1]' incorrect value.
+ assertXPath(pXmlDoc, sXPath, "x", OUString::number(x));
+ assertXPath(pXmlDoc, sXPath, "y", OUString::number(y));
+ }
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdLayoutTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 7232d59cc29d..762faaac1b56 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -664,7 +664,7 @@ void LOKitSearchTest::testSearchIn2MixedObjects()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
- CPPUNIT_ASSERT_EQUAL(OString("3546, 3173, 738, 401"),
+ CPPUNIT_ASSERT_EQUAL(OString("3546, 3174, 738, 402"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
// Search next
@@ -690,7 +690,7 @@ void LOKitSearchTest::testSearchIn2MixedObjects()
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
- CPPUNIT_ASSERT_EQUAL(OString("3546, 3173, 738, 401"),
+ CPPUNIT_ASSERT_EQUAL(OString("3546, 3174, 738, 402"),
mpCallbackRecorder->m_aSearchResultSelection[0]);
}