• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xlnt-community / xlnt / 3c28f24b-a03d-431f-9f91-e227e62092fd

26 Apr 2025 07:52PM UTC coverage: 81.886% (-0.4%) from 82.27%
3c28f24b-a03d-431f-9f91-e227e62092fd

Pull #79

circleci

m7913d
Removed run count argument again (as it is not used anymore)
Pull Request #79: Publishing coverage to github pages

14026 of 18604 branches covered (75.39%)

1 of 1 new or added line in 1 file covered. (100.0%)

58 existing lines in 6 files now uncovered.

11500 of 14044 relevant lines covered (81.89%)

10385.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.66
./source/styles/alignment.cpp
1
// Copyright (c) 2014-2022 Thomas Fussell
2
// Copyright (c) 2010-2015 openpyxl
3
// Copyright (c) 2024-2025 xlnt-community
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
// THE SOFTWARE
22
//
23
// @license: http://www.opensource.org/licenses/mit-license.php
24
// @author: see AUTHORS file
25

26
#include <xlnt/styles/alignment.hpp>
27

28
namespace xlnt {
29

30
bool alignment::wrap() const
149✔
31
{
32
    return wrap_text_;
149✔
33
}
34

35
alignment &alignment::wrap(bool wrap_text)
95✔
36
{
37
    wrap_text_ = wrap_text;
95✔
38
    return *this;
95✔
39
}
40

41
bool alignment::shrink() const
138✔
42
{
43
    return shrink_to_fit_;
138✔
44
}
45

46
alignment &alignment::shrink(bool shrink_to_fit)
41✔
47
{
48
    shrink_to_fit_ = shrink_to_fit;
41✔
49
    return *this;
41✔
50
}
51

52
optional<horizontal_alignment> alignment::horizontal() const
191✔
53
{
54
    return horizontal_;
191✔
55
}
56

57
alignment &alignment::horizontal(horizontal_alignment horizontal)
114✔
58
{
59
    horizontal_ = horizontal;
114✔
60
    return *this;
114✔
61
}
62

63
optional<vertical_alignment> alignment::vertical() const
241✔
64
{
65
    return vertical_;
241✔
66
}
67

68
alignment &alignment::vertical(vertical_alignment vertical)
399✔
69
{
70
    vertical_ = vertical;
399✔
71
    return *this;
399✔
72
}
73

74
alignment &alignment::indent(int value)
40✔
75
{
76
    indent_ = value;
40✔
77
    return *this;
40✔
78
}
79

80
optional<int> alignment::indent() const
176✔
81
{
82
    return indent_;
176✔
83
}
84

85
alignment &alignment::rotation(int value)
31✔
86
{
87
    text_rotation_ = value;
31✔
88
    return *this;
31✔
89
}
90

91
optional<int> alignment::rotation() const
172✔
92
{
93
    return text_rotation_;
172✔
94
}
95

96
bool alignment::operator==(const alignment &right) const
13✔
97
{
98
    auto &left = *this;
13✔
99

100
    if (left.horizontal().is_set() != right.horizontal().is_set())
13!
101
    {
102
        return false;
×
103
    }
104

105
    if (left.horizontal().is_set())
13✔
106
    {
107
        if (left.horizontal().get() != right.horizontal().get())
12!
108
        {
UNCOV
109
            return false;
×
110
        }
111
    }
112

113
    if (left.indent().is_set() != right.indent().is_set())
13!
114
    {
115
        return false;
×
116
    }
117

118
    if (left.indent().is_set())
13✔
119
    {
120
        if (left.indent().get() != right.indent().get())
12!
121
        {
122
            return false;
×
123
        }
124
    }
125

126
    if (left.rotation().is_set() != right.rotation().is_set())
13!
127
    {
128
        return false;
×
129
    }
130

131
    if (left.rotation().is_set())
13✔
132
    {
133
        if (left.rotation().get() != right.rotation().get())
12!
134
        {
135
            return false;
×
136
        }
137
    }
138

139
    if (left.shrink() != right.shrink())
13!
140
    {
141
        return false;
×
142
    }
143

144
    if (left.vertical().is_set() != right.vertical().is_set())
13!
145
    {
146
        return false;
×
147
    }
148

149
    if (left.vertical().is_set())
13✔
150
    {
151
        if (left.vertical().get() != right.vertical().get())
12!
152
        {
UNCOV
153
            return false;
×
154
        }
155
    }
156

157
    if (left.wrap() != right.wrap())
13!
158
    {
159
        return false;
×
160
    }
161

162
    return true;
13✔
163
}
164

165
bool alignment::operator!=(const alignment &other) const
×
166
{
167
    return !(*this == other);
×
168
}
169

170
} // namespace xlnt
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc