sw/qa/extras/unowriter/unowriter.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
New commits: commit 0f7f0ba5104f1c330dac66f593044304f68245b1 Author: Kira Tubo <kira.t...@gmail.com> AuthorDate: Tue Apr 23 23:42:37 2024 -0700 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Apr 25 10:20:23 2024 +0200 tdf#141525: sw unit test: line w/ arrow/circle endpoints Unit test checks that the "Line with Arrow/Circle" shape is inserted with "Arrow" at the start of the line and "Circle" at the end of the line. Without the fix from tdf#141525, the "Circle" is missing at the end of the line. Change-Id: I2c952deffea908b3daf855dabd9d19f1f6133268 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166576 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index a11e928e8c1d..0d8704752b07 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -42,6 +42,7 @@ #include <vcl/graphicfilter.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertysequence.hxx> #include <wrtsh.hxx> #include <ndtxt.hxx> @@ -1200,6 +1201,31 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841) CPPUNIT_ASSERT_EQUAL(aRefColor, aColor); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf141525) +{ + // Unit test for tdf#141525: + // Checks if "Line with Arrow/Circle" is inserted with correct end points + createSwDoc(); + + // Insert "Line with Arrow/Circle" shape with CTRL key + uno::Sequence<beans::PropertyValue> aArgs( + comphelper::InitPropertySequence({ { "KeyModifier", uno::Any(KEY_MOD1) } })); + dispatchCommand(mxComponent, ".uno:LineArrowCircle", aArgs); + + // Asserts line shape has been inserted into the doc + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.LineShape"), getShape(1)->getShapeType()); + + // Asserts end of line has a circle + // Without the test, "Line Starts with Arrow" is inserted + // i.e. the circle is missing from the line end point + // - Expected: "Circle" + // - Actual: "" + CPPUNIT_ASSERT_EQUAL(OUString("Circle"), getProperty<OUString>(getShape(1), "LineEndName")); + // Asserts start of line has an arrow + CPPUNIT_ASSERT_EQUAL(OUString("Arrow"), getProperty<OUString>(getShape(1), "LineStartName")); +} + CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf160278) { createSwDoc();