svgio: add test for svgtools starting with SvgNumber
Change-Id: I1f903a947fb1c338cf62980256c5369fefb7740e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114956 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
0d62ee66d6
commit
e61cbca254
3 changed files with 94 additions and 0 deletions
35
svgio/CppunitTest_svgio_tools.mk
Normal file
35
svgio/CppunitTest_svgio_tools.mk
Normal file
|
@ -0,0 +1,35 @@
|
|||
# -*- 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,svgio_tools))
|
||||
|
||||
$(eval $(call gb_CppunitTest_add_exception_objects,svgio_tools,\
|
||||
svgio/qa/cppunit/SvgNumberTest \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_set_include,svgio_tools,\
|
||||
$$(INCLUDE) \
|
||||
-I$(SRCDIR)/svgio/inc \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_externals,svgio_tools,\
|
||||
boost_headers \
|
||||
))
|
||||
|
||||
$(eval $(call gb_CppunitTest_use_libraries,svgio_tools,\
|
||||
basegfx \
|
||||
drawinglayer \
|
||||
sal \
|
||||
sax \
|
||||
svt \
|
||||
vcl \
|
||||
svgio \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
|
@ -25,6 +25,7 @@ $(eval $(call gb_Module_add_targets,svgio,\
|
|||
$(eval $(call gb_Module_add_check_targets,svgio,\
|
||||
CppunitTest_svgio \
|
||||
CppunitTest_svgio_read \
|
||||
CppunitTest_svgio_tools \
|
||||
))
|
||||
|
||||
# vim: set noet ts=4 sw=4:
|
||||
|
|
58
svgio/qa/cppunit/SvgNumberTest.cxx
Normal file
58
svgio/qa/cppunit/SvgNumberTest.cxx
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* -*- 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 <sal/config.h>
|
||||
|
||||
#include <cppunit/TestAssert.h>
|
||||
#include <cppunit/TestFixture.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <cppunit/plugin/TestPlugIn.h>
|
||||
|
||||
#include <SvgNumber.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
class TestNumber : public CppUnit::TestFixture
|
||||
{
|
||||
void test();
|
||||
|
||||
public:
|
||||
CPPUNIT_TEST_SUITE(TestNumber);
|
||||
CPPUNIT_TEST(test);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
};
|
||||
|
||||
void TestNumber::test()
|
||||
{
|
||||
{
|
||||
svgio::svgreader::SvgNumber aNumber;
|
||||
CPPUNIT_ASSERT_EQUAL(svgio::svgreader::SvgUnit::px, aNumber.getUnit());
|
||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, aNumber.getNumber(), 1e-8);
|
||||
CPPUNIT_ASSERT_EQUAL(false, aNumber.isSet());
|
||||
}
|
||||
{
|
||||
svgio::svgreader::SvgNumber aNumber(0.01);
|
||||
CPPUNIT_ASSERT_EQUAL(svgio::svgreader::SvgUnit::px, aNumber.getUnit());
|
||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.01, aNumber.getNumber(), 1e-8);
|
||||
CPPUNIT_ASSERT_EQUAL(true, aNumber.isSet());
|
||||
}
|
||||
{
|
||||
svgio::svgreader::SvgNumber aNumber(1.01, svgio::svgreader::SvgUnit::cm);
|
||||
CPPUNIT_ASSERT_EQUAL(svgio::svgreader::SvgUnit::cm, aNumber.getUnit());
|
||||
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.01, aNumber.getNumber(), 1e-8);
|
||||
CPPUNIT_ASSERT_EQUAL(true, aNumber.isSet());
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestNumber);
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
Loading…
Reference in a new issue