summaryrefslogtreecommitdiff
path: root/sd/qa/unit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-25 17:27:03 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-25 19:43:29 +0200
commitacc9aead3cc5162379d34a455aa15f7b13907cf1 (patch)
tree31af1b8012bef98c4c1f5c2889eeb29ee3720564 /sd/qa/unit
parent6965bb07bb33429a7663a3f3ebe58ed89c4327d9 (diff)
oox smartart: snake algo: consider child's aspect ratio request for cols/rows
If the child's aspect ratio request will shrink the width, then take that into account when calculating how many rows / cols we need. This reduces the number of columns for the bugdoc from 4 to 3, which is needed, but not enough to render it correctly. Change-Id: I1d02df4834b8a2ce97d5e006db0e3135d3d42917 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103411 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd/qa/unit')
-rw-r--r--sd/qa/unit/data/pptx/smartart-snake-rows.pptxbin0 -> 52877 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx26
2 files changed, 26 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-snake-rows.pptx b/sd/qa/unit/data/pptx/smartart-snake-rows.pptx
new file mode 100644
index 000000000000..7f5e82df3eaf
--- /dev/null
+++ b/sd/qa/unit/data/pptx/smartart-snake-rows.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 616f18f0b5f0..72d8811571fb 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -112,6 +112,7 @@ public:
void testTdf134221();
void testLinearRule();
void testAutofitSync();
+ void testSnakeRows();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -161,6 +162,7 @@ public:
CPPUNIT_TEST(testTdf134221);
CPPUNIT_TEST(testLinearRule);
CPPUNIT_TEST(testAutofitSync);
+ CPPUNIT_TEST(testSnakeRows);
CPPUNIT_TEST_SUITE_END();
};
@@ -1605,6 +1607,30 @@ void SdImportTestSmartArt::testAutofitSync()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testSnakeRows()
+{
+ // Load a smartart which contains a snake algorithm.
+ // The expected layout of the 6 children is a 3x2 grid.
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-snake-rows.pptx"), PPTX);
+
+ uno::Reference<drawing::XShapes> xDiagram(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ std::set<sal_Int32> aYPositions;
+ for (sal_Int32 nChild = 0; nChild < xDiagram->getCount(); ++nChild)
+ {
+ uno::Reference<drawing::XShape> xChild(xDiagram->getByIndex(nChild), uno::UNO_QUERY);
+ aYPositions.insert(xChild->getPosition().Y);
+ }
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 3
+ // - Actual : 4
+ // i.e. one more unwanted row appeared. This is better, but the ideal would be just 2 rows.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aYPositions.size());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();