1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/* -*- 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 <test/unoapi_test.hxx>
#include <sfx2/sfxbasemodel.hxx>
#include <document.hxx>
#include <smdll.hxx>
using namespace ::com::sun::star;
namespace
{
class Test : public UnoApiTest
{
public:
Test()
: UnoApiTest("starmath/qa/cppunit/data/")
{
}
void testFontStyles();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testFontStyles);
CPPUNIT_TEST_SUITE_END();
};
void Test::testFontStyles()
{
// tdf#143213
loadFromFile(u"font-styles.odf");
SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
const SmFormat& aFormat = pDocShell->GetFormat();
CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL, aFormat.GetFont(FNT_MATH).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD, aFormat.GetFont(FNT_MATH).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_MATH).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL, aFormat.GetFont(FNT_VARIABLE).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD, aFormat.GetFont(FNT_VARIABLE).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_VARIABLE).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL, aFormat.GetFont(FNT_FUNCTION).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD, aFormat.GetFont(FNT_FUNCTION).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_FUNCTION).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL, aFormat.GetFont(FNT_NUMBER).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD, aFormat.GetFont(FNT_NUMBER).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_NUMBER).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NORMAL, aFormat.GetFont(FNT_TEXT).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_BOLD, aFormat.GetFont(FNT_TEXT).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_TEXT).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NONE, aFormat.GetFont(FNT_SERIF).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL, aFormat.GetFont(FNT_SERIF).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_SERIF).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NONE, aFormat.GetFont(FNT_SANS).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL, aFormat.GetFont(FNT_SANS).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_SANS).GetFontSize().Height());
CPPUNIT_ASSERT_EQUAL(ITALIC_NONE, aFormat.GetFont(FNT_FIXED).GetItalic());
CPPUNIT_ASSERT_EQUAL(WEIGHT_NORMAL, aFormat.GetFont(FNT_FIXED).GetWeight());
CPPUNIT_ASSERT_EQUAL(aFormat.GetBaseSize().Height(),
aFormat.GetFont(FNT_FIXED).GetFontSize().Height());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
} // namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|