summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-03-31 12:36:27 +0200
committerDavid Tardon <dtardon@redhat.com>2014-03-31 13:19:15 +0200
commitc6821e66a66bd8fbb2c5a617e49783b7a4fc0724 (patch)
tree2d9733a5c4984e70314020ceca5b0b5e1db78551 /writerperfect
parent0f912872b661a6763dfd5789c0377ca453f7e260 (diff)
speed up the import tests
Change-Id: If3f0198d58b6c64a4efd4be294f1d66fb39f2302
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/qa/unit/WpftImportTestBase.cxx48
1 files changed, 27 insertions, 21 deletions
diff --git a/writerperfect/qa/unit/WpftImportTestBase.cxx b/writerperfect/qa/unit/WpftImportTestBase.cxx
index 773fa3b26451..4a05d05b8f23 100644
--- a/writerperfect/qa/unit/WpftImportTestBase.cxx
+++ b/writerperfect/qa/unit/WpftImportTestBase.cxx
@@ -80,6 +80,30 @@ bool WpftImportTestBase::load(const OUString &, const OUString &rURL, const OUSt
m_xDesktop->loadComponentFromURL(m_aFactoryURL, "_blank", 0, uno::Sequence<beans::PropertyValue>()),
uno::UNO_QUERY_THROW);
+ // Find the model and frame. We need them later.
+ uno::Reference<frame::XFrame> xFrame(xDoc, uno::UNO_QUERY);
+ uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
+ uno::Reference<frame::XController> xController(xDoc, uno::UNO_QUERY);
+
+ if (xFrame.is())
+ {
+ xController = xFrame->getController();
+ xModel = xController->getModel();
+ }
+ else if (xModel.is())
+ {
+ xController = xModel->getCurrentController();
+ xFrame = xController->getFrame();
+ }
+ else if (xController.is())
+ {
+ xFrame = xController->getFrame();
+ xModel = xController->getModel();
+ }
+
+ if (!xFrame.is() || !xModel.is())
+ throw uno::RuntimeException();
+
bool result = false;
// try to import the document (and load it into the prepared frame)
@@ -105,7 +129,9 @@ bool WpftImportTestBase::load(const OUString &, const OUString &rURL, const OUSt
impl_detectFilterName(aDescriptor, aTypeName);
+ xModel->lockControllers();
result = m_xFilter->filter(aDescriptor);
+ xModel->unlockControllers();
}
catch (const uno::Exception &)
{
@@ -113,29 +139,9 @@ bool WpftImportTestBase::load(const OUString &, const OUString &rURL, const OUSt
}
// close the opened document
- uno::Reference<util::XCloseable> xCloseable(xDoc, uno::UNO_QUERY);
-
- if (!xCloseable.is())
- {
- uno::Reference<frame::XController> xController(xDoc, uno::UNO_QUERY);
-
- if (!xController.is())
- {
- const uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
- if (xModel.is())
- xController = xModel->getCurrentController();
- }
-
- if (xController.is())
- {
- const uno::Reference<frame::XFrame> xFrame = xController->getFrame();
- if (xFrame.is())
- xCloseable.set(xFrame, uno::UNO_QUERY);
- }
- }
-
try
{
+ uno::Reference<util::XCloseable> xCloseable(xFrame, uno::UNO_QUERY);
if (xCloseable.is())
xCloseable->close(true);
else