Handle bundle for Image and Color
Some checks reported warnings
gitea-openium/resgen.swift/pipeline/head This commit is unstable
Some checks reported warnings
gitea-openium/resgen.swift/pipeline/head This commit is unstable
This commit is contained in:
@@ -26,7 +26,8 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
staticVar: false,
|
||||
extensionName: "GenColors",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
visibility: .public,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -39,12 +40,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
@objc public var colorOne: UIColor {
|
||||
UIColor(named: "colorOne")!
|
||||
UIColor(named: "colorOne", in: Bundle.main, compatibleWith: nil)!
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
@objc public var colorTwo: UIColor {
|
||||
UIColor(named: "colorTwo")!
|
||||
UIColor(named: "colorTwo", in: Bundle.main, compatibleWith: nil)!
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -65,7 +66,8 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
staticVar: true,
|
||||
extensionName: "GenColor",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
visibility: .public,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -78,12 +80,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
public static var colorOne: UIColor {
|
||||
UIColor(named: "colorOne")!
|
||||
UIColor(named: "colorOne", in: Bundle.module, compatibleWith: nil)!
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
public static var colorTwo: UIColor {
|
||||
UIColor(named: "colorTwo")!
|
||||
UIColor(named: "colorTwo", in: Bundle.module, compatibleWith: nil)!
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -104,7 +106,8 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
staticVar: false,
|
||||
extensionName: "GenColors",
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
visibility: .package,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -117,12 +120,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
package var colorOne: Color {
|
||||
Color("colorOne")
|
||||
Color("colorOne", bundle: Bundle.main)
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
package var colorTwo: Color {
|
||||
Color("colorTwo")
|
||||
Color("colorTwo", bundle: Bundle.main)
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -143,7 +146,8 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
staticVar: true,
|
||||
extensionName: "GenColor",
|
||||
isSwiftUI: true,
|
||||
visibility: .internal
|
||||
visibility: .internal,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -156,12 +160,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
internal static var colorOne: Color {
|
||||
Color("colorOne")
|
||||
Color("colorOne", bundle: Bundle.module)
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
internal static var colorTwo: Color {
|
||||
Color("colorTwo")
|
||||
Color("colorTwo", bundle: Bundle.module)
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
@@ -20,14 +20,15 @@ final class ParsedColorTests: XCTestCase {
|
||||
let property = color.getColorProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
visibility: .public,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
@objc public var red: UIColor {
|
||||
UIColor(named: "red")!
|
||||
UIColor(named: "red", in: Bundle.main, compatibleWith: nil)!
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -42,14 +43,15 @@ final class ParsedColorTests: XCTestCase {
|
||||
let property = color.getColorProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .private
|
||||
visibility: .private,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
private static var red: UIColor {
|
||||
UIColor(named: "red")!
|
||||
UIColor(named: "red", in: Bundle.module, compatibleWith: nil)!
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -64,14 +66,15 @@ final class ParsedColorTests: XCTestCase {
|
||||
let property = color.getColorProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
visibility: .package,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
package var red: Color {
|
||||
Color("red")
|
||||
Color("red", bundle: Bundle.main)
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -86,14 +89,15 @@ final class ParsedColorTests: XCTestCase {
|
||||
let property = color.getColorProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .internal
|
||||
visibility: .internal,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
internal static var red: Color {
|
||||
Color("red")
|
||||
Color("red", bundle: Bundle.module)
|
||||
}
|
||||
"""
|
||||
|
||||
|
@@ -27,7 +27,8 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
visibility: .public,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -40,11 +41,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extension GenImages {
|
||||
|
||||
public var image_one: UIImage {
|
||||
UIImage(named: "image_one")!
|
||||
UIImage(named: "image_one", in: Bundle.main, with: nil)!
|
||||
}
|
||||
|
||||
public var image_two: UIImage {
|
||||
UIImage(named: "image_two")!
|
||||
UIImage(named: "image_two", in: Bundle.main, with: nil)!
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -66,7 +67,8 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: false,
|
||||
visibility: .internal
|
||||
visibility: .internal,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -79,11 +81,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extension GenImages {
|
||||
|
||||
internal static var image_one: UIImage {
|
||||
UIImage(named: "image_one")!
|
||||
UIImage(named: "image_one", in: Bundle.module, with: nil)!
|
||||
}
|
||||
|
||||
internal static var image_two: UIImage {
|
||||
UIImage(named: "image_two")!
|
||||
UIImage(named: "image_two", in: Bundle.module, with: nil)!
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -105,7 +107,8 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: true,
|
||||
visibility: .public
|
||||
visibility: .public,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -118,11 +121,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extension GenImages {
|
||||
|
||||
public var image_one: Image {
|
||||
Image("image_one")
|
||||
Image("image_one", bundle: Bundle.main)
|
||||
}
|
||||
|
||||
public var image_two: Image {
|
||||
Image("image_two")
|
||||
Image("image_two", bundle: Bundle.main)
|
||||
}
|
||||
}
|
||||
"""
|
||||
@@ -144,7 +147,8 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
visibility: .package,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
@@ -157,11 +161,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
extension GenImages {
|
||||
|
||||
package static var image_one: Image {
|
||||
Image("image_one")
|
||||
Image("image_one", bundle: Bundle.module)
|
||||
}
|
||||
|
||||
package static var image_two: Image {
|
||||
Image("image_two")
|
||||
Image("image_two", bundle: Bundle.module)
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
@@ -48,13 +48,14 @@ final class ParsedImageTests: XCTestCase {
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
visibility: .public,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
public var \(imageName): UIImage {
|
||||
UIImage(named: "\(imageName)")!
|
||||
UIImage(named: "\(imageName)", in: Bundle.main, with: nil)!
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -75,13 +76,14 @@ final class ParsedImageTests: XCTestCase {
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .internal
|
||||
visibility: .internal,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
internal static var \(imageName): UIImage {
|
||||
UIImage(named: "\(imageName)")!
|
||||
UIImage(named: "\(imageName)", in: Bundle.module, with: nil)!
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -102,13 +104,14 @@ final class ParsedImageTests: XCTestCase {
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .private
|
||||
visibility: .private,
|
||||
assetBundle: .main
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
private var \(imageName): Image {
|
||||
Image("\(imageName)")
|
||||
Image("\(imageName)", bundle: Bundle.main)
|
||||
}
|
||||
"""
|
||||
|
||||
@@ -129,13 +132,14 @@ final class ParsedImageTests: XCTestCase {
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
visibility: .package,
|
||||
assetBundle: .module
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
package static var \(imageName): Image {
|
||||
Image("\(imageName)")
|
||||
Image("\(imageName)", bundle: Bundle.module)
|
||||
}
|
||||
"""
|
||||
|
||||
|
Reference in New Issue
Block a user