tdf#148645: add unit test
This introduces CppunitTest_scaddins_analysis. Change-Id: I4e6d4215f05bc68852ecac12082e8398cca5be5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162982 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
parent
538f7b45c0
commit
bc5e5cb08a
3 changed files with 105 additions and 0 deletions
38
scaddins/CppunitTest_scaddins_analysis.mk
Normal file
38
scaddins/CppunitTest_scaddins_analysis.mk
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
|
||||
#
|
||||
# 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,scaddins_analysis))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,scaddins_analysis, \
|
||||
scaddins/qa/analysis \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,scaddins_analysis, \
|
||||
comphelper \
|
||||
cppu \
|
||||
sal \
|
||||
test \
|
||||
unotest \
|
||||
))
|
||||
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_ure,scaddins_analysis))
|
||||
$(eval $(call gb_CppunitTest_use_vcl,scaddins_analysis))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_rdb,scaddins_analysis,services))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_configuration,scaddins_analysis))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_sdk_api,scaddins_analysis))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_internal_comprehensive_api,scaddins_analysis,\
|
||||
scaddins \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -30,4 +30,8 @@ $(eval $(call gb_Module_add_l10n_targets,scaddins,\
|
|||
AllLangMoTarget_sca \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Module_add_check_targets,scaddins,\
|
||||
CppunitTest_scaddins_analysis \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
|
|
63
scaddins/qa/analysis.cxx
Normal file
63
scaddins/qa/analysis.cxx
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* 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 <test/bootstrapfixture.hxx>
|
||||
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <com/sun/star/sheet/addin/XAnalysis.hpp>
|
||||
#include <com/sun/star/uno/XInterface.hpp>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
class Test : public test::BootstrapFixture
|
||||
{
|
||||
public:
|
||||
virtual void setUp() override;
|
||||
|
||||
protected:
|
||||
css::uno::Reference<css::sheet::addin::XAnalysis> mxAnalysis;
|
||||
};
|
||||
|
||||
void Test::setUp()
|
||||
{
|
||||
test::BootstrapFixture::setUp();
|
||||
auto xFactory(comphelper::getProcessServiceFactory());
|
||||
mxAnalysis.set(xFactory->createInstance(u"com.sun.star.sheet.addin.Analysis"_ustr),
|
||||
css::uno::UNO_QUERY_THROW);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, test_getDec2Hex)
|
||||
{
|
||||
// Test that 'Places' argument accepts different numeric types
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(sal_Int8(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(sal_Int16(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(sal_uInt16(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(sal_Int32(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(sal_uInt32(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(sal_Int64(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(double(10))));
|
||||
CPPUNIT_ASSERT_EQUAL(u"000000006E"_ustr,
|
||||
mxAnalysis->getDec2Hex({}, 110, css::uno::Any(float(10))));
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
Loading…
Reference in a new issue