mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Small improvement
This commit is contained in:
parent
ae5627279e
commit
4751d8b301
@ -41,10 +41,10 @@ class MacawSVGTests: XCTestCase {
|
||||
|
||||
do {
|
||||
if let path = bundle.path(forResource: referenceFile, ofType: "reference") {
|
||||
let clipReferenceContent = try String.init(contentsOfFile: path).trimmingCharacters(in: .newlines)
|
||||
let result = SVGSerializer.serialize(node: node)
|
||||
if result != clipReferenceContent {
|
||||
XCTFail("result is not equal to referenceContent")
|
||||
let referenceContent = try String.init(contentsOfFile: path).trimmingCharacters(in: .newlines)
|
||||
let nodeContent = SVGSerializer.serialize(node: node)
|
||||
if nodeContent != referenceContent {
|
||||
XCTFail("nodeContent is not equal to referenceContent")
|
||||
}
|
||||
} else {
|
||||
XCTFail("No file \(referenceFile)")
|
||||
|
@ -407,7 +407,7 @@ extension Double {
|
||||
func serialize() -> String {
|
||||
let formatter = NumberFormatter()
|
||||
formatter.minimumIntegerDigits = 1
|
||||
formatter.maximumFractionDigits = 15
|
||||
formatter.maximumFractionDigits = 6
|
||||
return abs(self.remainder(dividingBy: 1)) > 0.00001 ? formatter.string(from: NSNumber(value: self))! : String(Int(self.rounded()))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user