Kaydet (Commit) 28ddaf52 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#98168 sw: add mail merge from xlsx testcase

Commit 83b43ef2 (sw mail merge: add
support for the new 'writer' connectivity driver, 2017-07-18) fixed
this, with:

> If we are at it, also accept xlsx next to xls.

But there was no test for that part.

Change-Id: Iffbd4d21e52700d38dc0a83cb5540fa10c062944
Reviewed-on: https://gerrit.libreoffice.org/46818Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst ae710205
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CppunitTest_CppunitTest,sw_uibase_unit))
$(eval $(call gb_CppunitTest_use_external,sw_uibase_unit,boost_headers))
$(eval $(call gb_CppunitTest_use_sdk_api,sw_uibase_unit))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_uibase_unit, \
sw/qa/unit/uibase \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_uibase_unit, \
sal \
sw \
tl \
))
$(eval $(call gb_CppunitTest_set_include,sw_uibase_unit,\
-I$(SRCDIR)/sw/inc \
$$(INCLUDE) \
))
# vim: set noet sw=4 ts=4:
...@@ -48,6 +48,10 @@ $(eval $(call gb_Module_add_targets,sw,\ ...@@ -48,6 +48,10 @@ $(eval $(call gb_Module_add_targets,sw,\
endif endif
$(eval $(call gb_Module_add_check_targets,sw,\
CppunitTest_sw_uibase_unit \
))
$(eval $(call gb_Module_add_slowcheck_targets,sw,\ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \ $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
CppunitTest_sw_uwriter) \ CppunitTest_sw_uwriter) \
......
...@@ -473,6 +473,23 @@ public: ...@@ -473,6 +473,23 @@ public:
void RevokeNotUsedConnections(); void RevokeNotUsedConnections();
}; };
namespace sw
{
enum class DBConnURIType
{
UNKNOWN = 0,
ODB,
CALC,
DBASE,
FLAT,
MSJET,
MSACE,
WRITER
};
DBConnURIType SW_DLLPUBLIC GetDBunoType(const INetURLObject &rURL);
}
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <tools/urlobj.hxx>
#include <dbmgr.hxx>
namespace
{
/// Test suite for unit tests covering uibase code.
class Test : public CppUnit::TestFixture
{
public:
void testTdf98168();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testTdf98168);
CPPUNIT_TEST_SUITE_END();
};
void Test::testTdf98168()
{
INetURLObject aURL("file:///tmp/test.xlsx");
// This was sw::DBConnURIType::UNKNOWN, xlsx was not recognized.
CPPUNIT_ASSERT_EQUAL(sw::DBConnURIType::CALC, sw::GetDBunoType(aURL));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
#include <officecfg/Office/Common.hxx> #include <officecfg/Office/Common.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace sw;
#define DB_SEP_SPACE 0 #define DB_SEP_SPACE 0
#define DB_SEP_TAB 1 #define DB_SEP_TAB 1
...@@ -2555,18 +2556,8 @@ uno::Sequence<OUString> SwDBManager::GetExistingDatabaseNames() ...@@ -2555,18 +2556,8 @@ uno::Sequence<OUString> SwDBManager::GetExistingDatabaseNames()
return xDBContext->getElementNames(); return xDBContext->getElementNames();
} }
namespace { namespace sw
enum class DBConnURIType { {
UNKNOWN = 0,
ODB,
CALC,
DBASE,
FLAT,
MSJET,
MSACE,
WRITER
};
DBConnURIType GetDBunoType(const INetURLObject &rURL) DBConnURIType GetDBunoType(const INetURLObject &rURL)
{ {
OUString sExt(rURL.GetExtension()); OUString sExt(rURL.GetExtension());
...@@ -2607,7 +2598,10 @@ DBConnURIType GetDBunoType(const INetURLObject &rURL) ...@@ -2607,7 +2598,10 @@ DBConnURIType GetDBunoType(const INetURLObject &rURL)
#endif #endif
return type; return type;
} }
}
namespace
{
uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType) uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType)
{ {
uno::Any aURLAny; uno::Any aURLAny;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment