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

DomCR / ACadSharp / 16415265888

21 Jul 2025 11:04AM UTC coverage: 75.1% (-0.03%) from 75.129%
16415265888

push

github

web-flow
Merge pull request #717 from DomCR/issue-716_book-color-naming-fix

Issue 716

5900 of 8641 branches covered (68.28%)

Branch coverage included in aggregate %.

17 of 28 new or added lines in 5 files covered. (60.71%)

9 existing lines in 1 file now uncovered.

23518 of 30531 relevant lines covered (77.03%)

80204.27 hits per line

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

62.16
/src/ACadSharp/Objects/BookColor.cs
1
using ACadSharp.Attributes;
2
using CSUtilities.Extensions;
3
using System;
4
using System.Drawing;
5
using System.Linq;
6

7
namespace ACadSharp.Objects
8
{
9
        /// <summary>
10
        /// Represents a <see cref="BookColor"/> object.
11
        /// </summary>
12
        /// <remarks>
13
        /// Object name <see cref="DxfFileToken.ObjectDBColor"/> <br/>
14
        /// Dxf class name <see cref="DxfSubclassMarker.DbColor"/>
15
        /// </remarks>
16
        [DxfName(DxfFileToken.ObjectDBColor)]
17
        [DxfSubClass(DxfSubclassMarker.DbColor)]
18
        public class BookColor : NonGraphicalObject
19
        {
20
                /// <inheritdoc/>
21
                public override ObjectType ObjectType => ObjectType.UNLISTED;
×
22

23
                /// <inheritdoc/>
24
                public override string ObjectName => DxfFileToken.ObjectDBColor;
646✔
25

26
                /// <inheritdoc/>
27
                public override string SubclassMarker => DxfSubclassMarker.DbColor;
×
28

29
                /// <summary>
30
                /// Returns the full name of the color, following the structure BookName$ColorName,
31
                /// if when set doesn't follow this structure only the name will be changed.
32
                /// </summary>
33
                /// <inheritdoc/>
34
                public override string Name
35
                {
36
                        get
37
                        {
993✔
38
                                if (this.ColorName.IsNullOrEmpty())
993✔
39
                                {
74✔
40
                                        return string.Empty;
74✔
41
                                }
42
                                else
43
                                {
919✔
44
                                        return $"{this.BookName}${this.ColorName}";
919✔
45
                                }
46
                        }
993✔
47
                        set
48
                        {
254✔
49
                                if (value.Contains('$'))
254!
50
                                {
254✔
51
                                        base.Name = value;
254✔
52

53
                                        this.BookName = value.Split('$').First();
254✔
54
                                        this.ColorName = value.Split('$').Last();
254✔
55
                                }
254✔
56
                                else
NEW
57
                                {
×
NEW
58
                                        this.ColorName = value;
×
NEW
59
                                }
×
60
                        }
254✔
61
                }
62

63
                /// <summary>
64
                /// Color name.
65
                /// </summary>
66
                public string ColorName { get; set; }
2,276✔
67

68
                /// <summary>
69
                /// Book name where the color is stored.
70
                /// </summary>
71
                public string BookName { get; set; }
1,283✔
72

73
                [DxfCodeValue(62, 420)]
74
                public Color Color { get; set; }
534✔
75

76
                /// <inheritdoc/>
77
                public BookColor() : base() { }
1,050✔
78

79
                /// <summary>
80
                /// Initialize a <see cref="BookColor"/> with an specific name.
81
                /// </summary>
82
                /// <param name="name"></param>
83
                public BookColor(string name) : base(name)
×
84
                {
×
85
                }
×
86

87
                /// <summary>
88
                /// Initialize a <see cref="BookColor"/> with an specific book and color name.
89
                /// </summary>
90
                /// <param name="name"></param>
91
                /// <param name="bookName"></param>
NEW
92
                public BookColor(string name, string bookName) : base()
×
NEW
93
                {
×
NEW
94
                        this.Name = name;
×
NEW
95
                        this.BookName = bookName;
×
NEW
96
                }
×
97
        }
98
}
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

© 2025 Coveralls, Inc