-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Consider font size difference between macOS and iOS. iOS image r…
…esolution is fit with device.
- Loading branch information
Showing
7 changed files
with
197 additions
and
84 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// String+ExTests.swift | ||
// Csv2Img | ||
// | ||
// Created by Fumiya Tanaka on 2024/10/19. | ||
// | ||
|
||
import XCTest | ||
|
||
@testable import Csv2ImgCore | ||
|
||
class StringExtensionTests: XCTestCase { | ||
func testGetSize() throws { | ||
let sut = "Hello World" | ||
let fontSize: CGFloat = 12 | ||
|
||
// Because font system is different between iOS and macOS, | ||
// calculation logic might be different and result font size differs. | ||
#if os(iOS) | ||
let expected = CGSize(width: 61, height: 13) | ||
#elseif os(macOS) | ||
let expected = CGSize(width: 61, height: 12) | ||
#endif | ||
|
||
let actual = sut.getSize(fontSize: fontSize) | ||
XCTAssertEqual(actual, expected) | ||
} | ||
} |