Fix plist font file name and fix all tests
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
parent
8442c89944
commit
ae7c0abbc2
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@ -1,8 +1,10 @@
|
|||||||
library "openiumpipeline"
|
library "openiumpipeline"
|
||||||
|
|
||||||
env.DEVELOPER_DIR="/Applications/Xcode-15.4.0.app/Contents/Developer"
|
env.DEVELOPER_DIR="/Applications/Xcode-16.3.0.app/Contents/Developer"
|
||||||
//env.SIMULATOR_DEVICE_TYPES="iPad--7th-generation-"
|
// env.SIMULATOR_DEVICE_TYPES="iPhone-14-Pro"
|
||||||
|
// env.SLACK_CHANNEL = "prj-skdevkit"
|
||||||
env.IS_PACKAGE_SWIFT=1
|
env.IS_PACKAGE_SWIFT=1
|
||||||
env.TARGETS_MACOS=1
|
env.TARGETS_MACOS=1
|
||||||
|
env.PACKAGE_NAME="ResgenSwift" // xcodebuild -list => Only 1 scheme
|
||||||
|
|
||||||
iOSpipeline()
|
iOSpipeline()
|
||||||
|
@ -6,16 +6,16 @@
|
|||||||
<array/>
|
<array/>
|
||||||
<key>UIAppFonts</key>
|
<key>UIAppFonts</key>
|
||||||
<array>
|
<array>
|
||||||
<string>Lato-Italic</string>
|
<string>Lato-Italic.ttf</string>
|
||||||
<string>Lato-LightItalic</string>
|
<string>Lato-LightItalic.ttf</string>
|
||||||
<string>Lato-Hairline</string>
|
<string>Lato-Thin.ttf</string>
|
||||||
<string>Lato-Bold</string>
|
<string>Lato-Bold.ttf</string>
|
||||||
<string>Lato-Black</string>
|
<string>Lato-Black.ttf</string>
|
||||||
<string>Lato-Regular</string>
|
<string>Lato-Regular.ttf</string>
|
||||||
<string>Lato-BlackItalic</string>
|
<string>Lato-BlackItalic.ttf</string>
|
||||||
<string>Lato-BoldItalic</string>
|
<string>Lato-BoldItalic.ttf</string>
|
||||||
<string>Lato-Light</string>
|
<string>Lato-Light.ttf</string>
|
||||||
<string>Lato-HairlineItalic</string>
|
<string>Lato-ThinItalic.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -6,16 +6,16 @@
|
|||||||
<array/>
|
<array/>
|
||||||
<key>UIAppFonts</key>
|
<key>UIAppFonts</key>
|
||||||
<array>
|
<array>
|
||||||
<string>Lato-Italic</string>
|
<string>Lato-Italic.ttf</string>
|
||||||
<string>Lato-LightItalic</string>
|
<string>Lato-LightItalic.ttf</string>
|
||||||
<string>Lato-Hairline</string>
|
<string>Lato-Thin.ttf</string>
|
||||||
<string>Lato-Bold</string>
|
<string>Lato-Bold.ttf</string>
|
||||||
<string>Lato-Black</string>
|
<string>Lato-Black.ttf</string>
|
||||||
<string>Lato-Regular</string>
|
<string>Lato-Regular.ttf</string>
|
||||||
<string>Lato-BlackItalic</string>
|
<string>Lato-BlackItalic.ttf</string>
|
||||||
<string>Lato-BoldItalic</string>
|
<string>Lato-BoldItalic.ttf</string>
|
||||||
<string>Lato-Light</string>
|
<string>Lato-Light.ttf</string>
|
||||||
<string>Lato-HairlineItalic</string>
|
<string>Lato-ThinItalic.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
FORCE_FLAG="$1"
|
FORCE_FLAG="$1"
|
||||||
|
|
||||||
## Font
|
## Font
|
||||||
#swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
||||||
# --extension-output-path "./Fonts/Generated" \
|
--extension-output-path "./Fonts/Generated" \
|
||||||
# --extension-name "FontYolo" \
|
--extension-name "FontYolo" \
|
||||||
# --extension-name-ui-kit "UIFontYolo" \
|
--extension-name-ui-kit "UIFontYolo" \
|
||||||
# --extension-suffix "GenAllScript" \
|
--extension-suffix "GenAllScript" \
|
||||||
# --info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
--info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
||||||
#
|
#
|
||||||
#echo "\n-------------------------\n"
|
#echo "\n-------------------------\n"
|
||||||
#
|
#
|
||||||
|
@ -43,22 +43,31 @@ struct Fonts: ParsableCommand {
|
|||||||
let fontsToGenerate = FontFileParser.parse(options.inputFile)
|
let fontsToGenerate = FontFileParser.parse(options.inputFile)
|
||||||
|
|
||||||
// Get real font names
|
// Get real font names
|
||||||
let inputFolder = URL(fileURLWithPath: options.inputFile).deletingLastPathComponent().relativePath
|
let inputFolder = URL(fileURLWithPath: options.inputFile)
|
||||||
let fontsNames = FontsToolHelper.getFontPostScriptName(for: fontsToGenerate,
|
.deletingLastPathComponent()
|
||||||
inputFolder: inputFolder)
|
.relativePath
|
||||||
|
|
||||||
|
let fontsNames = FontsToolHelper.getFontPostScriptName(
|
||||||
|
for: fontsToGenerate,
|
||||||
|
inputFolder: inputFolder
|
||||||
|
)
|
||||||
|
|
||||||
// Generate extension
|
// Generate extension
|
||||||
FontExtensionGenerator.writeExtensionFile(fontsNames: fontsNames,
|
FontExtensionGenerator.writeExtensionFile(
|
||||||
staticVar: options.staticMembers,
|
fontsNames: fontsNames,
|
||||||
extensionName: options.extensionName,
|
staticVar: options.staticMembers,
|
||||||
extensionFilePath: options.extensionFilePath,
|
extensionName: options.extensionName,
|
||||||
isSwiftUI: true)
|
extensionFilePath: options.extensionFilePath,
|
||||||
|
isSwiftUI: true
|
||||||
|
)
|
||||||
|
|
||||||
FontExtensionGenerator.writeExtensionFile(fontsNames: fontsNames,
|
FontExtensionGenerator.writeExtensionFile(
|
||||||
staticVar: options.staticMembers,
|
fontsNames: fontsNames,
|
||||||
extensionName: options.extensionNameUIKit,
|
staticVar: options.staticMembers,
|
||||||
extensionFilePath: options.extensionFilePathUIKit,
|
extensionName: options.extensionNameUIKit,
|
||||||
isSwiftUI: false)
|
extensionFilePath: options.extensionFilePathUIKit,
|
||||||
|
isSwiftUI: false
|
||||||
|
)
|
||||||
|
|
||||||
print("Info.plist has been updated with:")
|
print("Info.plist has been updated with:")
|
||||||
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames, infoPlistPaths: options.infoPlistPaths))")
|
print("\(FontPlistGenerator.generatePlistUIAppsFontContent(for: fontsNames, infoPlistPaths: options.infoPlistPaths))")
|
||||||
|
@ -57,17 +57,26 @@ class FontsToolHelper {
|
|||||||
return fontsFileNames
|
return fontsFileNames
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func getFontName(atPath path: String) -> String {
|
private static func getFontName(atPath path: String) -> FontName {
|
||||||
//print("fc-scan --format %{postscriptname} \(path)")
|
//print("fc-scan --format %{postscriptname} \(path)")
|
||||||
// Get real font name
|
// Get real font name
|
||||||
let task = Shell.shell(["fc-scan", "--format", "%{postscriptname}", path])
|
let task = Shell.shell(["fc-scan", "--format", "%{postscriptname}", path])
|
||||||
|
|
||||||
guard let fontName = task.output, task.terminationStatus == 0 else {
|
guard let postscriptName = task.output, task.terminationStatus == 0 else {
|
||||||
let error = FontsToolError.fcScan(path, task.terminationStatus, task.output)
|
let error = FontsToolError.fcScan(path, task.terminationStatus, task.output)
|
||||||
print(error.description)
|
print(error.description)
|
||||||
Fonts.exit(withError: error)
|
Fonts.exit(withError: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fontName
|
let pathURL = URL(fileURLWithPath: path)
|
||||||
|
let filename = pathURL
|
||||||
|
.deletingPathExtension()
|
||||||
|
.lastPathComponent
|
||||||
|
|
||||||
|
return FontName(
|
||||||
|
postscriptName: postscriptName,
|
||||||
|
filename: filename,
|
||||||
|
fileExtension: pathURL.pathExtension
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,16 +26,16 @@ class FontPlistGenerator {
|
|||||||
|
|
||||||
// Fill array with fonts
|
// Fill array with fonts
|
||||||
fontsToAddToPlist
|
fontsToAddToPlist
|
||||||
.forEach {
|
.forEach { fontName in
|
||||||
Shell.shell(launchPath: "/usr/libexec/PlistBuddy",
|
Shell.shell(launchPath: "/usr/libexec/PlistBuddy",
|
||||||
["-c", "add :UIAppFonts: string \($0)", infoPlist])
|
["-c", "add :UIAppFonts: string \(fontName.filename).\(fontName.fileExtension)", infoPlist])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var plistData = "<key>UIAppFonts</key>\n\t<array>\n"
|
var plistData = "<key>UIAppFonts</key>\n\t<array>\n"
|
||||||
fontsToAddToPlist
|
fontsToAddToPlist
|
||||||
.forEach {
|
.forEach { fontName in
|
||||||
plistData += "\t\t<string>\($0)</string>\n"
|
plistData += "\t\t<string>\(fontName.filename).\(fontName.fileExtension)</string>\n"
|
||||||
}
|
}
|
||||||
plistData += "\t</array>"
|
plistData += "\t</array>"
|
||||||
|
|
||||||
|
@ -10,18 +10,18 @@ import ToolCore
|
|||||||
|
|
||||||
class FontExtensionGenerator {
|
class FontExtensionGenerator {
|
||||||
|
|
||||||
private static func getFontNameEnum(fontsNames: [String]) -> String {
|
private static func getFontNameEnum(fontsNames: [FontName]) -> String {
|
||||||
var enumDefinition = " enum FontName: String {\n"
|
var enumDefinition = " enum FontName: String {\n"
|
||||||
|
|
||||||
fontsNames.forEach {
|
fontsNames.forEach {
|
||||||
enumDefinition += " case \($0.fontNameSanitize) = \"\($0)\"\n"
|
enumDefinition += " case \($0.fontNameSanitize) = \"\($0.postscriptName)\"\n"
|
||||||
}
|
}
|
||||||
enumDefinition += " }\n"
|
enumDefinition += " }\n"
|
||||||
|
|
||||||
return enumDefinition
|
return enumDefinition
|
||||||
}
|
}
|
||||||
|
|
||||||
static func writeExtensionFile(fontsNames: [String],
|
static func writeExtensionFile(fontsNames: [FontName],
|
||||||
staticVar: Bool,
|
staticVar: Bool,
|
||||||
extensionName: String,
|
extensionName: String,
|
||||||
extensionFilePath: String,
|
extensionFilePath: String,
|
||||||
@ -43,7 +43,7 @@ class FontExtensionGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func getExtensionContent(fontsNames: [String],
|
static func getExtensionContent(fontsNames: [FontName],
|
||||||
staticVar: Bool,
|
staticVar: Bool,
|
||||||
extensionName: String,
|
extensionName: String,
|
||||||
isSwiftUI: Bool) -> String {
|
isSwiftUI: Bool) -> String {
|
||||||
|
@ -7,11 +7,18 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
typealias FontName = String
|
//typealias FontName = String
|
||||||
|
|
||||||
|
struct FontName: Hashable {
|
||||||
|
|
||||||
|
let postscriptName: String
|
||||||
|
let filename: String
|
||||||
|
let fileExtension: String
|
||||||
|
}
|
||||||
|
|
||||||
extension FontName {
|
extension FontName {
|
||||||
var fontNameSanitize: String {
|
var fontNameSanitize: String {
|
||||||
self.removeCharacters(from: "[]+-_")
|
postscriptName.removeCharacters(from: "[]+-_")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
func getProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public let ResgenSwiftVersion = "1.2"
|
public let ResgenSwiftVersion = "2.1.0"
|
||||||
|
@ -84,7 +84,7 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
|||||||
name: "Ecran un",
|
name: "Ecran un",
|
||||||
action: "",
|
action: "",
|
||||||
category: "",
|
category: "",
|
||||||
params: []
|
params: [:]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
@ -127,7 +127,7 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
|||||||
name: "Ecran un",
|
name: "Ecran un",
|
||||||
action: "",
|
action: "",
|
||||||
category: "",
|
category: "",
|
||||||
params: []
|
params: [:]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
@ -60,7 +60,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
let expect = """
|
let expect = """
|
||||||
// Generated by ResgenSwift.Analytics 1.2
|
// Generated by ResgenSwift.Analytics 1.2
|
||||||
|
|
||||||
import Firebase
|
import FirebaseAnalytics
|
||||||
|
|
||||||
// MARK: - Protocol
|
// MARK: - Protocol
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
||||||
func logScreen(name: String, path: String) {
|
func logScreen(name: String, path: String) {
|
||||||
var parameters = [
|
var parameters = [
|
||||||
AnalyticsParameterScreenName: name
|
AnalyticsParameterScreenName: name as NSObject
|
||||||
]
|
]
|
||||||
|
|
||||||
Analytics.logEvent(
|
Analytics.logEvent(
|
||||||
@ -94,19 +94,25 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
category: String,
|
category: String,
|
||||||
params: [String: Any]?
|
params: [String: Any]?
|
||||||
) {
|
) {
|
||||||
var parameters: [String:Any] = [
|
var parameters: [String:NSObject] = [
|
||||||
"action": action,
|
"action": action as NSObject,
|
||||||
"category": category,
|
"category": category as NSObject,
|
||||||
]
|
]
|
||||||
|
|
||||||
if let supplementaryParameters = params {
|
if let supplementaryParameters = params {
|
||||||
parameters.merge(supplementaryParameters) { (origin, new) -> Any in
|
for (newKey, newValue) in supplementaryParameters {
|
||||||
return origin
|
if parameters.contains(where: { (key: String, value: NSObject) in
|
||||||
|
key == newKey
|
||||||
|
}) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters[newKey] = newValue as? NSObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.logEvent(
|
Analytics.logEvent(
|
||||||
name,
|
name.replacingOccurrences(of: [" "], with: "_"),
|
||||||
parameters: parameters
|
parameters: parameters
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -173,7 +179,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
name: "s1 def two",
|
name: "s1 def two",
|
||||||
action: "",
|
action: "",
|
||||||
category: "",
|
category: "",
|
||||||
params: []
|
params: [:]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +372,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
name: "s1 def two",
|
name: "s1 def two",
|
||||||
action: "test",
|
action: "test",
|
||||||
category: "test",
|
category: "test",
|
||||||
params: []
|
params: [:]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +425,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
// Generated by ResgenSwift.Analytics 1.2
|
// Generated by ResgenSwift.Analytics 1.2
|
||||||
|
|
||||||
import MatomoTracker
|
import MatomoTracker
|
||||||
import Firebase
|
import FirebaseAnalytics
|
||||||
|
|
||||||
// MARK: - Protocol
|
// MARK: - Protocol
|
||||||
|
|
||||||
@ -499,7 +505,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
||||||
func logScreen(name: String, path: String) {
|
func logScreen(name: String, path: String) {
|
||||||
var parameters = [
|
var parameters = [
|
||||||
AnalyticsParameterScreenName: name
|
AnalyticsParameterScreenName: name as NSObject
|
||||||
]
|
]
|
||||||
|
|
||||||
Analytics.logEvent(
|
Analytics.logEvent(
|
||||||
@ -514,19 +520,25 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
category: String,
|
category: String,
|
||||||
params: [String: Any]?
|
params: [String: Any]?
|
||||||
) {
|
) {
|
||||||
var parameters: [String:Any] = [
|
var parameters: [String:NSObject] = [
|
||||||
"action": action,
|
"action": action as NSObject,
|
||||||
"category": category,
|
"category": category as NSObject,
|
||||||
]
|
]
|
||||||
|
|
||||||
if let supplementaryParameters = params {
|
if let supplementaryParameters = params {
|
||||||
parameters.merge(supplementaryParameters) { (origin, new) -> Any in
|
for (newKey, newValue) in supplementaryParameters {
|
||||||
return origin
|
if parameters.contains(where: { (key: String, value: NSObject) in
|
||||||
|
key == newKey
|
||||||
|
}) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters[newKey] = newValue as? NSObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.logEvent(
|
Analytics.logEvent(
|
||||||
name,
|
name.replacingOccurrences(of: [" "], with: "_"),
|
||||||
parameters: parameters
|
parameters: parameters
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -599,7 +611,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
|||||||
name: "s1 def two",
|
name: "s1 def two",
|
||||||
action: "test",
|
action: "test",
|
||||||
category: "test",
|
category: "test",
|
||||||
params: []
|
params: [:]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
|||||||
func test_uiKit_GeneratedExtensionContent() {
|
func test_uiKit_GeneratedExtensionContent() {
|
||||||
// Given
|
// Given
|
||||||
let fontNames: [FontName] = [
|
let fontNames: [FontName] = [
|
||||||
"CircularStd-Regular",
|
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
|
||||||
"CircularStd-Bold"
|
FontName(postscriptName: "CircularStd-Bold", filename: "CircularStd-Bold", fileExtension: "ttf")
|
||||||
]
|
]
|
||||||
|
|
||||||
// When
|
// When
|
||||||
@ -59,8 +59,8 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
|||||||
func test_swiftUI_GeneratedExtensionContent() {
|
func test_swiftUI_GeneratedExtensionContent() {
|
||||||
// Given
|
// Given
|
||||||
let fontNames: [FontName] = [
|
let fontNames: [FontName] = [
|
||||||
"CircularStd-Regular",
|
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
|
||||||
"CircularStd-Bold"
|
FontName(postscriptName: "CircularStd-Bold", filename: "CircularStd-Bold", fileExtension: "ttf")
|
||||||
]
|
]
|
||||||
|
|
||||||
// When
|
// When
|
||||||
|
@ -14,7 +14,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_uiKit_GeneratedProperty_noForbiddenCharacter() {
|
func test_uiKit_GeneratedProperty_noForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "CircularStdBold"
|
let fontName = FontName(
|
||||||
|
postscriptName: "CircularStdBold",
|
||||||
|
filename: "CircularStd-Bold",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||||
@ -31,7 +35,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_uiKit_GeneratedProperty_withForbiddenCharacter() {
|
func test_uiKit_GeneratedProperty_withForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
let fontName = FontName(
|
||||||
|
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||||
|
filename: "Circular_Std+Bold-Underline",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||||
@ -48,7 +56,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_uiKit_GeneratedMethod_noForbiddenCharacter() {
|
func test_uiKit_GeneratedMethod_noForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "CircularStdBold"
|
let fontName = FontName(
|
||||||
|
postscriptName: "CircularStdBold",
|
||||||
|
filename: "CircularStd-Bold",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||||
@ -65,7 +77,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_uiKit_GeneratedMethod_withForbiddenCharacter() {
|
func test_uiKit_GeneratedMethod_withForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
let fontName = FontName(
|
||||||
|
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||||
|
filename: "Circular_Std+Bold-Underline",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||||
@ -82,7 +98,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_swiftUI_GeneratedProperty_noForbiddenCharacter() {
|
func test_swiftUI_GeneratedProperty_noForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "CircularStdBold"
|
let fontName = FontName(
|
||||||
|
postscriptName: "CircularStdBold",
|
||||||
|
filename: "CircularStd-Bold",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||||
@ -99,7 +119,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_swiftUI_GeneratedProperty_withForbiddenCharacter() {
|
func test_swiftUI_GeneratedProperty_withForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
let fontName = FontName(
|
||||||
|
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||||
|
filename: "Circular_Std+Bold-Underline",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||||
@ -116,7 +140,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_swiftUI_GeneratedMethod_noForbiddenCharacter() {
|
func test_swiftUI_GeneratedMethod_noForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "CircularStdBold"
|
let fontName = FontName(
|
||||||
|
postscriptName: "CircularStdBold",
|
||||||
|
filename: "CircularStd-Bold",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||||
@ -133,7 +161,11 @@ final class FontNameTests: XCTestCase {
|
|||||||
|
|
||||||
func test_swiftUI_GeneratedMethod_withForbiddenCharacter() {
|
func test_swiftUI_GeneratedMethod_withForbiddenCharacter() {
|
||||||
// Given
|
// Given
|
||||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
let fontName = FontName(
|
||||||
|
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||||
|
filename: "Circular_Std+Bold-Underline",
|
||||||
|
fileExtension: "ttf"
|
||||||
|
)
|
||||||
|
|
||||||
// When
|
// When
|
||||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||||
|
@ -14,8 +14,8 @@ final class FontPlistGeneratorTests: XCTestCase {
|
|||||||
func testGeneratedPlist() {
|
func testGeneratedPlist() {
|
||||||
// Given
|
// Given
|
||||||
let fontNames: [FontName] = [
|
let fontNames: [FontName] = [
|
||||||
"CircularStd-Regular",
|
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
|
||||||
"CircularStd-Bold"
|
FontName(postscriptName: "CircularStd-Bold", filename: "CircularStd-Bold", fileExtension: "ttf")
|
||||||
]
|
]
|
||||||
|
|
||||||
// When
|
// When
|
||||||
@ -25,8 +25,8 @@ final class FontPlistGeneratorTests: XCTestCase {
|
|||||||
let expect = """
|
let expect = """
|
||||||
<key>UIAppFonts</key>
|
<key>UIAppFonts</key>
|
||||||
<array>
|
<array>
|
||||||
<string>CircularStd-Regular</string>
|
<string>CircularStd-Regular.ttf</string>
|
||||||
<string>CircularStd-Bold</string>
|
<string>CircularStd-Bold.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -57,12 +57,18 @@ final class TagsGeneratorTests: XCTestCase {
|
|||||||
|
|
||||||
/// Translation in ium :
|
/// Translation in ium :
|
||||||
/// Some translation
|
/// Some translation
|
||||||
|
///
|
||||||
|
/// Comment :
|
||||||
|
/// No comment
|
||||||
var s1_def_one: String {
|
var s1_def_one: String {
|
||||||
"Some translation"
|
"Some translation"
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translation in ium :
|
/// Translation in ium :
|
||||||
/// Some translation
|
/// Some translation
|
||||||
|
///
|
||||||
|
/// Comment :
|
||||||
|
/// No comment
|
||||||
var s1_def_two: String {
|
var s1_def_two: String {
|
||||||
"Some translation"
|
"Some translation"
|
||||||
}
|
}
|
||||||
@ -71,6 +77,9 @@ final class TagsGeneratorTests: XCTestCase {
|
|||||||
|
|
||||||
/// Translation in ium :
|
/// Translation in ium :
|
||||||
/// Some translation
|
/// Some translation
|
||||||
|
///
|
||||||
|
/// Comment :
|
||||||
|
/// No comment
|
||||||
var s2_def_one: String {
|
var s2_def_one: String {
|
||||||
"Some translation"
|
"Some translation"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user