1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <sal/config.h>
11 #include <test/unoapi_test.hxx>
13 #include <sfx2/sfxbasemodel.hxx>
15 #include <document.hxx>
18 using namespace ::com::sun::star
;
22 class Test
: public UnoApiTest
26 : UnoApiTest(u
"starmath/qa/cppunit/data/"_ustr
)
30 void testFontStyles();
32 CPPUNIT_TEST_SUITE(Test
);
33 CPPUNIT_TEST(testFontStyles
);
34 CPPUNIT_TEST_SUITE_END();
37 void Test::testFontStyles()
40 loadFromFile(u
"font-styles.odf");
41 SfxBaseModel
* pModel
= dynamic_cast<SfxBaseModel
*>(mxComponent
.get());
42 SmDocShell
* pDocShell
= static_cast<SmDocShell
*>(pModel
->GetObjectShell());
44 const SmFormat
& aFormat
= pDocShell
->GetFormat();
46 CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL
, aFormat
.GetFont(FNT_MATH
).GetItalic());
47 CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD
, aFormat
.GetFont(FNT_MATH
).GetWeight());
48 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
49 aFormat
.GetFont(FNT_MATH
).GetFontSize().Height());
51 CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL
, aFormat
.GetFont(FNT_VARIABLE
).GetItalic());
52 CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD
, aFormat
.GetFont(FNT_VARIABLE
).GetWeight());
53 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
54 aFormat
.GetFont(FNT_VARIABLE
).GetFontSize().Height());
56 CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL
, aFormat
.GetFont(FNT_FUNCTION
).GetItalic());
57 CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD
, aFormat
.GetFont(FNT_FUNCTION
).GetWeight());
58 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
59 aFormat
.GetFont(FNT_FUNCTION
).GetFontSize().Height());
61 CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL
, aFormat
.GetFont(FNT_NUMBER
).GetItalic());
62 CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD
, aFormat
.GetFont(FNT_NUMBER
).GetWeight());
63 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
64 aFormat
.GetFont(FNT_NUMBER
).GetFontSize().Height());
66 CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL
, aFormat
.GetFont(FNT_TEXT
).GetItalic());
67 CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD
, aFormat
.GetFont(FNT_TEXT
).GetWeight());
68 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
69 aFormat
.GetFont(FNT_TEXT
).GetFontSize().Height());
71 CPPUNIT_ASSERT_EQUAL(ITALIC_NONE
, aFormat
.GetFont(FNT_SERIF
).GetItalic());
72 CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL
, aFormat
.GetFont(FNT_SERIF
).GetWeight());
73 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
74 aFormat
.GetFont(FNT_SERIF
).GetFontSize().Height());
76 CPPUNIT_ASSERT_EQUAL(ITALIC_NONE
, aFormat
.GetFont(FNT_SANS
).GetItalic());
77 CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL
, aFormat
.GetFont(FNT_SANS
).GetWeight());
78 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
79 aFormat
.GetFont(FNT_SANS
).GetFontSize().Height());
81 CPPUNIT_ASSERT_EQUAL(ITALIC_NONE
, aFormat
.GetFont(FNT_FIXED
).GetItalic());
82 CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL
, aFormat
.GetFont(FNT_FIXED
).GetWeight());
83 CPPUNIT_ASSERT_EQUAL(aFormat
.GetBaseSize().Height(),
84 aFormat
.GetFont(FNT_FIXED
).GetFontSize().Height());
87 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */