Publish v1.0
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
Reviewed-on: #1
This commit is contained in:
@ -0,0 +1,57 @@
|
||||
//
|
||||
// FontExtensionGeneratorTests.swift
|
||||
//
|
||||
//
|
||||
// Created by Thibaut Schmitt on 05/09/2022.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
import ToolCore
|
||||
|
||||
@testable import ResgenSwift
|
||||
|
||||
final class FontExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
func testGeneratedExtensionContent() {
|
||||
// Given
|
||||
let fontNames: [FontName] = [
|
||||
"CircularStd-Regular",
|
||||
"CircularStd-Bold"
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = FontExtensionGenerator.getExtensionContent(fontsNames: fontNames,
|
||||
staticVar: false,
|
||||
extensionName: "GenFonts")
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
// Generated by ResgenSwift.Fonts \(ResgenSwiftVersion)
|
||||
|
||||
import UIKit
|
||||
|
||||
extension GenFonts {
|
||||
|
||||
enum FontName: String {
|
||||
case CircularStdRegular = "CircularStd-Regular"
|
||||
case CircularStdBold = "CircularStd-Bold"
|
||||
}
|
||||
|
||||
// MARK: - Getter
|
||||
|
||||
func CircularStdRegular(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdRegular.rawValue, size: size)!
|
||||
}
|
||||
|
||||
func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdBold.rawValue, size: size)!
|
||||
}
|
||||
|
||||
}
|
||||
"""
|
||||
|
||||
XCTAssertEqual(extensionContent.adaptForXCTest(), expect.adaptForXCTest())
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user