Download it now!
Bug 94272 - Reduce copy'n'pasta code in Impress unit tests (sd/qa)
Summary: Reduce copy'n'pasta code in Impress unit tests (sd/qa)
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
(earliest affected) Master
Hardware: Other All
: medium normal
Assignee: Not Assigned
Whiteboard: target:5.1.0
Keywords: difficultyInteresting, easyHack, skillCpp, skillUno, topicCleanup
Depends on:
Reported: 2015-09-16 12:02 UTC by Katarina Behrens (Inactive)
Modified: 2016-10-25 19:17 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Katarina Behrens (Inactive) 2015-09-16 12:02:48 UTC
There's lot of duplicated code in sd (unit) tests, such as:

    uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
    CPPUNIT_ASSERT_MESSAGE( "not a text shape", );
    uno::Reference<container::XEnumerationAccess> paraEnumAccess;
    paraEnumAccess.set(xText, uno::UNO_QUERY);
    uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
    uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
    uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );

Such code is copy'n'pasted all over the place, whenever it is used.

It'd be useful to reduce that copy'n'pasta and make some convenience functions out of this frequently used code, such as:

getSlide(document, N ) 
getShape( slide, N)
getParagraph(shape, N)
getRun(paragraph, N) 

and so on
Comment 1 Commit Notification 2015-11-17 10:31:54 UTC
Katarina Behrens committed a patch related to this issue.
It has been pushed to "master":

tdf#94272: Reduce copy'n'pasta code in sd unit tests

It will be available in 5.1.0.

The patch should be included in the daily builds available at in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.
Comment 2 Robinson Tryon (qubit) 2015-12-15 23:33:27 UTC Comment hidden (obsolete)
Comment 3 Robinson Tryon (qubit) 2016-02-18 16:37:22 UTC Comment hidden (obsolete)