differential code coverage report with master
Current view: top level - source/cell - comment.cpp (source / functions) Coverage Total Hit UBC CBC
Current: coverage.info Lines: 83.0 % 47 39 8 39
Current Date: 2025-12-15 23:01:28 Functions: 82.4 % 17 14 3 14
Baseline: coverage_master.info Branches: 71.4 % 14 10 8 20
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                 :                : #include <xlnt/cell/comment.hpp>
      26                 :                : 
      27                 :                : namespace xlnt {
      28                 :                : 
      29                 :CBC          34 : comment::comment()
      30      [ +  +  + ]:            102 :     : comment("", "")
      31                 :                : {
      32                 :             34 : }
      33                 :                : 
      34                 :             32 : comment::comment(const rich_text &text, const std::string &author)
      35            [ + ]:             32 :     : text_(text), author_(author)
      36                 :                : {
      37                 :             32 : }
      38                 :                : 
      39                 :             37 : comment::comment(const std::string &text, const std::string &author)
      40            [ + ]:             37 :     : text_(), author_(author)
      41                 :                : {
      42            [ + ]:             37 :     text_.plain_text(text, false);
      43                 :             37 : }
      44                 :                : 
      45                 :             16 : rich_text comment::text() const
      46                 :                : {
      47                 :             16 :     return text_;
      48                 :                : }
      49                 :                : 
      50                 :              2 : std::string comment::plain_text() const
      51                 :                : {
      52                 :              2 :     return text_.plain_text();
      53                 :                : }
      54                 :                : 
      55                 :             34 : std::string comment::author() const
      56                 :                : {
      57                 :             34 :     return author_;
      58                 :                : }
      59                 :                : 
      60                 :UBC           0 : void comment::hide()
      61                 :                : {
      62                 :              0 :     visible_ = false;
      63                 :              0 : }
      64                 :                : 
      65                 :              0 : void comment::show()
      66                 :                : {
      67                 :              0 :     visible_ = true;
      68                 :              0 : }
      69                 :                : 
      70                 :CBC          34 : void comment::position(int left, int top)
      71                 :                : {
      72                 :             34 :     left_ = left;
      73                 :             34 :     top_ = top;
      74                 :             34 : }
      75                 :                : 
      76                 :              1 : void comment::size(int width, int height)
      77                 :                : {
      78                 :              1 :     width_ = width;
      79                 :              1 :     height_ = height;
      80                 :              1 : }
      81                 :                : 
      82                 :             16 : bool comment::visible() const
      83                 :                : {
      84                 :             16 :     return visible_;
      85                 :                : }
      86                 :                : 
      87                 :             16 : int comment::left() const
      88                 :                : {
      89                 :             16 :     return left_;
      90                 :                : }
      91                 :                : 
      92                 :             16 : int comment::top() const
      93                 :                : {
      94                 :             16 :     return top_;
      95                 :                : }
      96                 :                : 
      97                 :             16 : int comment::width() const
      98                 :                : {
      99                 :             16 :     return width_;
     100                 :                : }
     101                 :                : 
     102                 :             16 : int comment::height() const
     103                 :                : {
     104                 :             16 :     return height_;
     105                 :                : }
     106                 :                : 
     107                 :              2 : bool comment::operator==(const comment &other) const
     108                 :                : {
     109                 :                :     // not comparing top/left as this is set on a per cell basis
     110                 :              2 :     return text_ == other.text_
     111         [ +  - ]:              2 :         && author_ == other.author_
     112         [ +  - ]:              2 :         && width_ == other.width_
     113   [ +  -  +  - ]:              4 :         && height_ == other.height_;
     114                 :                : }
     115                 :                : 
     116                 :UBC           0 : bool comment::operator!=(const comment &other) const
     117                 :                : {
     118                 :              0 :     return !(*this == other);
     119                 :                : }
     120                 :                : 
     121                 :                : } // namespace xlnt
        

Generated by: LCOV version 2.3.1-beta