[Libreoffice-commits] core.git: include/test sc/CppunitTest_sc_ddelinkobj.mk sc/qa test/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Dec 13 16:17:50 UTC 2018
include/test/util/xrefreshable.hxx | 4 +---
sc/CppunitTest_sc_ddelinkobj.mk | 1 +
sc/qa/extras/sccellfieldsobj.cxx | 4 +---
sc/qa/extras/scddelinkobj.cxx | 22 ++++++++++++++--------
test/source/sheet/xddelink.cxx | 6 +++---
test/source/util/xrefreshable.cxx | 22 +---------------------
6 files changed, 21 insertions(+), 38 deletions(-)
New commits:
commit c94ae40267ae3352e95911bcd1fb9f12f4a714a0
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Dec 13 12:02:32 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Dec 13 17:17:22 2018 +0100
Fix sc_ddelinkobj tests
Regression from commit 63ff8602c16b0c26927dc3413b12a5368fe367b0.
See thread started at
https://lists.freedesktop.org/archives/libreoffice/2018-December/081542.html
The Application::SetName is mandatory for DDE to work; otherwise
InitializeDde() in SfxApplication::SfxApplication() fails.
DDE spreadsheet formula expects full name of the target spreadsheet,
including path.
Fixed sheet name (it's "Sheet1", not "Sheet").
Removed redundant tests (former "testRemoveRefreshListener" tests all).
Change-Id: I6299a9ec03c3657a21ad42d0ff87db25cf2be905
Reviewed-on: https://gerrit.libreoffice.org/65079
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/include/test/util/xrefreshable.hxx b/include/test/util/xrefreshable.hxx
index 2ffab9946e4a..dd82303259ef 100644
--- a/include/test/util/xrefreshable.hxx
+++ b/include/test/util/xrefreshable.hxx
@@ -23,9 +23,7 @@ class OOO_DLLPUBLIC_TEST XRefreshable
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
- void testAddRefreshListener();
- void testRefresh();
- void testRemoveRefreshListener();
+ void testRefreshListener();
protected:
~XRefreshable() {}
diff --git a/sc/CppunitTest_sc_ddelinkobj.mk b/sc/CppunitTest_sc_ddelinkobj.mk
index 123e4cf3a021..c59cf6e96360 100644
--- a/sc/CppunitTest_sc_ddelinkobj.mk
+++ b/sc/CppunitTest_sc_ddelinkobj.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ddelinkobj, \
subsequenttest \
test \
unotest \
+ vcl \
))
$(eval $(call gb_CppunitTest_set_include,sc_ddelinkobj,\
diff --git a/sc/qa/extras/sccellfieldsobj.cxx b/sc/qa/extras/sccellfieldsobj.cxx
index b015b96f99b0..f1626527b063 100644
--- a/sc/qa/extras/sccellfieldsobj.cxx
+++ b/sc/qa/extras/sccellfieldsobj.cxx
@@ -56,9 +56,7 @@ public:
CPPUNIT_TEST(testCreateEnumeration);
// XRefreshable
- CPPUNIT_TEST(testAddRefreshListener);
- CPPUNIT_TEST(testRefresh);
- CPPUNIT_TEST(testRemoveRefreshListener);
+ CPPUNIT_TEST(testRefreshListener);
CPPUNIT_TEST_SUITE_END();
diff --git a/sc/qa/extras/scddelinkobj.cxx b/sc/qa/extras/scddelinkobj.cxx
index 204c5b6f8ace..0aa2e968c58e 100644
--- a/sc/qa/extras/scddelinkobj.cxx
+++ b/sc/qa/extras/scddelinkobj.cxx
@@ -12,6 +12,8 @@
#include <test/sheet/xddelink.hxx>
#include <test/util/xrefreshable.hxx>
+#include <sfx2/app.hxx>
+
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -55,9 +57,7 @@ public:
CPPUNIT_TEST(testSetNameThrowsException);
// XRefreshable
- CPPUNIT_TEST(testAddRefreshListener);
- CPPUNIT_TEST(testRefresh);
- CPPUNIT_TEST(testRemoveRefreshListener);
+ CPPUNIT_TEST(testRefreshListener);
CPPUNIT_TEST_SUITE_END();
@@ -67,7 +67,9 @@ private:
ScDDELinkObj::ScDDELinkObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
- , XNamed("soffice|ScDDELinksObj.ods!Sheet.A1")
+ , XNamed("soffice|"
+ + m_directories.getURLFromSrc("/sc/qa/unoapi/testdocuments/ScDDELinksObj.ods")
+ + "!Sheet1.A1")
{
}
@@ -79,10 +81,13 @@ uno::Reference<uno::XInterface> ScDDELinkObj::init()
uno::Reference<container::XIndexAccess> xIA(xSheets, UNO_QUERY_THROW);
uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW);
- xSheet->getCellByPosition(5, 5)->setFormula(
- "=DDE(\"soffice\";\"ScDDELinksObj.ods\";\"Sheet.A1\"");
- xSheet->getCellByPosition(1, 4)->setFormula(
- "=DDE(\"soffice\";\"ScDDELinksObj.ods\";\"Sheet.A1\"");
+ const OUString testdoc
+ = m_directories.getURLFromSrc("/sc/qa/unoapi/testdocuments/ScDDELinksObj.ods");
+
+ xSheet->getCellByPosition(5, 5)->setFormula("=DDE(\"soffice\";\"" + testdoc
+ + "\";\"Sheet1.A1\")");
+ xSheet->getCellByPosition(1, 4)->setFormula("=DDE(\"soffice\";\"" + testdoc
+ + "\";\"Sheet1.A1\")");
uno::Reference<beans::XPropertySet> xPropSet(xDoc, UNO_QUERY_THROW);
uno::Any aDDELinks = xPropSet->getPropertyValue("DDELinks");
@@ -94,6 +99,7 @@ uno::Reference<uno::XInterface> ScDDELinkObj::init()
void ScDDELinkObj::setUp()
{
+ Application::SetAppName("soffice"); // Enable DDE
CalcUnoApiTest::setUp();
// create a calc document
mxComponent = loadFromDesktop("private:factory/scalc");
diff --git a/test/source/sheet/xddelink.cxx b/test/source/sheet/xddelink.cxx
index 403449452ba5..b166275d5367 100644
--- a/test/source/sheet/xddelink.cxx
+++ b/test/source/sheet/xddelink.cxx
@@ -30,15 +30,15 @@ void XDDELink::testGetItem()
{
uno::Reference<sheet::XDDELink> xLink(init(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getItem()", OUString("Sheet.A1"),
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getItem()", OUString("Sheet1.A1"),
xLink->getItem());
}
void XDDELink::testGetTopic()
{
uno::Reference<sheet::XDDELink> xLink(init(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to execute getTopic()", OUString("ScDDELinksObj.ods"),
- xLink->getTopic());
+ CPPUNIT_ASSERT_MESSAGE("Unable to execute getTopic()",
+ xLink->getTopic().endsWith("ScDDELinksObj.ods"));
}
} // namespace apitest
diff --git a/test/source/util/xrefreshable.cxx b/test/source/util/xrefreshable.cxx
index 174115e64289..19d1dc42acb0 100644
--- a/test/source/util/xrefreshable.cxx
+++ b/test/source/util/xrefreshable.cxx
@@ -41,27 +41,7 @@ public:
virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {}
};
-void XRefreshable::testAddRefreshListener()
-{
- uno::Reference<util::XRefreshable> xRefreshable(init(), uno::UNO_QUERY_THROW);
-
- rtl::Reference<MockedRefreshListener> xListener = new MockedRefreshListener();
- xRefreshable->addRefreshListener(uno::Reference<util::XRefreshListener>(xListener.get()));
-}
-
-void XRefreshable::testRefresh()
-{
- uno::Reference<util::XRefreshable> xRefreshable(init(), uno::UNO_QUERY_THROW);
-
- rtl::Reference<MockedRefreshListener> xListener = new MockedRefreshListener();
- xRefreshable->addRefreshListener(uno::Reference<util::XRefreshListener>(xListener.get()));
-
- xRefreshable->refresh();
-
- CPPUNIT_ASSERT(xListener->m_bListenerCalled);
-}
-
-void XRefreshable::testRemoveRefreshListener()
+void XRefreshable::testRefreshListener()
{
uno::Reference<util::XRefreshable> xRefreshable(init(), uno::UNO_QUERY_THROW);
More information about the Libreoffice-commits
mailing list