/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace
{ /// Gets one child of xShape, which one is specified by nIndex.
uno::Reference<drawing::XShape> getChildShape(const uno::Reference<drawing::XShape>& xShape,
sal_Int32 nIndex)
{
uno::Reference<container::XIndexAccess> xGroup(xShape, uno::UNO_QUERY);
CPPUNIT_ASSERT(xGroup.is());
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testTdf148665)
{ // Without the fix in place, this test would have crashed at import time
createSdImpressDoc("pptx/tdf148665.pptx");
uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0), uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xShapeGroup->getCount());
// Without the fix in place, this test would have failed with // - Expected: 2 // - Actual : 4
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup2->getCount());
uno::Reference<drawing::XShape> xShape0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
uno::Reference<drawing::XShape> xShape1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL(xShape0->getPosition().Y,
xShape1->getPosition().Y); // Confirms shapes are in same Y axis-level.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testBasicProcess)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testPyramid)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testPyramidOneChild)
{ // Load a document with a pyra algorithm in it. // Without the accompanying fix in place, this test would have crashed.
createSdImpressDoc("pptx/smartart-pyramid-1child.pptx");
uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xText(getChildShape(getChildShape(xGroup, 1), 1),
uno::UNO_QUERY); // Verify that the text of the only child is imported correctly.
CPPUNIT_ASSERT_EQUAL(u"A"_ustr, xText->getString());
}
// xShapeConn is connector between shapes 0 and 2 // it should lay between them and be rotated 0 -> 2
CPPUNIT_ASSERT(xShape0->getPosition().X < xShapeConn->getPosition().X);
CPPUNIT_ASSERT(xShape0->getPosition().Y < xShapeConn->getPosition().Y);
CPPUNIT_ASSERT(xShapeConn->getPosition().Y < xShape2->getPosition().Y);
uno::Reference<beans::XPropertySet> xPropSetConn(xShapeConn, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL(sal_Int32(32400),
xPropSetConn->getPropertyValue(u"RotateAngle"_ustr).get<sal_Int32>());
// Make sure that we have an arrow shape between the two shapes
comphelper::SequenceAsHashMap aCustomShapeGeometry(
xPropSetConn->getPropertyValue(u"CustomShapeGeometry"_ustr));
CPPUNIT_ASSERT(aCustomShapeGeometry[u"Type"_ustr].has<OUString>());
OUString aType = aCustomShapeGeometry[u"Type"_ustr].get<OUString>();
CPPUNIT_ASSERT_EQUAL(u"ooxml-rightArrow"_ustr, aType);
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testHierarchy)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testmatrix)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testvenndiagram)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testInvertedPyramid)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testMultidirectional)
{ // similar document as cycle, but arrows are pointing in both directions
createSdImpressDoc("pptx/smartart-multidirectional.pptx");
uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xGroup.is());
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testHorizontalBulletList)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testEquation)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testBasicRadicals)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testSegmentedCycle)
{ //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet.
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testVerticalBoxList)
{
createSdImpressDoc("pptx/smartart-vertical-box-list.pptx");
uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0), uno::UNO_QUERY_THROW); // Without the accompanying fix in place, this test would have failed with // 'actual: 0'.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xShapeGroup->getCount());
uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstChild.is());
uno::Reference<drawing::XShape> xParentText(xFirstChild->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xParentText.is()); // Without the accompanying fix in place, this test would have failed with // 'actual: 7361', i.e. the width was not the 70% of the parent as the // constraint wanted.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(11852), xParentText->getSize().Width);
uno::Reference<drawing::XShape> xChildText(xShapeGroup->getByIndex(2), uno::UNO_QUERY);
CPPUNIT_ASSERT(xChildText.is()); // Without the accompanying fix in place, this test would have failed with // 'actual: 7361' (and with the fix: 'actual: 16932', i.e. the width of the // parent).
CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(10000), xChildText->getSize().Width);
// Assert that the right edge of the parent text is closer to the slide // boundary than the right edge of the parent text. // Without the accompanying fix in place, this test would have failed with // 'Expected greater than: 25656, Actual : 21165'.
CPPUNIT_ASSERT_GREATER(xParentText->getPosition().X + xParentText->getSize().Width,
xChildText->getPosition().X + xChildText->getSize().Width);
}
uno::Reference<drawing::XShapes> xFirstChild(xShapeGroup->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstChild.is()); // Without the accompanying fix in place, this test would have failed with // 'actual: 2', i.e. one child shape (with its "A" text) was missing.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xFirstChild->getCount());
}
// Without the accompanying fix in place, this test would have failed with // 'Expected less than: 100, Actual : 22014', i.e. the second child was // shifted to the right too much.
CPPUNIT_ASSERT_LESS(100, abs(nChild2Right - nParentRight));
}
// The pair is a parent (shape + text) and a child, so 3 shapes in total. // The order is important, first is at the back, last is at the front.
uno::Reference<drawing::XShapes> xFirstPair(xGroup->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstPair.is());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xFirstPair->getCount());
{
uno::Reference<container::XEnumerationAccess> xParasAccess(xFirstChildText, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParas = xParasAccess->createEnumeration();
uno::Reference<beans::XPropertySet> xPara(xParas->nextElement(), uno::UNO_QUERY); // Without the accompanying fix in place, this test would have failed // with 'Expected: 0; Actual : 1270', i.e. there was a large // unexpected left margin.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
xPara->getPropertyValue(u"ParaLeftMargin"_ustr).get<sal_Int32>());
int nFirstChildTop = xFirstChild->getPosition().Y; int nFirstChildRight = xFirstChild->getPosition().X + xFirstChild->getSize().Width;
// First child is below the first parent. // Without the accompanying fix in place, this test would have failed with // 'Expected less than: 3881, Actual : 3881', i.e. xFirstChild was not // below xFirstParent (a good position is 9081).
CPPUNIT_ASSERT_LESS(nFirstChildTop, nFirstParentTop);
// Make sure that we have an arrow shape between the two pairs.
uno::Reference<beans::XPropertySet> xArrow(xGroup->getByIndex(2), uno::UNO_QUERY);
CPPUNIT_ASSERT(xArrow.is());
comphelper::SequenceAsHashMap aCustomShapeGeometry(
xArrow->getPropertyValue(u"CustomShapeGeometry"_ustr)); // Without the accompanying fix in place, this test would have failed, i.e. // the custom shape lacked a type -> arrow was not visible.
CPPUNIT_ASSERT(aCustomShapeGeometry[u"Type"_ustr].has<OUString>());
OUString aType = aCustomShapeGeometry[u"Type"_ustr].get<OUString>();
CPPUNIT_ASSERT_EQUAL(u"ooxml-rightArrow"_ustr, aType);
// Make sure that height of the arrow is less than its width.
uno::Reference<drawing::XShape> xArrowShape(xArrow, uno::UNO_QUERY);
CPPUNIT_ASSERT(xArrowShape.is());
awt::Size aArrowSize = xArrowShape->getSize();
CPPUNIT_ASSERT_LESS(aArrowSize.Width, aArrowSize.Height);
uno::Reference<drawing::XShapes> xSecondPair(xGroup->getByIndex(3), uno::UNO_QUERY);
CPPUNIT_ASSERT(xSecondPair.is());
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xSecondPair->getCount());
uno::Reference<text::XText> xSecondParentText(xSecondPair->getByIndex(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstParentText.is()); // Without the accompanying fix in place, this test would have failed with // 'Expected: cc; Actual : c', i.e. non-first runs on data points were ignored.
CPPUNIT_ASSERT_EQUAL(u"cc"_ustr, xSecondParentText->getString());
uno::Reference<drawing::XShape> xSecondParent(xSecondParentText, uno::UNO_QUERY);
CPPUNIT_ASSERT(xSecondParent.is()); int nSecondParentLeft = xSecondParent->getPosition().X; // Without the accompanying fix in place, this test would have failed with // 'Expected less than: 12700; Actual : 18540', i.e. the "b" and "c" // shapes overlapped.
CPPUNIT_ASSERT_LESS(nSecondParentLeft, nFirstChildRight);
}
uno::Reference<drawing::XShapes> xLinear(xGroup->getByIndex(2), uno::UNO_QUERY);
CPPUNIT_ASSERT(xLinear.is()); // 3 children: A, B and C.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xLinear->getCount());
uno::Reference<text::XText> xA(xLinear->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xA.is());
CPPUNIT_ASSERT_EQUAL(u"A"_ustr, xA->getString());
uno::Reference<drawing::XShape> xAShape(xA, uno::UNO_QUERY);
CPPUNIT_ASSERT(xAShape.is()); // Without the accompanying fix in place, this test would have failed: the // theoretically correct value is 5462 mm100 (16933 is the total width, and // need to divide that to 1, 0.5, 1, 0.5 and 1 units), while the old value // was 4703 and the new one is 5461.
CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(5000), xAShape->getSize().Width);
}
CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testOrgChart)
{ // Simple org chart with 1 manager and 1 employee only.
createSdImpressDoc("pptx/smartart-org-chart.pptx");
uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xGroup.is());
uno::Reference<text::XText> xManager(
getChildShape(getChildShape(getChildShape(xGroup, 1), 0), 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xManager.is()); // Without the accompanying fix in place, this test would have failed: this // was just "Manager", and the second paragraph was lost.
CPPUNIT_ASSERT_EQUAL(u"Manager\nSecond para"_ustr, xManager->getString());
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xManager, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xPara, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
Color nActualColor;
xRun->getPropertyValue(u"CharColor"_ustr) >>= nActualColor; // Without the accompanying fix in place, this test would have failed: the // "Manager" font color was black, not white.
CPPUNIT_ASSERT_EQUAL(COL_WHITE, nActualColor);
// Without the accompanying fix in place, this test would have failed: the // two shapes were overlapping, i.e. "manager" was not above "employee".
CPPUNIT_ASSERT_GREATER(aManagerPos.Y, aEmployeePos.Y);
// Make sure that the second employee is on the right of the first one. // Without the accompanying fix in place, this test would have failed, as // the second employee was below the first one.
uno::Reference<text::XText> xEmployee2(
getChildShape(
getChildShape(getChildShape(getChildShape(getChildShape(xGroup, 1), 2), 3), 0), 0),
uno::UNO_QUERY);
CPPUNIT_ASSERT(xEmployee2.is());
CPPUNIT_ASSERT_EQUAL(u"Employee2"_ustr, xEmployee2->getString());
awt::Point aAssistantPos = xAssistantShape->getPosition(); // Without the accompanying fix in place, this test would have failed: the // assistant shape was below the employee shape.
CPPUNIT_ASSERT_GREATER(aAssistantPos.Y, aEmployeePos.Y);
// Make sure the connector of the assistant is above the shape.
uno::Reference<drawing::XShape> xAssistantConnector
= getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 0);
CPPUNIT_ASSERT(xAssistantConnector.is()); //awt::Point aAssistantConnectorPos = xAssistantConnector->getPosition(); // This failed, the vertical positions of the connector and the shape of // the assistant were the same. //CPPUNIT_ASSERT_LESS(aAssistantPos.Y, aAssistantConnectorPos.Y); // connectors are hidden as they don't work correctly
// Make sure the height of xManager and xManager2 is the same.
uno::Reference<text::XText> xManager2(
getChildShape(getChildShape(getChildShape(xGroup, 2), 0), 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xManager2.is());
CPPUNIT_ASSERT_EQUAL(u"Manager2"_ustr, xManager2->getString());
awt::Size aManager2Size = xManager2Shape->getSize(); // Without the accompanying fix in place, this test would have failed: // xManager2's height was 3 times larger than xManager's height.
CPPUNIT_ASSERT_EQUAL(aManagerSize.Height, aManager2Size.Height);
// Make sure the employee nodes use the free space on the right, since // manager2 has no assistants / employees. //CPPUNIT_ASSERT_GREATER(aManagerSize.Width, aEmployeeSize.Width + aEmployee2Size.Width); // currently disabled as causes problems in complex charts
// Without the accompanying fix in place, this test would have failed: an // employee was exactly the third of the total height, without any spacing.
CPPUNIT_ASSERT_LESS(xGroup->getSize().Height / 3, aEmployeeSize.Height);
}
// Without the accompanying fix in place, this test would have failed: the height was 12162, // which is not the mm100 equivalent of the 4064000 EMU in the input file.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(11288), xGroup->getSize().Height);
// Test fill color of B1, should be orange.
uno::Reference<text::XText> xB1(getChildShape(getChildShape(xGroup, 2), 1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xB1.is());
CPPUNIT_ASSERT_EQUAL(u"B1"_ustr, xB1->getString());
uno::Reference<beans::XPropertySet> xB1Props(xB1, uno::UNO_QUERY);
CPPUNIT_ASSERT(xB1Props.is());
Color nFillColor;
xB1Props->getPropertyValue(u"FillColor"_ustr) >>= nFillColor; // Without the accompanying fix in place, this test would have failed: the background color was // 0x4f81bd, i.e. blue, not orange.
CPPUNIT_ASSERT_EQUAL(Color(0xf79646), nFillColor);
// Without the accompanying fix in place, this test would have failed: the // content of the "A2" shape was lost.
uno::Reference<text::XText> xA2(getChildShape(getChildShape(getChildShape(xGroup, 1), 0), 1),
uno::UNO_QUERY);
CPPUNIT_ASSERT(xA2.is());
CPPUNIT_ASSERT_EQUAL(u"A2"_ustr, xA2->getString());
// Test that the layout of shapes is like this: // A2 B2 // D2 C2
// Test line color of B2, should be orange.
uno::Reference<beans::XPropertySet> xB2Props(xB2, uno::UNO_QUERY);
CPPUNIT_ASSERT(xB2Props.is());
Color nLineColor = 0;
xB2Props->getPropertyValue(u"LineColor"_ustr) >>= nLineColor;
CPPUNIT_ASSERT_EQUAL(Color(0xf79646), nLineColor);
uno::Reference<text::XText> xC2(getChildShape(getChildShape(getChildShape(xGroup, 1), 2), 1),
uno::UNO_QUERY);
CPPUNIT_ASSERT(xC2.is()); // Without the accompanying fix in place, this test would have failed, i.e. the order of the // lines in the shape were wrong: C2-1\nC2-4\nC2-3\nC2-2.
CPPUNIT_ASSERT_EQUAL(u"C2-1\nC2-2\nC2-3\nC2-4"_ustr, xC2->getString());
uno::Reference<drawing::XShape> xC2Shape(xC2, uno::UNO_QUERY);
CPPUNIT_ASSERT(xC2Shape.is());
// Without the accompanying fix in place, this test would have failed, i.e. // the A2 and B2 shapes had the same horizontal position, while B2 should // be on the right of A2.
CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().X, xB2Shape->getPosition().X);
CPPUNIT_ASSERT_EQUAL(xA2Shape->getPosition().Y, xB2Shape->getPosition().Y);
CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().X, xC2Shape->getPosition().X);
CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().Y, xC2Shape->getPosition().Y);
CPPUNIT_ASSERT_EQUAL(xA2Shape->getPosition().X, xD2Shape->getPosition().X);
CPPUNIT_ASSERT_GREATER(xA2Shape->getPosition().Y, xD2Shape->getPosition().Y);
// Without the accompanying fix in place, this test would have failed: width was expected to be // 4887, was actually 7331.
uno::Reference<drawing::XShape> xA1Shape(xA1, uno::UNO_QUERY);
CPPUNIT_ASSERT(xA1Shape.is());
CPPUNIT_ASSERT_EQUAL(xA1Shape->getSize().Height, xA1Shape->getSize().Width);
}
uno::Reference<beans::XPropertySet> xFirstImage(getChildShape(getChildShape(xGroup, 1), 1),
uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstImage.is());
drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
xFirstImage->getPropertyValue(u"FillStyle"_ustr) >>= eFillStyle; // Without the accompanying fix in place, this test would have failed: fill style was solid, not // bitmap.
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, eFillStyle);
xSecondImage->getPropertyValue(u"FillBitmap"_ustr) >>= xGraphic;
Graphic aSecondGraphic(xGraphic); // Without the accompanying fix in place, this test would have failed: both xFirstImage and // xSecondImage had the bitmap fill from the second shape.
CPPUNIT_ASSERT(aFirstGraphic.GetChecksum() != aSecondGraphic.GetChecksum());
// Test that the 3 images are in a single column, in 3 rows.
uno::Reference<drawing::XShape> xFirstImageShape(xFirstImage, uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstImage.is());
uno::Reference<drawing::XShape> xSecondImageShape(xSecondImage, uno::UNO_QUERY);
CPPUNIT_ASSERT(xSecondImage.is());
uno::Reference<drawing::XShape> xThirdImageShape = getChildShape(getChildShape(xGroup, 3), 1);
CPPUNIT_ASSERT(xThirdImageShape.is()); // Without the accompanying fix in place, this test would have failed: the first and the second // image were in the same row.
CPPUNIT_ASSERT_EQUAL(xFirstImageShape->getPosition().X, xSecondImageShape->getPosition().X);
CPPUNIT_ASSERT_EQUAL(xSecondImageShape->getPosition().X, xThirdImageShape->getPosition().X);
CPPUNIT_ASSERT_GREATER(xFirstImageShape->getPosition().Y, xSecondImageShape->getPosition().Y);
CPPUNIT_ASSERT_GREATER(xSecondImageShape->getPosition().Y, xThirdImageShape->getPosition().Y);
// Make sure that the title shape doesn't overlap with the diagram. // Note that real "no overlap" is asserted here, though in fact what we want is a less strict // condition: that no text part of the title shape and the diagram overlaps.
uno::Reference<drawing::XShape> xTitle(getShapeFromPage(1, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xTitle.is()); // Without the accompanying fix in place, this test would have failed with 'Expected greater // than: 2873; Actual : 2320', i.e. the title shape and the diagram overlapped.
uno::Reference<drawing::XShape> xFirstPair = getChildShape(xGroup, 1);
CPPUNIT_ASSERT_GREATER(xTitle->getPosition().Y + xTitle->getSize().Height - 1069,
xFirstPair->getPosition().Y);
// Make sure that left margin is 60% of width (if you count width in points and margin in mms).
uno::Reference<beans::XPropertySet> xFirstText(getChildShape(getChildShape(xGroup, 1), 0),
uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstText.is());
sal_Int32 nTextLeftDistance = 0;
xFirstText->getPropertyValue(u"TextLeftDistance"_ustr) >>= nTextLeftDistance;
uno::Reference<drawing::XShape> xFirstTextShape(xFirstText, uno::UNO_QUERY);
CPPUNIT_ASSERT(xFirstTextShape.is());
sal_Int32 nWidth = xFirstTextShape->getSize().Width; double fFactor = oox::drawingml::convertPointToMms(0.6); // Without the accompanying fix in place, this test would have failed with 'Expected: 3440, // Actual : 263', i.e. the left margin was too small.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(nWidth * fFactor), nTextLeftDistance);
// Make sure that aspect ratio is not ignored, i.e. width is not larger than height 3 times.
awt::Size aFirstPairSize = xFirstPair->getSize(); // Without the accompanying fix in place, this test would have failed: bad width was 16932, good // width is 12540, but let's accept 12541 as well.
CPPUNIT_ASSERT_LESSEQUAL(aFirstPairSize.Height * 3 + 1, aFirstPairSize.Width);
}
// BC shape is rotated 90*, so width and height is swapped
CPPUNIT_ASSERT_GREATER(xShapeA->getSize().Width, xShapeBC->getSize().Height);
CPPUNIT_ASSERT_LESS(xShapeA->getSize().Height, xShapeBC->getSize().Width);
CPPUNIT_ASSERT_GREATER(xShapeA->getPosition().X, xShapeBC->getPosition().X);
CPPUNIT_ASSERT_GREATER(xShapeA->getPosition().Y, xShapeBC->getPosition().Y);
uno::Reference<drawing::XShapes> xGroupB(xGroup1->getByIndex(1), uno::UNO_QUERY); // 5 connectors, B1 with children, B2 with children
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(7), xGroupB->getCount());
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.