unotest,sw: introduce queryDispatchStatus()
... and reset the view options that are toggled in testHiddenParagraphFollowFrame and testHiddenParagraphFlys. Backporting these tests to the libreoffice-24-8 branch broke 2 unrelated tests because of the changed view settings: Test name: (anonymous namespace)::testHiddenSectionPageDescs::TestBody equality assertion failed - Expected: 532 - Actual : 798 - In <>, attribute 'height' of '/root/page[2]/body/section[1]/infos/bounds' incorrect value. xmltesttools.cxx:203:Assertion Test name: (anonymous namespace)::testTable0HeightRows::TestBody equality assertion failed - Expected: 28 - Actual : 22 - In <>, XPath '/root/page[1]/body/tab/row' number of nodes is incorrect Change-Id: Ie58242348fecabe163e54048f3896c6d427d2608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177691 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
parent
6091e6b0ed
commit
654e3134ad
3 changed files with 79 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <com/sun/star/lang/XComponent.hpp>
|
||||
#include <com/sun/star/frame/XDesktop2.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/uno/Any.h>
|
||||
#include <utility>
|
||||
|
||||
|
@ -92,6 +93,11 @@ public:
|
|||
const OUString& rCommand,
|
||||
const css::uno::Sequence<css::beans::PropertyValue>& rPropertyValues);
|
||||
|
||||
static css::uno::Any
|
||||
queryDispatchStatus(css::uno::Reference<css::lang::XComponent> const& xComponent,
|
||||
css::uno::Reference<css::uno::XComponentContext> const& xContext,
|
||||
OUString const& rURL);
|
||||
|
||||
/// Opens rStreamName from rTempFile, assuming it's a ZIP storage.
|
||||
static std::unique_ptr<SvStream> parseExportStream(const OUString& url,
|
||||
const OUString& rStreamName);
|
||||
|
|
|
@ -1833,6 +1833,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFollowFrame)
|
|||
{
|
||||
createSwDoc("hidden-para-follow-frame.fodt");
|
||||
|
||||
uno::Any aOldValue{ queryDispatchStatus(mxComponent, m_xContext, ".uno:ShowHiddenParagraphs") };
|
||||
|
||||
Resetter g([this, aOldValue] {
|
||||
uno::Sequence<beans::PropertyValue> argsSH(
|
||||
comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", aOldValue } }));
|
||||
dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH);
|
||||
});
|
||||
|
||||
uno::Sequence<beans::PropertyValue> argsSH(
|
||||
comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } }));
|
||||
dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH);
|
||||
|
@ -1871,6 +1879,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFlys)
|
|||
{
|
||||
createSwDoc("hidden-para-as-char-fly.fodt");
|
||||
|
||||
uno::Any aOldValue{ queryDispatchStatus(mxComponent, m_xContext, ".uno:ShowHiddenParagraphs") };
|
||||
|
||||
Resetter g([this, aOldValue] {
|
||||
uno::Sequence<beans::PropertyValue> argsSH(
|
||||
comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", aOldValue } }));
|
||||
dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH);
|
||||
});
|
||||
|
||||
uno::Sequence<beans::PropertyValue> argsSH(
|
||||
comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } }));
|
||||
dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
|
||||
#include <com/sun/star/security/CertificateValidity.hpp>
|
||||
#include <com/sun/star/security/XCertificate.hpp>
|
||||
#include <com/sun/star/util/URLTransformer.hpp>
|
||||
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
|
||||
|
||||
#include <basic/basrdll.hxx>
|
||||
|
@ -98,6 +99,62 @@ MacrosTest::dispatchCommand(const uno::Reference<lang::XComponent>& xComponent,
|
|||
return ret;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class StateGetter : public ::cppu::WeakImplHelper<frame::XStatusListener>
|
||||
{
|
||||
public:
|
||||
uno::Any& m_rOldValue;
|
||||
bool m_Received{ false };
|
||||
StateGetter(uno::Any& rOldValue)
|
||||
: m_rOldValue(rOldValue)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void SAL_CALL disposing(lang::EventObject const&) override
|
||||
{
|
||||
CPPUNIT_ASSERT(m_Received);
|
||||
}
|
||||
virtual void SAL_CALL statusChanged(frame::FeatureStateEvent const& rEvent) override
|
||||
{
|
||||
if (!m_Received)
|
||||
{
|
||||
m_rOldValue = rEvent.State;
|
||||
m_Received = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
uno::Any MacrosTest::queryDispatchStatus(uno::Reference<lang::XComponent> const& xComponent,
|
||||
uno::Reference<uno::XComponentContext> const& xContext,
|
||||
OUString const& rURL)
|
||||
{
|
||||
uno::Any ret;
|
||||
|
||||
util::URL url;
|
||||
url.Complete = rURL;
|
||||
{
|
||||
uno::Reference<css::util::XURLTransformer> const xParser(
|
||||
css::util::URLTransformer::create(xContext));
|
||||
CPPUNIT_ASSERT(xParser.is());
|
||||
xParser->parseStrict(url);
|
||||
}
|
||||
|
||||
uno::Reference<frame::XController> const xController
|
||||
= uno::Reference<frame::XModel>(xComponent, uno::UNO_QUERY_THROW)->getCurrentController();
|
||||
uno::Reference<frame::XDispatchProvider> const xFrame(xController->getFrame(), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT(xFrame.is());
|
||||
uno::Reference<frame::XDispatch> const xDisp(xFrame->queryDispatch(url, "", 0));
|
||||
CPPUNIT_ASSERT(xDisp.is());
|
||||
|
||||
uno::Reference<frame::XStatusListener> const xListener{ new StateGetter(ret) };
|
||||
xDisp->addStatusListener(xListener, url);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<SvStream> MacrosTest::parseExportStream(const OUString& url,
|
||||
const OUString& rStreamName)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue