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

DomCR / ACadSharp.Pdf / 14305897173

07 Apr 2025 09:38AM UTC coverage: 2.035% (-73.9%) from 75.959%
14305897173

push

github

DomCR
version 0.1.0-beta

125 of 8279 branches covered (1.51%)

Branch coverage included in aggregate %.

648 of 29704 relevant lines covered (2.18%)

4.64 hits per line

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

0.0
/src/ACadSharp.Pdf/Extensions/PdfUnitTypeExtensions.cs
1
using System.ComponentModel;
2
using ACadSharp.Objects;
3
using ACadSharp.Pdf.Core;
4

5
namespace ACadSharp.Pdf.Extensions
6
{
7
        public static class PlotPaperUnitsExtensions
8
        {
9
                public static PdfUnitType ToPdfUnit(this PlotPaperUnits unit)
10
                {
×
11
                        switch (unit)
×
12
                        {
13
                                case PlotPaperUnits.Inches:
14
                                        return PdfUnitType.Inch;
×
15
                                case PlotPaperUnits.Milimeters:
16
                                        return PdfUnitType.Millimeter;
×
17
                                case PlotPaperUnits.Pixels:
18
                                        return PdfUnitType.Point;
×
19
                                default:
20
                                        throw new InvalidEnumArgumentException(nameof(unit), (int)unit, typeof(PdfUnitType));
×
21
                        }
22
                }
×
23
        }
24

25
        public static class PdfUnitTypeExtensions
26
        {
27
                public static double Transform(this PdfUnitType type, double value)
28
                {
×
29
                        return type switch
×
30
                        {
×
31
                                PdfUnitType.Point => value,
×
32
                                PdfUnitType.Inch => value * 72,
×
33
                                PdfUnitType.Millimeter => value * (72 / 25.4),
×
34
                                PdfUnitType.Centimeter => value * (72 / 2.54),
×
35
                                PdfUnitType.Presentation => value * (72d / 96),
×
36
                                _ => throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(PdfUnitType))
×
37
                        };
×
38
                }
×
39
        }
40
}
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