Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include <svx/svdotext.hxx>
11 : #include <rtl/ustring.hxx>
12 :
13 : #include <cppunit/TestAssert.h>
14 : #include <cppunit/TestFixture.h>
15 : #include <cppunit/extensions/HelperMacros.h>
16 : #include <cppunit/plugin/TestPlugIn.h>
17 :
18 : #include <boost/foreach.hpp>
19 :
20 6 : class SdrTextObjTest : public CppUnit::TestFixture {
21 : public:
22 : void AllFamiliesCanBeRestoredFromSavedString();
23 :
24 4 : CPPUNIT_TEST_SUITE(SdrTextObjTest);
25 2 : CPPUNIT_TEST(AllFamiliesCanBeRestoredFromSavedString);
26 4 : CPPUNIT_TEST_SUITE_END();
27 : };
28 :
29 2 : void SdrTextObjTest::AllFamiliesCanBeRestoredFromSavedString() {
30 2 : std::vector<SfxStyleFamily> allFamilies;
31 2 : allFamilies.push_back(SFX_STYLE_FAMILY_CHAR);
32 2 : allFamilies.push_back(SFX_STYLE_FAMILY_PARA);
33 2 : allFamilies.push_back(SFX_STYLE_FAMILY_PAGE);
34 2 : allFamilies.push_back(SFX_STYLE_FAMILY_PSEUDO);
35 :
36 10 : BOOST_FOREACH(SfxStyleFamily family, allFamilies) {
37 8 : OUString styleName = "styleName";
38 8 : SdrTextObj::AppendFamilyToStyleName(styleName, family);
39 8 : SfxStyleFamily readFamily = SdrTextObj::ReadFamilyFromStyleName(styleName);
40 8 : CPPUNIT_ASSERT_EQUAL(family, readFamily);
41 10 : }
42 2 : }
43 :
44 2 : CPPUNIT_TEST_SUITE_REGISTRATION(SdrTextObjTest);
45 :
46 8 : CPPUNIT_PLUGIN_IMPLEMENT();
47 :
48 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|