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 {
|
do {
|
||||||
if let path = bundle.path(forResource: referenceFile, ofType: "reference") {
|
if let path = bundle.path(forResource: referenceFile, ofType: "reference") {
|
||||||
let clipReferenceContent = try String.init(contentsOfFile: path).trimmingCharacters(in: .newlines)
|
let referenceContent = try String.init(contentsOfFile: path).trimmingCharacters(in: .newlines)
|
||||||
let result = SVGSerializer.serialize(node: node)
|
let nodeContent = SVGSerializer.serialize(node: node)
|
||||||
if result != clipReferenceContent {
|
if nodeContent != referenceContent {
|
||||||
XCTFail("result is not equal to referenceContent")
|
XCTFail("nodeContent is not equal to referenceContent")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
XCTFail("No file \(referenceFile)")
|
XCTFail("No file \(referenceFile)")
|
||||||
|
@ -407,7 +407,7 @@ extension Double {
|
|||||||
func serialize() -> String {
|
func serialize() -> String {
|
||||||
let formatter = NumberFormatter()
|
let formatter = NumberFormatter()
|
||||||
formatter.minimumIntegerDigits = 1
|
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()))
|
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