differential code coverage report with master
Current view: top level - source/styles - alignment.cpp (source / functions) Coverage Total Hit UBC CBC
Current: coverage.info Lines: 79.7 % 59 47 12 47
Current Date: 2025-12-15 23:01:28 Functions: 92.9 % 14 13 1 13
Baseline: coverage_master.info Branches: 72.2 % 36 26 20 52
Baseline Date: 2025-12-15 23:01:27

             Branch data    TLA  Line data    Source code
       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                 :CBC         149 : bool alignment::wrap() const
      31                 :                : {
      32                 :            149 :     return wrap_text_;
      33                 :                : }
      34                 :                : 
      35                 :             98 : alignment &alignment::wrap(bool wrap_text)
      36                 :                : {
      37                 :             98 :     wrap_text_ = wrap_text;
      38                 :             98 :     return *this;
      39                 :                : }
      40                 :                : 
      41                 :            138 : bool alignment::shrink() const
      42                 :                : {
      43                 :            138 :     return shrink_to_fit_;
      44                 :                : }
      45                 :                : 
      46                 :             43 : alignment &alignment::shrink(bool shrink_to_fit)
      47                 :                : {
      48                 :             43 :     shrink_to_fit_ = shrink_to_fit;
      49                 :             43 :     return *this;
      50                 :                : }
      51                 :                : 
      52                 :            191 : optional<horizontal_alignment> alignment::horizontal() const
      53                 :                : {
      54                 :            191 :     return horizontal_;
      55                 :                : }
      56                 :                : 
      57                 :            116 : alignment &alignment::horizontal(horizontal_alignment horizontal)
      58                 :                : {
      59                 :            116 :     horizontal_ = horizontal;
      60                 :            116 :     return *this;
      61                 :                : }
      62                 :                : 
      63                 :            241 : optional<vertical_alignment> alignment::vertical() const
      64                 :                : {
      65                 :            241 :     return vertical_;
      66                 :                : }
      67                 :                : 
      68                 :            457 : alignment &alignment::vertical(vertical_alignment vertical)
      69                 :                : {
      70                 :            457 :     vertical_ = vertical;
      71                 :            457 :     return *this;
      72                 :                : }
      73                 :                : 
      74                 :             42 : alignment &alignment::indent(int value)
      75                 :                : {
      76                 :             42 :     indent_ = value;
      77                 :             42 :     return *this;
      78                 :                : }
      79                 :                : 
      80                 :            176 : optional<int> alignment::indent() const
      81                 :                : {
      82                 :            176 :     return indent_;
      83                 :                : }
      84                 :                : 
      85                 :             33 : alignment &alignment::rotation(int value)
      86                 :                : {
      87                 :             33 :     text_rotation_ = value;
      88                 :             33 :     return *this;
      89                 :                : }
      90                 :                : 
      91                 :            172 : optional<int> alignment::rotation() const
      92                 :                : {
      93                 :            172 :     return text_rotation_;
      94                 :                : }
      95                 :                : 
      96                 :             13 : bool alignment::operator==(const alignment &right) const
      97                 :                : {
      98                 :             13 :     auto &left = *this;
      99                 :                : 
     100         [ -  + ]:             13 :     if (left.horizontal().is_set() != right.horizontal().is_set())
     101                 :                :     {
     102                 :UBC           0 :         return false;
     103                 :                :     }
     104                 :                : 
     105         [ +  + ]:CBC          13 :     if (left.horizontal().is_set())
     106                 :                :     {
     107   [ +  +  -  + ]:             12 :         if (left.horizontal().get() != right.horizontal().get())
     108                 :                :         {
     109                 :UBC           0 :             return false;
     110                 :                :         }
     111                 :                :     }
     112                 :                : 
     113         [ -  + ]:CBC          13 :     if (left.indent().is_set() != right.indent().is_set())
     114                 :                :     {
     115                 :UBC           0 :         return false;
     116                 :                :     }
     117                 :                : 
     118         [ +  + ]:CBC          13 :     if (left.indent().is_set())
     119                 :                :     {
     120   [ +  +  -  + ]:             12 :         if (left.indent().get() != right.indent().get())
     121                 :                :         {
     122                 :UBC           0 :             return false;
     123                 :                :         }
     124                 :                :     }
     125                 :                : 
     126         [ -  + ]:CBC          13 :     if (left.rotation().is_set() != right.rotation().is_set())
     127                 :                :     {
     128                 :UBC           0 :         return false;
     129                 :                :     }
     130                 :                : 
     131         [ +  + ]:CBC          13 :     if (left.rotation().is_set())
     132                 :                :     {
     133   [ +  +  -  + ]:             12 :         if (left.rotation().get() != right.rotation().get())
     134                 :                :         {
     135                 :UBC           0 :             return false;
     136                 :                :         }
     137                 :                :     }
     138                 :                : 
     139         [ -  + ]:CBC          13 :     if (left.shrink() != right.shrink())
     140                 :                :     {
     141                 :UBC           0 :         return false;
     142                 :                :     }
     143                 :                : 
     144         [ -  + ]:CBC          13 :     if (left.vertical().is_set() != right.vertical().is_set())
     145                 :                :     {
     146                 :UBC           0 :         return false;
     147                 :                :     }
     148                 :                : 
     149         [ +  + ]:CBC          13 :     if (left.vertical().is_set())
     150                 :                :     {
     151   [ +  +  -  + ]:             12 :         if (left.vertical().get() != right.vertical().get())
     152                 :                :         {
     153                 :UBC           0 :             return false;
     154                 :                :         }
     155                 :                :     }
     156                 :                : 
     157         [ -  + ]:CBC          13 :     if (left.wrap() != right.wrap())
     158                 :                :     {
     159                 :UBC           0 :         return false;
     160                 :                :     }
     161                 :                : 
     162                 :CBC          13 :     return true;
     163                 :                : }
     164                 :                : 
     165                 :UBC           0 : bool alignment::operator!=(const alignment &other) const
     166                 :                : {
     167                 :              0 :     return !(*this == other);
     168                 :                : }
     169                 :                : 
     170                 :                : } // namespace xlnt
        

Generated by: LCOV version 2.3.1-beta